-
Notifications
You must be signed in to change notification settings - Fork 37.3k
Enable selection of content inside brackets or string via mouse double-click #285305
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enables selection of content inside brackets or strings by double-clicking next to the opening or closing delimiter. The feature integrates into the existing double-click word selection behavior in the editor.
Key Changes:
- Added
_trySelectBracketContentand_trySelectStringContentmethods toViewControllerto detect and select content when double-clicking adjacent to delimiters - Modified the double-click handler in
dispatchMouseto attempt bracket/string content selection before falling back to word selection - Added helper method
_selectto apply selections via core commands
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/vs/editor/browser/view/viewController.ts | Implements the core logic for detecting double-clicks near brackets/quotes and selecting the content inside; integrates with existing mouse dispatch handling |
| src/vs/editor/contrib/bracketMatching/test/browser/bracketMatching.test.ts | Adds tests for bracket content selection, though the tests manually simulate the expected behavior rather than testing the actual feature implementation |
Fixes #9123
Enables selection of brackets/string contents by double-clicking next to bracket/quote inside.
Does not include any of the following:
I considered adding a setting to turn this off, but decided against it for now because double-clicking in such locations seem to do nothing particularly useful today.