You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then hit enter at the end of the line to begin a new line. You'll get
a = a
* b;
*
This is not expected behavior in this context. This is perhaps expected when in the middle of a multiline decorated comment but not otherwise.
This does not happen in an unsaved file, a file with no extension, .txt extension etc. and does not happen if the cpptools extension is disabled and happens when it is re-enabled.
Reacted by James Yu, amelvill, Kartik Raj, Matt Bierner and Amir Akhundzianov
The user wants to keep the last rule when inside a multiline comment, but from what I understand the beforeText can only match a single line, so it appears that there's no way for us to write a rule that can detect whether we're in a multiline comment or not (e.g. by looking at the previous line).
Reacted by amelvill, Aiday Marlen Kyzy and Amir Akhundzianov
It seems like the described behaviour is fixed, but the main issue is still there. onEnterRules should be multi-line aware. I have example where this is very annoying in my usecase.
from this position
And then you have to erase quite a bit to get to the right indention level. While probably onEnter should just recognise both lines as the whole expression due to unclosed brackets. And indent with respect to beginning of expression.
Activity
aeschli commentedon Jun 4, 2018
The CPP extension sets
onEnterRuleslike TypeScript:Looks like the last rule matches here and causes the observed behavior.
[-]Regexp should be multi-line aware[/-][+]onEnterRules should be multi-line aware[/+]bobbrow commentedon Jul 20, 2018
The user wants to keep the last rule when inside a multiline comment, but from what I understand the
beforeTextcan only match a single line, so it appears that there's no way for us to write a rule that can detect whether we're in a multiline comment or not (e.g. by looking at the previous line).Hacker1337 commentedon May 17, 2025
It seems like the described behaviour is fixed, but the main issue is still there. onEnterRules should be multi-line aware. I have example where this is very annoying in my usecase.
from this position
enter transfers you to
instead of
And then you have to erase quite a bit to get to the right indention level. While probably onEnter should just recognise both lines as the whole expression due to unclosed brackets. And indent with respect to beginning of expression.