Skip to content
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

Feature request: RStudio command: Reflow selected comment lines so they wrap evenly #1778

Open
EmilHvitfeldt opened this issue Nov 3, 2023 · 8 comments
Labels
area: api Issues related to API category. area: formatting Issues related to formatting and indentation
Milestone

Comments

@EmilHvitfeldt
Copy link

EmilHvitfeldt commented Nov 3, 2023

Positron Version:

Positron Version: 2023.10.0 (Universal) build 1453
Code - OSS Version: 1.83.0
Commit: b781e9e
Date: 2023-10-30T03:03:08.650Z
Electron: 25.8.4
ElectronBuildId: undefined
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin arm64 22.6.0

Steps to reproduce the issue:

Screenshot 2023-11-02 at 8 44 42 PM

What did you expect to happen?

I love this feature from RStudio, i can write write write, do the keybinding and don't have to worry about anything (mostly)

Might be related to #1407

Were there any error messages in the output or Developer Tools console?

Nope

@jmcphers
Copy link
Collaborator

jmcphers commented Jan 4, 2024

Thinking about this a little ...

VS Code doesn't seem to have this feature natively (which is kind of a surprise; like spell check -- see #1485 -- it seems pretty basic). There is an incredibly popular extension ("Rewrap") that adds the functionality.

https://marketplace.visualstudio.com/items?itemName=stkb.rewrap

We could bundle the extension, but it feels like this is something we might want to have an extensibility point for in language packs. RStudio's reflow logic is very complicated because it tries to be smart about e.g. roxygen tags and indentation.

@jmcphers
Copy link
Collaborator

Also requested by @cderv here: https://positpbc.slack.com/archives/C05M2EZCPGR/p1705938483308749?thread_ts=1705091129.004509&cid=C05M2EZCPGR

CTRL + MAJ + : to reflow comment. I used that quite often when writing comments and roxygen docs for function, so that lines are wrapped.

@jennybc jennybc added this to the Future milestone Feb 23, 2024
@wesm wesm added the area: api Issues related to API category. label Feb 29, 2024
@jmcphers
Copy link
Collaborator

Also requested by private beta user: https://github.com/posit-dev/positron-beta/discussions/98

@jennybc
Copy link
Member

jennybc commented Apr 17, 2024

I also miss this RStudio feature a lot.

@DavisVaughan
Copy link
Contributor

VS Code doesn't seem to have this feature natively

I don't think I'm 100% surprised about this because I think your formatter typically provides this - like in rustfmt you can control this and have it reflow comments on save

@juliasilge
Copy link
Contributor

juliasilge commented Apr 17, 2024

If you are in an R file, you can use this extension pretty smoothly for regular comments, but it doesn't deal with roxygen comments well.

If you are in a Quarto file, that extension doesn't work (I believe because the language ID is "quarto" which it doesn't know how to handle). I've opened this issue so we can see what to do about this.

@lionel- lionel- added the area: formatting Issues related to formatting and indentation label Jun 11, 2024
@bakaburg1
Copy link

Hello! any news on this? expecially roxygen documentation reflowing is though by hand

@zkamvar
Copy link

zkamvar commented Sep 11, 2024

This feature would be really nice to have because at the moment, there are times when roxygen tags that are not properly indented end up borking: r-lib/roxygen2#1651

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: api Issues related to API category. area: formatting Issues related to formatting and indentation
Projects
None yet
Development

No branches or pull requests

9 participants