In general, Syntax Highlighter extension is built the same way as any other extension. But dependence on native Node.js modules slightly complicates the process. First, you'll require C/C++ compiler and Python v2. Second, you need to compile against version of Node.js/Electron used by VS Code.
Native addons are compiled by node-gyp. Complete list of required tools to install and corresponding instructions can be found here. Instructions on how to compile native modules for particular Electron version can be found on this page. You will also need to determine version of Electron that VS Code is built with.
- Download and install Node.js.
- Install all node-gyp requirements.
- Open VS Code.
- Execute
Ctrl + Shift + P -> Developer: Toggle Developer Tools
. - Go to
Console
tab and enterprocess.versions.electron
. - Remember the obtained version, e.g. "3.1.8".
- Clone or download extension from GitHub.
- Open extension project folder in VSCode.
- Open terminal
Ctrl + '
. - Type
npm install --target=3.1.8 --runtime=electron --disturl=https://atom.io/download/electron
to download, install or compile all dependencies. Provide your Electron version in--target
. - Now you can debug Syntax Highlighter extension as usual by
F5
. - To package extension into .vsix, type
node ./node_modules/vsce/out/vsce package
in terminal.