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

Continue line comments #10996

Merged
merged 65 commits into from
Oct 19, 2024

Conversation

TornaxO7
Copy link
Contributor

Closes #1730

Continues #8664

This is my attempt to apply the changes of #4718 to the PR.

@TornaxO7
Copy link
Contributor Author

TornaxO7 commented Jun 20, 2024

One thing which bothers me is how we want to "continue" the comment from block comments like for C of this style:

/*
 * | <-- let's say here's the cursor, how should we "recognize" this `*`? Adding another entry in `language.toml` per language which should indicate which "multiblock-continuity" there are?
 */

Should this be tackled in this PR or in another PR? Should this be tackled at all?

@kirawi kirawi added the A-core Area: Helix core improvements label Jun 21, 2024
@the-mikedavis
Copy link
Member

Yeah good point, I hadn't thought to use C-w to remove the comment token. Kakoune's behavior for this is confusing and maybe buggy - enter sometimes strips the comment token but it depends on the language and context. Using C-w is more explicit and predictable and we should avoid ruining the experience of continuing a comment over multiple lines, for example adding an extra line to break up paragraphs in markdown in a Rust doc comment.

For that use-case specifically I believe we also want to be trimming whitespace under certain conditions in insert_newline, similar to #4854 but not just when the line is all whitespace. That way you can hit Enter Enter to continue a line comment twice and trim the trailing whitespace after the first continuation. I have a change locally to do this but I'll submit it after this is merged since it will conflict (only because of formatting changes)

Co-authored-by: Michael Davis <[email protected]>
@the-mikedavis the-mikedavis changed the title Continue single comment Continue line comments Oct 7, 2024
the-mikedavis
the-mikedavis previously approved these changes Oct 7, 2024
helix-core/src/comment.rs Outdated Show resolved Hide resolved
helix-core/src/comment.rs Show resolved Hide resolved
new_text.push_str(token);
new_text.push(' ');
new_text.chars().count()
} else if on_auto_pair {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a limitation we want to have in thr lognterm but usually autopairs within comments are a bit niche and likely hard to fix until some other changss land so this is probably fine for now.

pascalkuthe
pascalkuthe previously approved these changes Oct 19, 2024
@the-mikedavis the-mikedavis merged commit be2884d into helix-editor:master Oct 19, 2024
6 checks passed
@TornaxO7
Copy link
Contributor Author

peepoAwesome

@eanyanwu
Copy link

This just made my night. Thank you @TornaxO7 & rest of the maintainers 🙌🏾 🙌🏾 for the steady progress.
It sure pays off to read through the latest commits every few days 😆

@TornaxO7
Copy link
Contributor Author

You're welcome
peepoBucket

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Helix core improvements S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Continue comments
6 participants