About
This post documents how to install "desktop" extensions with code-server - a popular way to run Visual Studio Code in the browser.
Background
The code-server project can run an instance of Visual Studio Code in the browser. I run code-server on my FreeBSD computers and it provides a development environment for my OpenBSD laptops.
By default the extensions that can be installed with code-server are limited to "web" extensions that are designed to run in a browser environment. It's also possible to use and install "desktop" extensions too but the install path is less obvious and requires a few manual steps that must be performed at the command-line.
Download
Context
The first step involves downloading an extension as a vsix file, which is a zip archive that contains the extension's code and metadata.
The Python-based offvsix
project provides a command-line utility that can download extensions from
the Visual Studio Code marketplace. The following downloads the extension
at the command-line and saves it to the extensions/
directory:
user@localhost$ pip install offvsix
# <snip>
user@localhost$ offvsix golang.go
==================================================
Downloading golang.go
==================================================
Querying Marketplace API...
Downloading version 0.51.1...
**************************************************
Successfully downloaded to: extensions/golang.go-0.51.1.vsix
**************************************************
Explanation
-
pip install offvsix
This command installs theoffvsixutility using Python's package manager: pip. -
offvsix golang.go
This command usesoffvsixto download the Visual Studio Code extension with the identifiergolang.go, which is the Go language extension.
Install
Context
After the extension has been downloaded we are ready to begin the install process with the code-server command-line utility:
user@localhost$ code-server --install-extension extensions/golang.go-0.51.1.vsix
Installing extensions...
Extension 'golang.go-0.51.1.vsix' was successfully installed.
Explanation
code-server --install-extension extensions/golang.go-0.51.1.vsix
This command installs the downloaded extension using thecode-servercommand-line utility. The path to the downloaded vsix file is provided as an argument.
Conclusion
It took me months to realize that code-server could install and use desktop extensions as well as "web" extensions, and once I figured it out I wanted to document the process for others (and my future self). I hope this post might help others who are using code-server to drive their development environments.