Visual Studio Code (VSCode) is a cross-platform text and source code editor from Microsoft. It’s one of the most exciting open source projects today, with regular updates from hundreds of contributors.
If you don’t already have Xcode installed on your machine, open the Terminal app and run the following command:
xcode-select --install
You can verify that everything is working as expected by running the sourcekit-lsp command:
xcrun sourcekit-lsp
Exit the process with an ETX signal (^C).
Download Visual Studio Code and install it to your system Applications folder. Open the app and follow the instructions for launching from the command line. You’ll need to have the code command accessible from $PATH in order to install the SourceKit-LSP extension later on.
brew install node
node --version
npm --version
From the command line, clone the sourcekit-lsp repository and use npm to build the extension and then use the code command to install it:
git clone https://github.com/apple/sourcekit-lsp.git
cd sourcekit-lsp/Editors/vscode
npm install
npm run dev-package
code --install-extension sourcekit-lsp-development.vsix
If you get an error stating Couldn't start client SourceKit Language Server, you may also need to specify the sourcekit-lsp executable path, which you can find using xcrun:
xcrun --find sourcekit-lsp
# for example output:
/Library/Developer/CommandLineTools/usr/bin/sourcekit-lsp
Copy the printed value and enter it into the setting for Server Path under Preferences > Settings, Extensions > SourceKit-LSP, and then Reload Window.