VSCode Source Code Study (Part 1): Running Locally

Introduction

Recently, I am going to learn the source code of vscode. The first step is to run it.

The steps I followed are mostly based on the official contribution documentation:

VSCode: How to Contribute

Here are some key steps distilled from there. For accuracy, please refer to the official documentation.

Steps

Since VSCode’s compilation involves using node-gyp, which can be troublesome to install on Windows, my plan is to run it in WSL (Windows Subsystem for Linux).

  1. Environment Setup Ensure you have Git, Node.js, Yarn, Python, and C++ toolchain installed in your WSL:
  2. Install Dependencies Successful yarn installation
  3. Start Electron The first execution might be slow; wait for about 2 minutes, and it should start. Successful execution of code.sh

Errors

Error while executing ./scripts/code.sh

If you encounter errors while running ./scripts/code.sh, it might be due to missing C++ toolchain dependencies. Errors like:

Cannot find module ‘ternary-stream’

Cannot find module ‘vscode-gulp-watch’

gssapi.h error

Installing C++ dependencies should resolve these issues.

gyp error during yarn dependency installation

Another common error involving node-gyp:

You can try clearing dependencies and reinstalling them:

“not a valid Electron app” warning

This is an official warning. Just take note and execute:

References

Leave a Reply