User avatar
sayhello
Posts: 88
Joined: Sat Mar 05, 2016 1:02 pm

How add extensions to Visual Studio Code through command line?

Sun Sep 29, 2019 10:23 am

good day dear community,


well it is well described to install and extend vscode on win-boxes.

i run linux and i also want to run vscode:

the question is: some recommeend to use vsc as vscodium - see http://www.vscodium.com


today i am interested in extending VScode: How add extensions to Visual Studio Code through command line? the question is: It is possible to compile Visual Studio Code and install it through terminal as explained

here https://github.com/Microsoft/vscode/wik ... rom-source

and here https://askubuntu.com/questions/616075/ ... tudio-code


i have heard that VSCode is available as DEB-file. You can download it and then run:

Code: Select all

sudo dpkg -i ~/path/to/code_1.XXX.deb
In case dpkg complains about missing dependencies, run:

Code: Select all

sudo apt -f install
afterwards to do some configurations on the installation:


(Optional) Create a symbolic link to conveniently run code from the terminal:

Code: Select all

sudo ln -s /path/to/VSCode/code /usr/local/bin/code

further source (install instructions): https://code.visualstudio.com/docs/setup/linux

Code: Select all

code -h

(A man pages doesn't exist.)

Code: Select all

Extensions Management:
  --extensions-dir <dir>                                         Set the root path for extensions.
  --list-extensions                                              List the installed extensions.
  --show-versions                                                Show versions of installed extensions, when
                                                                 using --list-extension.
  --install-extension (<extension-id> | <extension-vsix-path>)   Installs an extension.
  --uninstall-extension (<extension-id> | <extension-vsix-path>) Uninstalls an extension.
  --enable-proposed-api <extension-id>                           Enables proposed API features for an extension.
Hence all you need is the extension-id or extension-vsix-path and then

code --install-extension (<extension-id> | <extension-vsix-path>)
E.g. the ms-python package can be installed by
code --install-extension ms-python.python

Now I wonder, does anyone know how is it possible to install/add extensions to Visual Studio Code through Terminal?

Heater
Posts: 13683
Joined: Tue Jul 17, 2012 3:02 pm

Re: How add extensions to Visual Studio Code through command line?

Sun Sep 29, 2019 11:35 am

I'm not sure why you are asking that question when you have the output of "code -h" telling you clearly how to do it. Coplete with example:

Code: Select all

$ code --install-extension ms-python.python
Is there something not working about this for you?

Why not just install extensions the normal way, from within VS Code itself?
Memory in C++ is a leaky abstraction .

Return to “General programming discussion”