Skip to content

Seed Quick Open (Ctrl+P) filter value from editor selection - #330538

Open
Jade Ferreira Vieira (jadefr) wants to merge 2 commits into
microsoft:mainfrom
jadefr:feature/quick-open-selected-text
Open

Seed Quick Open (Ctrl+P) filter value from editor selection#330538
Jade Ferreira Vieira (jadefr) wants to merge 2 commits into
microsoft:mainfrom
jadefr:feature/quick-open-selected-text

Conversation

@jadefr

@jadefr Jade Ferreira Vieira (jadefr) commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

When text is selected in the editor and you press Ctrl+P, Quick Open now pre-fills
the filter with that selection.

This is the same existing behavior of Find in Files (Ctrl+Shift+F) and Go to Symbol (Ctrl+T).

It only seeds from an explicit, non-empty selection. Intentionally it does not honor editor.find.seedSearchStringFromSelection, since that setting's default would introduce word-at-cursor seeding here.

selection

Copilot AI balanced review requested due to automatic review settings August 12, 2026 20:24
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

Benjamin Christopher Simmonds (@benibenj)

Matched files:

  • src/vs/workbench/browser/parts/editor/multiEditorTabsControl.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Seeds Quick Open from an explicit editor selection.

Changes:

  • Uses selected single-line text as the Quick Open filter.
  • Adds an unrelated Alt+Click tab-closing gesture.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
anythingQuickAccess.ts Seeds the Quick Open filter from editor selection.
multiEditorTabsControl.ts Adds Alt+Click handling for closing other tabs.
Suppressed comments (1)

src/vs/workbench/browser/parts/editor/multiEditorTabsControl.ts:950

  • This closes the other editors on mousedown, but preventing/stopping mousedown does not cancel the subsequent click. Since the ActionBar already displays and runs CloseOtherEditorTabsInGroupAction while Alt is held, one gesture can start two concurrent closeEditors operations, potentially duplicating dirty-editor prompts or racing closure. Remove this extra listener and rely on the existing action.
		const tabActionsAltClickListener = addDisposableListener(tabActionsContainer, EventType.MOUSE_DOWN, e => {
			if (!isMouseEvent(e) || e.button !== 0 || !e.altKey) {
				return;
			}

			EventHelper.stop(e, true);

			const editor = this.tabsModel.getEditorByIndex(tabIndex);
			if (!editor) {
				return;
			}

			this.blockRevealActiveTabOnce();

			const editorsToClose = this.groupView.getEditors(EditorsOrder.SEQUENTIAL, { excludeSticky: true }).filter(other => !other.matches(editor));
			this.groupView.closeEditors(editorsToClose);
		}, true /* capture */);

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +932 to +934
// Alt+Click to close other tabs
// Closes every other non-sticky tab, leaving the current tab open
const tabActionsAltClickListener = addDisposableListener(tabActionsContainer, EventType.MOUSE_DOWN, e => {
// Prefer the current editor selection as default filter, but only an explicit selection (unlike Ctrl+T, an idle cursor's word would fire on nearly every invocation)
const editor = this.codeEditorService.getFocusedCodeEditor();
if (editor) {
return getSelectionSearchString(editor, 'single', true) ?? undefined;
Mirrors the same pattern workspace symbol search (Ctrl+T) already uses
via getSelectionSearchString, JetBrains-style.
Ctrl+T falls back to the word under an idle cursor, which is fine for
symbol search. For Ctrl+P that fallback fired on nearly every
invocation, pre-filling the filter with whatever word the cursor
happened to sit on instead of leaving it empty for a filename.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

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.

3 participants