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?
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).
Related
I'm building a custom VS Code extension to some stuff. Basically, I'm relying on a few npm packages to get the job done.
But I would to like to do something like vscode-eslint extension does: if user have eslint package installed, it will use the local package instead the bundled one.
Basically I want to do this behavior:
Would this be possible with VSCode?
PS: I tried to study vscode eslint extension, but I was not able to understand how it handles this situation.
At the moment I'm working on a few projects at the same time using VSCode, one in react, another in angular and some good old javascript.
The problem is that I have a few extensions installed that conflict, for example, some code snippets that are the same for React and Angular.
Is it possible to have 3 visual studio code installed on a Mac with different extensions installed?
There are two options for such setup:
Portable installation - unzip VSCode in a folder and create a subfolder there called data. This will trigger the portable mode and all settings will be stored in that data folder. The downside is that you'll have to manually update every portable folder whenever new version comes out. More info here.
Custom config paths - create a shortcut for your VSCode installation, and add those parameters:
--user-data-dir <some-path> --extensions-dir <some-path>
You can put them wherever and have as much shortcuts as you want, they even run in parallel. Best part is once you update the installation, all the configs are upgraded too. More info here.
Both modes are incompatible, so you have to choose one.
I have authored a VSCode extension vscode-typer that auto-magically live types code. Great for development demonstrations.
Problem is, while it works in development mode (I have the extension open in VSCode and I use run extension to bring up a test VSCode), however, if I use vsce to make a VSIX file, and then install said VSIX extension, when attempting to use my extension I see the following error: command 'extension.devFestResetMain' not found
I feel like I am missing a magic incantation somewhere...
Reproduction steps: vscode-typer/issues/1
Turns out I was confusing development time dependencies for run time dependencies.
Just got an update for the Golang extension and it appears to be broken, reporting an error on a package main that's literally just a list of my imports with no useful information (see screenshot below). It's refusing to lint or do anything useful which is annoying.
So I want to quickly jump back to the previous version, how can I do this in VS Code? I can't seem to find it in the docs at all.
NB: I'm using VS Code version 1.10.1 with only the golang package. The code is valid golang.
From v1.30 release notes: install previous versions of extensions.
You can now go back to a previous version of an extension if there are
issues with the current version. VS Code provides an Install Another
Version action on an installed extension which shows a dropdown of
available versions.
The option to install another version is in the context menu. Or the gear icon for each extension. Or the Extension Page in vscode: Uninstall dropdown: Install another version....
For me when I do this - without "Disable Auto Updating Extensions" (I assume that the Debugger for Chrome is such an extension) it does not auto-update on reload or close/open but shows a button for that extension to install the latest version instead.
So it appears you don't have to disable all auto-updating extensions just to revert one extension to an older version and keep it at that older version. [leave a comment if you find that isn't true, thanks]
Update for vscode v1.75:
See pinning extensions (to a specific version):
Make sure you have extension autoupdates enabled and try pinning
extensions to a specific version using following UI. Make sure
extensions are not getting auto updated after pinning.
From CLI : Install a specific version using following format -
code-insiders --install-extension eamodio.gitlens#13.1.1
From Extensions UI - Use *Install Another Version... action in the
context menu of the installed extension.
Make sure the pinned version is synced across VS Code instances - Use
Settings Sync feature to test this. To have different instances of VS
Code on same machine, open VS Code from CLI using different
user-data-dir and extensions-dir. Eg: code-insiders --user-data-dir <path> --extensions-dir <path>
Export and Import the profile with the pinned extension and make sure
in the imported profile, extension is still pinned. Export and Import
profile actions are available in the global activity context menu
(gear).
Si it appears that regardless of the Disable Auto Updating Extensions setting, pinning/reverting to a previous version of an extension should result in that extension not updating.
[EDIT] now it is supported -> see accepted answer
Currently downgrading is not (yet) supported.
However, you can uninstall the extension and then manually download and install a specific version by hand: https://code.visualstudio.com/docs/extensions/install-extension
And also this excellent answer: How to install VSCode extensions offline?
I am not able to download any extension via VS Code on my office system due to the proxy. Is there a way that I can do it manually by downloading and placing the downloaded files at the right place?
Download the extension from VSCode marketplace, it'll be a .vsix file, then do like the image below.
You can also use the command-line to install extensions from VSIX files using the --install-extension parameter.
code --install-extension /path/to/vsix
eg: code --install-extension vscodevim.vim
Just in case u have a same UI as mine. Happy coding!
You can also just drop the extension files into the correct folder. On mac, for example, this is ~/.vscode/extensions/. I'm unsure whether it works for all extensions, but it works just fine for a simple language specification.
Two notes when downloading an extension from VScode marketplace:
Version compatibility
Extensions are updated repeatedly on the marketplace. If you download and transfer it to the target computer, it may not work. One can try to look into version history of the extension and download the older version. But it is not easy to correlate the extension version with VSCode version. You can check the version of the extension on the online computer and try to find a match in the marketplace. But sometimes the older versions are not listed there.
Dependencies
An extension may have dependencies. When installing from within VSCode, VScode installs the dependencies for you. Good example is the Python extension that requires few other extension like Jupyter and pylance.
To handle these two cases easier:
1- Install the same VSCode version on the online (access to internet) computer as the offline (no access to internet) target computer.
2- From within the VSCode, install the desired extension. It will install the right version and all the dependencies.
3- Find the folder where extensions are installed. On windows, it is in: C:\Users\USER_NAME\.vscode\extensions. On Linux, it is ib ~/.vscode/extensions.
4- Copy and transfer the extensions to the target offline computer, in the extensions folder.
5- Restart the VSCode to see the extensions.
The below screenshot shows all the extensions that I transferred to have the python extension available on the target computer: