Skip to content

fix: bug in Restrict continue comment - #322668

Merged
Dmitriy Vasyura (dmitrivMS) merged 6 commits into
microsoft:mainfrom
RedCMD:restrictContinueComment
Jul 29, 2026
Merged

fix: bug in Restrict continue comment#322668
Dmitriy Vasyura (dmitrivMS) merged 6 commits into
microsoft:mainfrom
RedCMD:restrictContinueComment

Conversation

@RedCMD

Copy link
Copy Markdown
Contributor

fixes #236828
fixes #321230

re-adds the \\S requirement to the regex

Copilot AI review requested due to automatic review settings June 24, 2026 04:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates multiple built-in language configurations to refine the “continue line comment on Enter” rule, reintroducing a non-whitespace (\S) requirement so // alone won’t trigger comment continuation. This is aligned with the goal of reducing accidental comment continuation in common non-comment scenarios (e.g., URLs/paths) while still supporting intentional line comments.

Changes:

  • Tightened beforeText for // continuation to require actual comment content (\S) and to better constrain where // is recognized as a comment start.
  • Simplified afterText from ^(?!\s*$).+ to ^(?!\s*$) across affected language configurations.
  • Adjusted C# rules to explicitly handle /// documentation comment continuation separately from normal // comments.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
extensions/typescript-basics/language-configuration.json Updates // on-enter continuation regex to require non-whitespace content.
extensions/swift/language-configuration.json Aligns // on-enter continuation rule with the tightened regex.
extensions/rust/language-configuration.json Aligns // on-enter continuation rule with the tightened regex.
extensions/php/language-configuration.json Aligns // on-enter continuation rule with the tightened regex.
extensions/objective-c/language-configuration.json Aligns // on-enter continuation rule with the tightened regex.
extensions/less/language-configuration.json Aligns // on-enter continuation rule with the tightened regex.
extensions/json/language-configuration.json Aligns // on-enter continuation rule with the tightened regex.
extensions/javascript/javascript-language-configuration.json Updates // on-enter continuation regex to require non-whitespace content.
extensions/java/language-configuration.json Aligns // on-enter continuation rule with the tightened regex.
extensions/groovy/language-configuration.json Aligns // on-enter continuation rule with the tightened regex.
extensions/go/language-configuration.json Aligns // on-enter continuation rule with the tightened regex.
extensions/csharp/language-configuration.json Separates /// doc-comment continuation from // and updates // continuation regex.
extensions/cpp/language-configuration.json Aligns // on-enter continuation rule with the tightened regex.
Comments suppressed due to low confidence (1)

extensions/csharp/language-configuration.json:107

  • The documentation-comment onEnter rule also matches lines starting with //// because it only checks for a /// prefix. That will cause Enter inside a normal //// line comment to continue with /// instead of // .

Consider excluding a 4th slash via a negative lookahead so only exactly-three-slash doc comments trigger this rule.

			"beforeText": "^\\s*\/\/\/",

@dmitrivMS
Dmitriy Vasyura (dmitrivMS) enabled auto-merge (squash) July 28, 2026 23:19
@dmitrivMS
Dmitriy Vasyura (dmitrivMS) merged commit 05e2931 into microsoft:main Jul 29, 2026
29 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.132.0 milestone Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🚨 Stop adding comment when enter is pressed

5 participants