diff --git a/extensions/search-result/src/extension.ts b/extensions/search-result/src/extension.ts index f7453a45d19..abb85dac201 100644 --- a/extensions/search-result/src/extension.ts +++ b/extensions/search-result/src/extension.ts @@ -77,9 +77,7 @@ export function activate(context: vscode.ExtensionContext) { const lineResult = parseSearchResults(document, token)[position.line]; if (!lineResult) { return []; } if (lineResult.type === 'file') { - // TODO: The multi-match peek UX isnt very smooth. - // return lineResult.allLocations.length > 1 ? lineResult.allLocations : [lineResult.location]; - return []; + return lineResult.allLocations; } const translateRangeSidewaysBy = (r: vscode.Range, n: number) => diff --git a/src/vs/workbench/contrib/search/browser/searchEditor.ts b/src/vs/workbench/contrib/search/browser/searchEditor.ts index 75a4e01069c..d9472c0d7bf 100644 --- a/src/vs/workbench/contrib/search/browser/searchEditor.ts +++ b/src/vs/workbench/contrib/search/browser/searchEditor.ts @@ -43,6 +43,7 @@ import { searchEditorFindMatchBorder, searchEditorFindMatch, registerColor, inpu import { attachInputBoxStyler } from 'vs/platform/theme/common/styler'; const RESULT_LINE_REGEX = /^(\s+)(\d+)(:| )(\s+)(.*)$/; +const FILE_LINE_REGEX = /^(\S.*):$/; export class SearchEditor extends BaseEditor { static readonly ID: string = 'workbench.editor.searchEditor'; @@ -168,6 +169,9 @@ export class SearchEditor extends BaseEditor { if (line.match(RESULT_LINE_REGEX)) { this.searchResultEditor.setSelection(Range.fromPositions(position)); this.commandService.executeCommand(behaviour === 'goToLocation' ? 'editor.action.goToDeclaration' : 'editor.action.openDeclarationToTheSide'); + } else if (line.match(FILE_LINE_REGEX)) { + this.searchResultEditor.setSelection(Range.fromPositions(position)); + this.commandService.executeCommand('editor.action.peekDefinition'); } } }