-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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 support for capture groups in onEnterRules #17281
Comments
cc @jrieken I would like to look into this in February, if I have the chance. But I would like to have it aligned with the way snippets do variables. From what I could tell snippets use both |
Yes, but a variable name is |
To clarify: I don't intend that pressing Enter would bring the user into snippet mode. This is more about capturing the indentation of the line via a capture group and then reusing it in So I would just go with |
Right, using |
For me, there are two indentations in this example. Is there a scenario where it makes sense to reference a regex group that matches non-whitespace text? Also, should indentation/dedentation be supported for nested indentations (rather than just keeping the indentation as is)? Maybe it might also be valuable to consider embedded languages in general. Imagine using a markdown codeblock in doc-comments: /**
* Example:
* ```ts
* class Foo { <<User types enter here>>
*
* ```
*
*/
function bar() {} Ideally, the outer and inner typescript rules would be combined somehow, yielding this: /**
* Example:
* ```ts
* class Foo {
* <<New Cursor Position>>
*
* ```
*
*/
function bar() {} Currently VS Code ignores the rules of the inner language. This feature would not fix #66235 anyway. I think this feature might require more discussions. |
From @siegebell in #3088 (comment)
Before:
After:
For this case,
onEnterRules
could be extended to support matching groups like find/replace currently does...The text was updated successfully, but these errors were encountered: