Hans Bäuml
Hans Bäuml

Reputation: 229

Appending a command to a already existing keybinding

I would like to append a command in my extension to an already existing keybinding F12 for go to definiton.

If I set it in my package.json file, the standard command is not executed anymore (the key binding is removed).

Is there some way to get my command executed either:

  1. after the editor.action.goToDeclaration has finished (failed at best)
  2. by appending it to the key binding somehow

Or should the normal behavior be that the commands are concattenated, but I did something wrong and now its overridden?

Upvotes: 0

Views: 45

Answers (1)

Hans Bäuml
Hans Bäuml

Reputation: 229

Short answer:

This is not possible (as far as I am informed).

BUT in this special case, this was the wrong approach anyway. Go To Definition is a language feature and, therefore, should be implemented in a language server, as correctly mentioned here:

https://github.com/Microsoft/vscode/issues/16402

Using a keybinding in this case will always cover up the command provided by the underlying language server (e.g. for Typescript).

Here is the article how to implement language features from the vscode documentation:

https://code.visualstudio.com/docs/extensions/language-support#_show-definitions-of-a-symbol

Upvotes: 1

Related Questions