Skip to content

Commit 3d57c3e

Browse files
simplify complicated matching + remove package styler
1 parent 04b62c0 commit 3d57c3e

File tree

2 files changed

+1
-33
lines changed

2 files changed

+1
-33
lines changed

R/addins.R

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -97,35 +97,8 @@ get_rstudio_context <- function() {
9797
rstudioapi::getActiveDocumentContext()
9898
}
9999

100-
101-
# Dedicated binding for package styling addin. Simple wrapper calling style_pkg
102-
# with the selected addins style.
103-
style_package <- function() {
104-
communicate_addins_style()
105-
style_pkg(style = get_addins_style_fun())
106-
}
107-
108-
109-
# `match.fun`-like utility covering "ns::name".
110-
exported_value_rx <- "^([^:]+)::([^:]+)$"
111-
is_exported_value <- function(x) {
112-
rlang::is_scalar_character(x) && grepl(exported_value_rx, x)
113-
}
114-
extract_exported_ns <- function(x) {
115-
sub(exported_value_rx, "\\1", x)
116-
}
117-
extract_exported_name <- function(x) {
118-
sub(exported_value_rx, "\\2", x)
119-
}
120100
match_fun <- function(x) {
121-
if (is_exported_value(x)) {
122-
x <-
123-
getExportedValue(
124-
extract_exported_ns(x),
125-
extract_exported_name(x)
126-
)
127-
}
128-
match.fun(x)
101+
eval(parse(text = x))
129102
}
130103

131104
# Binding for style-setting addin.

inst/rstudio/addins.dcf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ Description: Prompt for and set the style used by all STYLER addins
33
Binding: prompt_style
44
Interactive: true
55

6-
Name: Style package
7-
Description: Pretty-print package source code
8-
Binding: style_package
9-
Interactive: true
10-
116
Name: Style active file
127
Description: Pretty-print active file
138
Binding: style_active_file

0 commit comments

Comments
 (0)