Skip to content

Commit

Permalink
feat: just call builtin go to symbol when no cursor word
Browse files Browse the repository at this point in the history
  • Loading branch information
tjx666 committed Jul 10, 2023
1 parent 8f35af6 commit 1567878
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/features/goToSymbolInEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import vscode from 'vscode';
export async function goToSymbolInEditor(editor: TextEditor) {
const cursorPosition = editor.selection.active;
const wordRange = editor.document.getWordRangeAtPosition(cursorPosition);
if (!wordRange) return;
if (!wordRange) {
return vscode.commands.executeCommand('workbench.action.gotoSymbol');
}

const currentWord = editor.document.getText(wordRange);
await vscode.commands.executeCommand('workbench.action.quickOpen', `@ ${currentWord}`);
return vscode.commands.executeCommand('workbench.action.quickOpen', `@${currentWord}`);
}

0 comments on commit 1567878

Please sign in to comment.