-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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 "same" or "until here" indent capture #3196
Comments
I want to concur that this would be a hugely useful addition - currently I'm using neovim and indents along these lines would make me switch. |
I definitely agree that aligning syntax nodes is a much-needed feature. I think the system needs to be slightly more general than what you describe, though. For example in C/C++, if a function declaration doesn't fit on a single line, the parameter list is often split into several lines that are all aligned: void func_with_many_args(int some_first_argument,
int some_second_argument,
int some_third_argument);
Note that even though the
For other use cases, one could simply set Continuing comments could also nicely integrate in the indentation system. One could add a field
The additional regex match is needed here since the rust tree-sitter grammar doesn't distinguish between comments starting with |
I'm currently prototyping |
I'm also not too familiar with haskell and haven't written any in years now. The most popular formatting tool for it seems to be "hident" though, and it has a lot of examples on how code is formatted: https://github.com/mihaimaruseac/hindent/blob/master/TESTS.md |
Describe your feature request
In some language (of the top of my mind Haskell and Markdown) you want to indent the next line as much as the previous one or indent it up to a certain point in the previous line.
Examples
haskell
markdown
* multiline list item
This could be solved by adding a new capture
@indent-until-here
that causes all subsequent lines to be indented as far as the end (or maybe start, I guess that's up to discussion) of the captured node.Something else that might be useful is allowing to set the exact string of the added indentation for all indent captures. This way multline comment markers could be handled as part of indentation. (See #1730).
Example
If the cursor is at the
|
and I press enter we might want to automatically add///
to the beginning of the new line.The text was updated successfully, but these errors were encountered: