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

Indenting doc-comments should leave comment symbol at start of line #12486

Open
dylwil3 opened this issue Jan 10, 2025 · 2 comments
Open

Indenting doc-comments should leave comment symbol at start of line #12486

dylwil3 opened this issue Jan 10, 2025 · 2 comments
Labels
C-enhancement Category: Improvements

Comments

@dylwil3
Copy link

dylwil3 commented Jan 10, 2025

Love the latest release! One small tweak would help improve the experience around doc-comments. At the moment if I have something like (in Rust):

\\! My module documentation
\\! Something I meant to indent

and I try to indent the second line with >, I get

\\! My module documentation
    \\! Something I meant to indent

but I actually want

\\! My module documentation
\\!     Something I meant to indent

Apologies if this has already been requested or if there is a simple way around this that I don't know about.

Thanks for helix, it's great!

@dylwil3 dylwil3 added the C-enhancement Category: Improvements label Jan 10, 2025
@TornaxO7
Copy link
Contributor

TornaxO7 commented Jan 16, 2025

Hm... I'm a bit unsure about this one.
Imagine you have the following code block:

fn main() {
// epic comment
let a = 10;
}

and you would like to fix the indentation by using >. What I'd do, is selecting the comment and the let line and press >.
Now, with your suggested behaviour, it would result into this:

fn main() {
//     epic comment
    let a = 10;
}

Which is very likely not the wanted outcome.
Hm... maybe a new keybinding can be added where you need to press > + Alt which will only shift text within comments?

@dylwil3
Copy link
Author

dylwil3 commented Jan 16, 2025

Maybe that case could also be addressed with the following heuristic: only use the new behavior when all selected lines are comments.

Then you could select both // epic comment and let a = 10; in your example, before pressing >. That would avoid the need for an override key. Incidentally, this would be consistent with the new behavior for o/O, where (as far as I know?) there isn't really an override key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

2 participants