feat: add Go to Result and Open Result to Side commands for search editor#306567
Open
yogeshwaran-c wants to merge 2 commits into
Open
feat: add Go to Result and Open Result to Side commands for search editor#306567yogeshwaran-c wants to merge 2 commits into
yogeshwaran-c wants to merge 2 commits into
Conversation
…itor Add two new commands (searchEditor.action.goToResult and searchEditor.action.openResultToSide) that allow navigating to search results from the keyboard, matching the double-click behavior. The existing double-click handler is refactored to share the new openResult helper method. Both commands are available via the Command Palette when a Search Editor is active, and users can assign custom keybindings. Closes microsoft#194044
Contributor
There was a problem hiding this comment.
Pull request overview
Adds two new Command Palette commands to the Search Editor — "Go to Result" and "Open Result to the Side" — addressing issue #194044. The double-click handler is refactored to share a new openResult() helper with the new commands.
Changes:
- Introduce
goToResultCommandandopenResultToSideCommandaction functions and register them asAction2withInSearchEditorprecondition andf1: true. - Extract the double-click navigation logic into a shared
SearchEditor.openResult()method, exposed viagoToResult()andopenResultToSide(). - Add new command IDs to
constants.ts.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/searchEditor/browser/constants.ts | Adds two new command ID constants. |
| src/vs/workbench/contrib/searchEditor/browser/searchEditor.ts | Refactors double-click handler into a reusable openResult() helper and exposes goToResult/openResultToSide. |
| src/vs/workbench/contrib/searchEditor/browser/searchEditorActions.ts | Adds new accessor-based command functions that delegate to the active SearchEditor. |
| src/vs/workbench/contrib/searchEditor/browser/searchEditor.contribution.ts | Registers the two new actions in the Command Palette. |
Copilot's findings
- Files reviewed: 4/4 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.
What kind of change does this PR introduce?
Feature — adds two new commands to the Search Editor
What is the current behavior?
In the Search Editor, navigating to a search result can only be done via:
search.searchEditor.doubleClickBehaviour)F12(Go to Definition) /Ctrl+K F12(Open Definition to Side)There are no dedicated Search Editor commands for "go to result" or "open result to the side" that users can discover via the Command Palette or bind to custom keybindings.
Closes #194044
What is the new behavior?
Two new commands are added:
searchEditor.action.goToResult) — navigates to the result at the cursor position in the active editor groupsearchEditor.action.openResultToSide) — opens the result in an editor group to the sideBoth commands:
The existing double-click handler has been refactored to share the same
openResult()helper method, reducing code duplication.Additional context
Implementation follows the approach suggested by @andreamah in the issue comment: abstracting the double-click logic into a reusable method and exposing it as search editor actions.
No default keybindings are assigned to avoid conflicts with the editor's text editing shortcuts — users can configure their preferred bindings (e.g.,
Enter/Cmd+Enter) through the Keyboard Shortcuts editor.