Skip to content

Fix #32541: toggle block comment when cursor is inside comment#309332

Open
amartin217 wants to merge 3 commits intomicrosoft:mainfrom
amartin217:uncomment-block
Open

Fix #32541: toggle block comment when cursor is inside comment#309332
amartin217 wants to merge 3 commits intomicrosoft:mainfrom
amartin217:uncomment-block

Conversation

@amartin217
Copy link
Copy Markdown

Fix #32541: Toggle block comment from inside comment block

Summary:
Improves editor.action.blockComment so that when the cursor is inside an existing block comment with no selection, the command will remove the surrounding block comment instead of inserting a new one.

Changes:

  • Detects when the cursor is inside a block comment using language configuration
  • If collapsed selection is inside a block comment, removes the full block comment range
  • Preserves existing behavior for selections, multi-cursor edits, and non-commented code

Why:
Makes block comment toggling more intuitive by allowing users to toggle comments without manually selecting the entire block, matching behavior in other editors.

Notes:
-Language-aware (no hardcoded comment tokens)
-No changes to line comment behavior or selection-based toggling

@amartin217
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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.

Toggle the block comment without having to select it

3 participants