Fix SelectionMatchFindAction to respect seedSearchStringFromSelection setting#300086
Open
teoincontatto wants to merge 2 commits into
Open
Fix SelectionMatchFindAction to respect seedSearchStringFromSelection setting#300086teoincontatto wants to merge 2 commits into
teoincontatto wants to merge 2 commits into
Conversation
c92ab58 to
1e3279d
Compare
The `editor.action.nextSelectionMatchFindAction` and `editor.action.previousSelectionMatchFindAction` commands previously hardcoded `getSelectionSearchString(editor, 'single', false)`, ignoring the `editor.find.seedSearchStringFromSelection` setting entirely. This caused the action to always pick up the word at the cursor position when there was no active selection, even when the user had configured the setting to `"selection"` to prevent this behavior. Now the `SelectionMatchFindAction` reads the `editor.find.seedSearchStringFromSelection` option and passes it through consistently, matching the behavior of `StartFindAction` and other find actions: - `"always"` (default): seeds from selection or word at cursor (unchanged) - `"selection"`: seeds only from an actual selection, not word at cursor - `"never"`: never seeds the search string from the editor Fixes the workflow where a user selects text, uses Find Next Selection Match, pastes a replacement, then expects the next invocation to continue searching for the original term rather than picking up the word at the cursor.
1e3279d to
7c3b0f5
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes SelectionMatchFindAction (next/previous selection match find actions) to honor the editor.find.seedSearchStringFromSelection setting, aligning its behavior with StartFindAction and other find actions. Previously it hardcoded the word-at-cursor fallback regardless of user configuration.
Changes:
- Read
editor.find.seedSearchStringFromSelectionoption inSelectionMatchFindAction.run(). - Skip seeding when set to
'never', and only enable word-at-cursor fallback when set to'always'.
Show a summary per file
| File | Description |
|---|---|
| src/vs/editor/contrib/find/browser/findController.ts | Replace hardcoded getSelectionSearchString(editor, 'single', false) call with logic that respects the seedSearchStringFromSelection setting. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
editor.action.nextSelectionMatchFindActionandeditor.action.previousSelectionMatchFindActionrespect theeditor.find.seedSearchStringFromSelectionsettinggetSelectionSearchString(editor, 'single', false), always enabling the word-at-cursor fallback regardless of user configurationStartFindActionand other find actionsFixes #300085
Change
One-line change in
SelectionMatchFindAction.run()(src/vs/editor/contrib/find/browser/findController.ts):Before:
After:
Behavior by setting value
"always"(default)"selection""never"Test plan
"editor.find.seedSearchStringFromSelection": "always"(default): select text,Cmd+F3, paste replacement,Cmd+F3again → picks up word at cursor (unchanged behavior)"editor.find.seedSearchStringFromSelection": "selection": select text,Cmd+F3, paste replacement,Cmd+F3again → continues searching previous term (fixed)"editor.find.seedSearchStringFromSelection": "never":Cmd+F3never seeds from editor (fixed)editor.action.previousSelectionMatchFindAction