Installing extensions from command line
See original GitHub issueIt would be great to be able to script the installation of extensions, e.g. after starting code-server in a new container.
A feature similar to VScode’s code --install-extension would be very helpful.
See the example here.
Or am I missing another way to install extensions to code-server from the command line?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:16
- Comments:19 (5 by maintainers)
Top Results From Across the Web
Managing Extensions in Visual Studio Code
You can browse and install extensions from within VS Code. Bring up the Extensions view by clicking on the Extensions icon in the...
Read more >cmd - How to install Visual Studio Code extensions from ...
To make it easier to automate and configure VS Code, it is possible to list, install, and uninstall extensions from the command line....
Read more >How to install and manage Azure CLI extensions
Install extensions manually ... Once you have found an extension to install, use az extension add to get it. If the extension is...
Read more >Install extension - vscode-docs
You can manually install an VS Code extension packaged in a .vsix file. Simply install using the VS Code command line providing the...
Read more >How to Install Visual Studio Code Extensions
Find an extension and install it from the editor (GUI method) · Alternate method: Install extensions using the terminal.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@ThorbenJensen I think you can do this by just extending the Dockerfile as @jeasonstudio suggests.
For example, the following installs the Preview extension. I needed it because I couldn’t get the built-in Preview functions to work out-of-the-box and also it comes with Mermaid diagram support, which the built-in previewer does not.
The lines above do the following.
bsdtarandcurl. We installbsdtarbecausegnutar, which ships with Ubuntu and Debian, doesn’t function properly with the archives we get from the Visual Studio web site.extensionssubdirectory for thecode-serverdata directory. The data directory path above (/root/.local/share/code-server/) is the default from what I can tell. You can look at the logs to verify that it’s the same with your configuration. You’ll see something likeINFO Initializing {"data-dir":"/root/.local/share/code-server","working-dir": ...,"log-dir": ...}when starting the container.https://marketplace.visualstudio.com/_apis/public/gallery/publishers/<PUBLISHER>/vsextensions/<EXTENSION-NAME>/<VERSION>/vspackage. We only extract theextensionfolder.<PUBLISHER>.<EXTENSION-NAME>-<VERSION>in theextensionssubdirectory.If all goes well, you should be able to get the following.
Hope this helps!
@jagraj The recommended way to install extensions now is to use
code-server --install-extension <value>. You can give it the path to a.vsixfile or the ID (looks likeorganization.extension-name).