Use selected text for query when runnning Open Search Editor with an existing editor
Always select the full query text when running Open Search Editor with no selection Closes #105032. Closes #105031.
This commit is contained in:
parent
7f4c958024
commit
2611bffc41
|
@ -280,6 +280,14 @@ export class SearchEditor extends BaseTextEditor {
|
|||
}
|
||||
}
|
||||
|
||||
setQuery(query: string) {
|
||||
this.queryEditorWidget.searchInput.setValue(query);
|
||||
}
|
||||
|
||||
selectQuery() {
|
||||
this.queryEditorWidget.searchInput.select();
|
||||
}
|
||||
|
||||
toggleWholeWords() {
|
||||
this.queryEditorWidget.searchInput.setWholeWords(!this.queryEditorWidget.searchInput.getWholeWords());
|
||||
this.triggerSearch({ resetCursor: false });
|
||||
|
|
|
@ -148,7 +148,8 @@ export const openNewSearchEditor =
|
|||
if (existing && args.location === 'reuse') {
|
||||
const input = existing.editor as SearchEditorInput;
|
||||
editor = assertIsDefined(await assertIsDefined(editorGroupsService.getGroup(existing.groupId)).openEditor(input)) as SearchEditor;
|
||||
editor.focusSearchInput();
|
||||
if (selected) { editor.setQuery(selected); }
|
||||
else { editor.selectQuery(); }
|
||||
} else {
|
||||
const input = instantiationService.invokeFunction(getOrMakeSearchEditorInput, { config: args, text: '' });
|
||||
editor = await editorService.openEditor(input, { pinned: true }, toSide ? SIDE_GROUP : ACTIVE_GROUP) as SearchEditor;
|
||||
|
@ -161,6 +162,8 @@ export const openNewSearchEditor =
|
|||
) {
|
||||
editor.triggerSearch({ focusResults: args.focusResults !== false });
|
||||
}
|
||||
|
||||
if (args.focusResults === false) { editor.focusSearchInput(); }
|
||||
};
|
||||
|
||||
export const createEditorFromSearchResult =
|
||||
|
|
Loading…
Reference in a new issue