Double click on file name to peek. Closes #89467

This commit is contained in:
Jackson Kearl
2020-01-29 00:42:59 -08:00
parent ed3b791a7a
commit 6da863f768
2 changed files with 5 additions and 3 deletions

View File

@@ -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) =>

View File

@@ -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');
}
}
}