-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow selecting the style used by RStudio addins. #463
Conversation
* "styler.addins.style" option stores the selected style. * New addin to set the style. * Existing addins adapted to use the selected style.
Codecov Report
@@ Coverage Diff @@
## master #463 +/- ##
=========================================
- Coverage 90.65% 88.7% -1.96%
=========================================
Files 36 36
Lines 1627 1664 +37
=========================================
+ Hits 1475 1476 +1
- Misses 152 188 +36
Continue to review full report at Codecov.
|
R/addins.R
Outdated
|
||
# Dedicated binding for package styling addin. Simple wrapper calling style_pkg | ||
# with the selected addins style. | ||
style_package <- function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't want another Addin, see also #250.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually thanks go @jonmcalder we have figured out that you have not registered a new Addin, just moved existing code. I overlooked that. Sorry. Will add in #500 again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought this was intentional, as discussed when integrating your tweaks in miraisolutions#1 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, no problem!
First of all, thanks @riccardoporreca for the PR. I think I need to test it myself and then I will review the PR. |
@lorenzwalthert, sure, I will also be happy to discuss if, despite the reasonable point of not cluttering the addins, the concept and utilities for setting and using a given style guide for the addins could be still useful. |
Thanks. Just to make it clear, I see that the PR has two parts and I also think the functionality about style selection is something we'd want to support. Apart from the implementation details, one thing I am not sure about is how to deal with global variables and environment variables and default values. I created fallback and integrated it into styler (compare #319), but I am not sure if it's the best solution. I.e. if the default style should be set in a |
I changed my mind and we will defer the questions regarding default values and just go with R options for now. Hope to find time to review soon. |
Co-Authored-By: lorenzwalthert <lorenz.walthert@icloud.com>
Co-Authored-By: lorenzwalthert <lorenz.walthert@icloud.com>
Tweaks for the PR to r-lib#463
thanks @riccardoporreca. There is one minor thing about error messages which I will fix when working on #472. The Add-in has passed my manual test with the oneline style guide too, so it's all fine 😄. |
Great, well spotted with the error message and the concise rlang alternative. Thanks @lorenzwalthert for the nice collaboration on the PR. |
@riccardoporreca I just realized that instead of asking for a style, we should maybe ask for transformers, because then, people could also specify arguments thereof, e.g. the scope: style_text(transformers = tidyerse_style(scope = "spaces", ...) This is not currently possible because the input for the Addin is a style, i.e. styler::tidyverse_style and not transformers, e.g. styler::tidyverse_style() |
@lorenzwalthert, I agree. I am not sure how you would describe the addin with this new approach, "transformers" is somehow a less intuitive term than "style" for the user, so maybe the addin can still be called "Set Style" and described as "Prompt for and set the style transformers used by all STYLER addins", or something more sensible. Similar for the prompt and error messages. |
"styler.addins.style"
stores the selected style.