Notes on Developing VS Code

Written September 2, 2022.

While developing VS Code, I’ve ran into some snippets and links that I often refer to or refer others to. I’ll likely add to this list as new things come up, though this list is personalized to my experiences.

Running with disable-gpu

Many rendering glitches can be mitigated by running VS Code in the terminal with the --disable-gpu flag:

code --disable-gpu [file-or-workspace]

Extension bisect

Extension bisect is a cool feature in VS Code that does a binary search through sets of installed extensions to help the user figure out which extension could be contributing to an issue that they are seeing. I highly recommend using this feature when it appears that an extension is causing buggy behaviour, but it isn’t clear which extension is doing so.

Yarn fails with a node-gyp issue

Yarn at times fails with a node-gyp issue while fetching and building native modules. In this case, deleting some node-gyp directories and running yarn cache clean before running yarn again could help.

OSS freezes after an Electron update

Sometimes after an Electron update, the OSS build (the build that one gets by manually compiling the repository files) freezes moments after being launched. In that case, I do a full clean build by running git clean -xfd && yarn cache clean before running yarn and yarn watch again.

Clean uninstall/Clearing out user data dir files

I once encountered a situation where the GitHub Pull Requests and Issues (GHPRI) extension seemed to be corrupted to the point where even reinstalling it didn’t work. But, I wasn’t able to reproduce the problem with a fresh user data directory (which one can obtain by launching VS Code with --user-data-dir pointing to an empty directory). I didn’t mind reconfiguring my instance from scratch, considering a lot of it was filled with one-off modifications from previous endgames, and deleting the folders indicated in the linked documentation above resolved my issue. I haven’t broke the GHPRI extension in the same way since then, so I don’t have a reproducible bug to file.

Running files from an unsigned archive on macOS

After downloading an unsigned file from the internal builds page, one needs to run the command

xattr -d <path-to-unsigned-file>

on the file, and then manually extract it. Otherwise, directly extracting the file leads to security errors showing up when attempting to launch the program.

Linux archive build fails upon launch

To run the Linux archive build in a VM, one either needs to disable the sandbox by launching the code binary with --no-sandbox, or needs to modify permissions on the chrome-sandbox file:

sudo chown root <path-to-vscode>/chrome-sandbox
sudo chmod 4755 <path-to-vscode>/chrome-sandbox

Source: v1.59 release notes

Smoke test notes

The best notes I have found on manually running VS Code smoke tests are in the repository’s Smoke test README.

GitHub rate-limiting issues, or errors when fetching packages or pushing

There’s been a few times now when I was rate-limited while running GitHub Issue Notebooks, unable to fetch packages (I’d get 401 errors), or unable to push changes. It turns out that every time, either I forgot to log in to GitHub, or my GitHub personal access token (PAT) expired and I needed to create a new one.

I noticed that the GitHub PAT format has changed a few times over the last year, though I’m not sure whether that explains the tokens expiring; it’s more likely that the tokens reached an expiration date that I forgot I set.

Go back to Articles