Skip to content

feat: add Go to Result and Open Result to Side commands for search editor#306567

Open
yogeshwaran-c wants to merge 2 commits into
microsoft:mainfrom
yogeshwaran-c:feat/search-editor-go-to-result-keybinding
Open

feat: add Go to Result and Open Result to Side commands for search editor#306567
yogeshwaran-c wants to merge 2 commits into
microsoft:mainfrom
yogeshwaran-c:feat/search-editor-go-to-result-keybinding

Conversation

@yogeshwaran-c
Copy link
Copy Markdown
Contributor

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:

  • Double-clicking (configurable 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:

  • Search Editor: Go to Result (searchEditor.action.goToResult) — navigates to the result at the cursor position in the active editor group
  • Search Editor: Open Result to the Side (searchEditor.action.openResultToSide) — opens the result in an editor group to the side

Both commands:

  • Are available in the Command Palette when a Search Editor is active
  • Can be assigned custom keybindings by users
  • Handle both result lines (go to declaration / open to side) and file header lines (peek definition)

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.

…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
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 goToResultCommand and openResultToSideCommand action functions and register them as Action2 with InSearchEditor precondition and f1: true.
  • Extract the double-click navigation logic into a shared SearchEditor.openResult() method, exposed via goToResult() and openResultToSide().
  • 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

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.

Search Editor: Add keybinding for double-click action, e.g. to open to the side

3 participants