VS Code
My preferred editor is VS Code by Microsoft, which recently was voted #1 developer tool in the 2018 Stack Overflow Developers survey. It is fast, stable, feature-rich and has an extensive marketplace of extensions to add to the built-in features.
VS Code version 1.0 was released in March 2016, and since then has grown to be one of the most popular editors around. Its built-in developer tooling such as IntelliSense code completion, debugging, integrated terminal and built-in Git source control give it features closer to a full IDE than a text editor, while still keeping excellent performance.
The source code is open-source and available on GitHub, which has instructions for running a build yourself. The most common way of getting it is to download the latest stable build, or if you want to try the latest builds you can download the Insiders release, which you can install and run alongside the stable release.
Settings
Some notes on settings I use within VS Code:
Programming Ligatures
FiraCode is a monospaced font with programming ligatures for common multi-character combinations such as => or ===
To install:
Open settings.json - from the File menu choose Preferences, Settings or use keyboard shortcut Ctrl+, (Cmd+, on Mac). Then paste the following lines and save the file.
"editor.fontFamily": "Fira Code",
"editor.fontLigatures": true
Emmet with JSX
To get Emmet working with JSX add the following setting:
"emmet.includeLanguages": {
"javascript": "javascriptreact"
},
Autofixing with ESlint on save
Using a code formatter such as Prettier to autoformat your code will reduce the mental fatigue of formatting, and in a team will help keep your source code consistent. Using ESLint you can use auto-fix on save to apply the Prettier rules, with whatever overrides you want in your eslintrc file. In VS Code settings add:
"editor.formatOnSave": true,
"eslint.autoFixOnSave": true,
"eslint.alwaysShowStatus": true,
"[javascript]": {
"editor.formatOnSave": false
},
"[css]": {
"editor.formatOnSave": false
},
Note you do not need to install the Prettier extension for this to work, you will only need the ESLint extension as this does the formatting work.
in eslintrc file add the following to use the prettier base rules:
"extends": [
"prettier"
],
"plugins": [
"prettier",
]
Extensions
The VS Code Marketplace has over 6,000 extension available to install, these are some that I use:
-
Auto Close Tag - Automatically add HTML/XML close tag
-
Auto Rename Tag - Automatically rename paired HTML/XML tag
-
Babel ES6/ES7 - Adds JS Babel es6/es7 syntax colouring
-
Debugger for Chrome - debug your JavaScript code in the Google Chrome browser, or other targets that support the Chrome DevTools Protocol.
-
ECMAScript Quotes Transformer - Transform quotes of ECMAScript string literals.
-
ESLint - Integrates ESLint into VS Code
-
GitLens — Git supercharged - Supercharge the Git capabilities built into Visual Studio Code
-
Import Cost - Display import/require package size in the editor
-
JavaScript console utils - Help insert and remove
console.(*)
statements -
Live Server - Launch a development local Server with live reload feature for static & dynamic pages
-
markdownlint - Markdown linting and style checking for Visual Studio Code
-
npm Intellisense - Visual Studio Code plugin that autocompletes npm modules in import statements
-
React Pure To Class - Convert pure react components to class components
-
SCSS IntelliSense - Advanced autocompletion and refactoring support for SCSS
-
Settings Sync - Synchronize Settings, Snippets, Themes, File Icons, Launch, Keybindings, Workspaces and Extensions Across Multiple Machines Using GitHub Gist.
-
Simple React Snippets - Dead simple React snippets you will actually use
-
stylelint - Modern CSS/SCSS/Less linter