Skip to content

Commit

Permalink
goMain.ts add commands to Go: Show All Commands
Browse files Browse the repository at this point in the history
commands added :
 * Go to definition
 * Go to implementation
 * Go to symbol in file
 * Go to symbol in workspace

fixes microsoft#1822
  • Loading branch information
vimalk78 committed Oct 1, 2018
1 parent eff0139 commit 8432e34
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/goMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,29 @@ export function activate(ctx: vscode.ExtensionContext): void {
}));

ctx.subscriptions.push(vscode.commands.registerCommand('go.show.commands', () => {
vscode.window.showQuickPick(getExtensionCommands().map(x => x.title)).then(cmd => {
let selectedCmd = getExtensionCommands().find(x => x.title === cmd);
let extCommands = getExtensionCommands();
extCommands.push({
command : 'editor.action.goToDeclaration',
title : 'Go to Definition',
description : 'invokes the GoDefinitionProvider'
});
extCommands.push({
command : 'editor.action.goToImplementation',
title : 'Go to Implementation',
description : 'invokes the GoImplementationProvider'
});
extCommands.push({
command : 'workbench.action.gotoSymbol',
title : 'Go to Symbol in Document',
description : 'invokes the GoDocumentSymbolProvider'
});
extCommands.push({
command : 'workbench.action.showAllSymbols',
title : 'Go to Symbol in Workspace',
description : 'invokes the GoWorkspaceSymbolProvider'
});
vscode.window.showQuickPick(extCommands.map(x => x.title)).then(cmd => {
let selectedCmd = extCommands.find(x => x.title === cmd);
if (selectedCmd) {
vscode.commands.executeCommand(selectedCmd.command);
}
Expand Down

0 comments on commit 8432e34

Please sign in to comment.