7

I am developing an extension for VS Code. This extension is already good enough for me to use during daily work, but not good enough to be published (yet). Is there a canonical way to make an unpublished extension under development available to VS Code? Optimally, I would like to always have the current state of the code running.

I did find a way that seems to work, but I'm not sure whether this is a terrible hack or okay: Create a symbolic link in VS Code's extensions directory (~/.vscode/extensions on Linux) to the development directory. Is there a better/official way?

3
  • 2
    Please study vsce package and code --install-extension code.visualstudio.com/docs/editor/…. Commented Jan 5, 2022 at 6:42
  • your symlink is usable to have the latest dev version after a restart Commented Jan 5, 2022 at 9:22
  • if you want to symlink to a dev build/source, see stackoverflow.com/q/77376281/11107541 Commented Mar 30, 2024 at 9:00

2 Answers 2

7

You can package your extension (even if it's in development) using vsce with the command vsce package. This will create a .vsix file which you can install in your regular instance of VSCode in the marketplace menu (click on the ... icon at the top and select "Install from .vsix file).

If you need to view the logs of the extension, go to Help>Toggle Developer tools and use the console to view your extension's output (if there is any).

Sign up to request clarification or add additional context in comments.

1 Comment

It's worth to add that when one is debugging the new extension, while it is also installed, the installed version should be disabled during debugging with the option --disable-extension ID in the extension host launch configuration.
1

VS Code can run the extension directly once it's detected. Just open extension.js and run the debugger. See the second step here: https://code.visualstudio.com/api/get-started/your-first-extension

Then, inside the editor, press F5. This will compile and run the extension in a new Extension Development Host window.

You do not need to package it nor run any command line scripts.

2 Comments

This opens a new window which has the extension installed. It's perfect for isolated testing, but not great for using your not-yet-published extension in real life.
The question mentions "during development." You do not want to manually package and load the extension every time you make a change. This workflow is continuous and allows for quick reloads. "During testing" however yes, it's best to package it up and use it in your regular profile.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.