Skip to content

Fix accidental dedent for in and when dedent in Ruby comments - #206132

Merged
Peng Lyu (rebornix) merged 1 commit into
microsoft:mainfrom
vinistock:vs/fix_in_dedent_in_comments
Feb 23, 2024
Merged

Peng Lyu (rebornix) merged 1 commit into
microsoft:mainfrom
vinistock:vs/fix_in_dedent_in_comments

Conversation

@vinistock

Copy link
Copy Markdown
Contributor

I was testing the changes from #205397 in Insiders and I noticed that the code was incorrectly being dedented when typing in or when in comments.

We got the parenthesis balance incorrect in the regex. The regex has three outer groups for an or condition and we closed the group incorrectly, which made the last part of the regex skip the \s* part (which verifies that only blank spaces are in the front of the string).

This PR fixes the bug by properly balancing the parenthesis. The tests was also missing the ^ anchor, which I added to match the language configuration.

cc Peng Lyu (@rebornix)

@rebornix

Copy link
Copy Markdown
Contributor

Vinicius Stock (@vinistock) thanks for the quick fix! Does it only affect comments? We are in endgame mode so I'm trying to understand if it's worth a candidate or if we should pull back the previous change and merge together with this one.

@vscodenpa VS Code Bot (vscodenpa) added this to the March 2024 milestone Feb 23, 2024
@rebornix
Peng Lyu (rebornix) merged commit 250466a into microsoft:main Feb 23, 2024
@vinistock

Copy link
Copy Markdown
Contributor Author

Peng Lyu (@rebornix) because of the unbalanced parenthesis, it ignores the \s* part, meaning it matches any in|when words - not just comments. Even if you start writing a method call like within and put a space, it will incorrectly dedent.

I don't know what the endgame policies are, but in my opinion it's definitely worth either pulling back the previous change or including this one.

@vinistock
Vinicius Stock (vinistock) deleted the vs/fix_in_dedent_in_comments branch February 24, 2024 18:14
@microsoft Microsoft (microsoft) locked and limited conversation to collaborators Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants