Skip to content
Darren Hickling

Coding Consistently with VS Code

It's fast, lightweight, widely-adopted and ludicrously-customisable. Better yet, you can easily share extensions and settings between VS Code projects.

Published on 3 min readImage: congerdesign on Pixabay (opens in a new tab)

Written 7 years ago, so some details may have moved on.

Authors

VS Code (opens in a new tab) has been nothing short of a revelation. Sublime Text (opens in a new tab) was a brilliant evolution from Notepad++ (opens in a new tab), especially the ability to install extensions from within the IDE itself. Since its introduction, however, VS Code has gone from strength to strength, is available on Windows, Linux and macOS, and continues to release genuinely useful updates every month.

As with all software platforms, however, apps are all importanttttt, and VS Code has rarely failed to provide an extension for the environment in which I code. Better yet, the extensions are often customisable via settings, and both can be shared via code! Take this example .vscode/extensions.json excerpt from my Docker repository (opens in a new tab):

{
    "recommendations": [
        "editorconfig.editorconfig",
        "ms-azuretools.vscode-docker"
    ]
}

If this repository is cloned and opened within VS Code:

# Need Git and VS Code? Install them with Chocolatey on Windows...
choco install git git.install vscode

# ... or Fedora plus Snap.
dnf install git
snap install vscode

# Now clone and open the code!
git clone https://github.com/WhatIsHeDoing/docker-aws-cypress.git
cd docker-aws-cypress
code .

... the user will be greeted with a recommended extensions pop-up. If the extensions are installed — almost always a quick and painless process — they will kick into life without reloading the editor. In the case above, EditorConfig (opens in a new tab) settings will be read from the accompanying .editorconfig file. The following lines:

[*]
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true

... can help prevent annoying problems with line-endings, and promote style consistency, which makes contributing to my project a little simpler. An accompanying .vscode/settings.json file is similarly readable:

{
    "editor.formatOnSave": true,
    "editor.rulers": [130]
}

As with other configuration, changes to these files can be tracked and reviewed via Pull Requests. Pair-programming also becomes a little easier: since we all use a similar base setup, it is likely that — bar a Dvorak (opens in a new tab) keyboard or bizarre mouse (opens in a new tab) — we can pair-code with minimal overhead.

Looking for more great extensions? The usefulness will depend on your language and frameworks, but try this fairly generic list:

You can even install these from the command line, which is useful in a Boxstarter (opens in a new tab) script:

code --install-extension davidanson.vscode-markdownlint

Creating great software solutions is a complex process at the best of times, but having such a great, free IDE that can be used almost anywhere for anything removes one fairly major setup concern.