Howdy, fellow readers! In this article I’ll be talking about my experiences of compiling a copy of Code-OSS (the open-source version of Microsoft’s Visual Studio Code) from source. Feel free to read on if you’re interested!
Preparations
First of all, obviously, I had to get the source somehow, so I cloned the official VS Code GitHub repo:
$ git clone https://github.com/microsoft/vscode.git
$ cd vscode
You won’t get Marketplace functionality (i.e. being able to install extensions directly from the app) without additional modifications, due to Microsoft’s terms of service permitting the Marketplace to be used only on their own pre-compiled product.
Enabling the extension gallery
Since, as I just said, the extensions gallery/Marketplace isn’t implemented in the open-source version of Code, I had to add a few lines to product.json
before starting to build the app:
"extensionsGallery": {
"serviceUrl": "https://open-vsx.org/vscode/gallery",
"itemUrl": "https://open-vsx.org/vscode/item"
},
"linkProtectionTrustedDomains": ["https://open-vsx.org"]
Doing the real thing
First, I installed Node.js and Yarn via the Homebrew package manager, since I’m on a Mac:
$ brew install node@16 yarn
I then ran yarn
in the vscode
folder, which installs and builds all the dependencies:
$ yarn
$ yarn watch
When Yarn finished doing its thing, I ran the compiled copy of Code:
$ ./scripts/code.sh
Luckily, it worked without any issues. I wouldn’t want to keep doing that everytime I wanted to launch the app, though! This is where gulp
comes in handy.
Packaging the app for standalone use
Since it would be a mess to carry all those files around to the Applications folder, let’s package the app to reduce the clutter!
Microsoft’s instructions tell you exactly what you need to do. TL;DR:
$ yarn gulp vscode-[platform]
…replacing [platform]
with one of the following:
win32-[ia32|x64]
(Windows 32-bit / 64-bit)darwin-[x64|arm64]
(macOS x64 / M1)linux-[ia32|x64|arm]
(Linux 32-bit/64-bit/ARM)
Square brackets mean that you can only choose one of the options delimited by the vertical bar.
The packaging procedure may take some time to finish. For me, once it was finished, the app was put in a subfolder in my Downloads folder, from where I could move it into my Applications folder.
Here’s a screenshot of the compiled app’s about box, just for the sake of having one:
I hope you enjoyed today’s post. Let me know what you thought of it in the comment section below.
Stay tuned for next week’s post! Feel free to give me suggestions and ideas on what you’d like to see. Thank you!
Leave a Reply