-
Notifications
You must be signed in to change notification settings - Fork 92
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
Add onEnterRules
for regular old comments in R
#6049
base: main
Are you sure you want to change the base?
Conversation
E2E Tests 🚀 |
I would expect R to behave like the Python behaviour you describe. In Zed comments are continued after pressing enter at the end of the line by default, and it's quite unexpected to me every time, as well as annoying. IIRC @DavisVaughan feels the same. At least the behaviour is configurable via It's also worth considering that once we have a stronger story for refilling / word-wrapping comments (e.g. via air formatting) hitting enter at the end of the line to continue a comment will not be a necessary or recommended workflow since manual wrapping is often wrong. |
To be super clear is this continuing comments that aren't "in the middle"? For example, if we hit enter at the cursor do we get a continued comment now? # comment<cursor>
1 + 1 Or do we only get a continued comment after an Enter press here, "in the middle" of two comments? # comment1<cursor>
# comment2 I believe I would greatly dislike if the first example continued a comment. |
I just dug into this a little bit more:
|
Yea but only if you opt in to this setting that enables it for regular comments, which I (and presumably most RStudio users) have never done |
Have either of you ever noticed the behavior for roxygen comments and/or plumber comments? |
Yes I appreciate the trailing continuation comment for roxygen comments because I am generally writing a big block of doc comments at once, so continuation almost always makes sense there But with normal R comments I'd say the 90% case is that my comment spans a single line, so when I hit enter after it I typically like to get out of comment mode |
I feel like it is pretty typical of programming languages for doc comments to have continuation behavior, but normal comments don't. Rust does this, for example. |
I just did a bit more research and I don't believe we can put |
Addresses #5974
The order in this JSON file is important; if you put the regular comment rule before the ones for plumber and roxygen, it takes precedence and we lose the special behavior for plumber and roxygen. It has to go after.
We have continuation behavior for Python already here:
positron/extensions/positron-python/src/client/language/languageConfiguration.ts
Lines 25 to 33 in c200f27
It is slightly different than what we've chosen for R; it will continue in the middle of a comment but not at the end. We inherit this behavior from upstream, while the R behavior was chosen to be more like RStudio. It's a little weird that the behavior is different but maybe appropriate, for the two language communities?
Release Notes
New Features
Bug Fixes
QA Notes
The comment continuation for roxygen (
#'
) and plumber (#*
) should continue to work in.R
files in R Quarto cells, and now we will additionally continue regular old comments (#
) in the same spots.