Setting up the Visual Studio Code Text Editor

Posted in administration programming with tags golang javascript python ruby -


Notes on customizing the Visual Studio Code text editor.

Software Ethics and Visual Studio Code

The Microsoft releases of Visual Studio Code are proprietary software with telemetry enabled by default. If you prefer to avoid proprietary software, consider using the packages that are provided by the vscodium project instead.

Both Visual Studio Code and a number of extensions use telemetry. Always review the documentation for an extension before you install it, and look for notes about telemetry.

Installing Visual Studio Code

Installing Code on macOS

To install Visual Studio Code on macOS with Homebrew, enter this command in a terminal window:

brew cask install visual-studio-code

If you manually install Visual Studio Code, rather than using Homebrew, you will need to add the code executable to your PATH. To do this, start Visual Studio Code, open the command palette, and choose Shell Command: Install ‘code’ command in PATH.

Installing Visual Studio Code to a USB Drive

To run Visual Studio Code directly from a USB device, without installing it on the computer, use portable mode.

The EDITOR Environment Variable

Remember to set the EDITOR environment variable in your shell profile, so that this editor is automatically invoked by command-line tools like your version control system.

To make Visual Studio Code your default editor, use this line:

export EDITOR="code -w"

Setting up Collaborative Editing with Live Share

Use the Live Share service for collaborative editing between copies of Visual Studio and Visual Studio Code.

Disabling Telemetry

Visual Studio Code enables telemetry by default, and connects to remote services for various features. The FAQ explains how Code complies with the GDPR.

To disable telemetry and crash reporting, set these options in Preferences > Settings:

"telemetry.enableTelemetry": false,
"telemetry.enableCrashReporter": false

Microsoft also add telemetry to some of their extensions to Visual Studio Code. This means that you must check the description of each extension to know whether it will send data to Microsoft, even if you have disabled telemetry for Visual Studio Code itself.


Extensions for Writing

Extensions for Software Development

Visual Studio Code includes support for JavaScript, TypeScript and Node.js. To add support for other programming languages, install the extension for the languages that you would like to use.

Run this command to add the Python extension:

code --install-extension ms-python.python

You will need to install some additional tools into the environment to use all of the features of this extension.

Run this command to add the Go extension, which turns Code into a development environment for Go:

code --install-extension ms-vscode.go

The Go extension will automatically download and configure all of the tools that it needs.

Run this command to add the Ruby extension:

code --install-extension rebornix.ruby

You will need to install some additional tools into the environment to use all of the features of this extension.

For UNIX shell scripts, use Shellcheck. Run this command to add the Shellcheck extension:

code --install-extension timonwong.shellcheck

You will need to install Shellcheck into the environment to use all of the features of this extension.

Useful Extensions for Web Development

Useful Extensions for Operations