Skip to content

Commit 4844109

Browse files
Don't focus search editor (#2091)
Partially addresses #1722 The problem is that when you focus the search editor focus is brought back to the import/query box. For now just don't focus the editor actually makes it so if the search editor is already in focus you can now use Cursorless in it. The simplest way to get to the search editor is probably use `search.action.focusNextSearchResult`. Unfortunately there is no command to focus the results generally. Focusing the next result we of course don't want to issue every time we do a Cursorless command. ## Checklist - [-] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [-] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [-] I have not broken the cheatsheet
1 parent 197bb16 commit 4844109

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/cursorless-vscode/src/ide/vscode/VscodeFocusEditor.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ export default async function vscodeFocusEditor(
3232
ide: VscodeIDE,
3333
editor: VscodeTextEditorImpl,
3434
) {
35+
// Focusing the search editor brings focus back to the input field.
36+
// FIXME: This is a hack. There is no way to focus the search editor. If we
37+
// could figure out if the editor was not focused, we could issue
38+
// `search.action.focusNextSearchResult`.
39+
// Issue: https://github.com/cursorless-dev/cursorless/issues/1722
40+
if (editor.document.uri.scheme === "search-editor") {
41+
return;
42+
}
43+
3544
const viewColumn = getViewColumn(editor.vscodeEditor);
3645
if (viewColumn != null) {
3746
await commands.executeCommand(columnFocusCommands[viewColumn]);

0 commit comments

Comments
 (0)