How to add a shortcut to my VsCode extension?

I created an extension with VsCode but I want to start my extension without typing the command in the command bar (CTRL + SHIFT + P). I dont know how to achieve this.

Something like this:

enter image description here

If we click on Ponicode: Unit Test, it starts the command directly.

>Solution :

The feature you are searching about is CodeLens.

Documentation

https://code.visualstudio.com/api/language-extensions/programmatic-language-features#codelens-show-actionable-context-information-within-source-code

Sample

https://github.com/microsoft/vscode-extension-samples/tree/main/codelens-sample

Extensions using CodeLens

https://code.visualstudio.com/blogs/2017/02/12/code-lens-roundup

Leave a Reply