Technorage

Where I rage about technology and stuff!

Deepu K Sasidharan
Deepu K Sasidharan JHipster co-lead, Java, JS, Cloud Native Advocate, Dev @ XebiaLabs, Author, Speaker, Software craftsman. Loves simple & beautiful code. bit.ly/JHIPSTER-BOOK | 8 mins read

My VS Code setup - Making the most out of VS Code

My VS Code setup - Making the most out of VS Code

Part of "Linux environment for developers" series

Visual Studio Code(I like the sound of VS Code better), I just love it. It is my primary IDE.

I always loved lightweight editors over IDEs. Many years ago I was using Eclipse for development and Notepad++ with some plugins for all other lightweight stuff. Then I discovered sublime text and was using it for a while. I still was finding Eclipse too heavyweight when I was doing web development. Then came Brackets from Adobe. It was a fairly nice editor especially for web development and I started using it heavily for web development. But Brackets was bit slow back then on a large codebase. Then came Atom which revolutionized the NodeJS desktop application landscape by introducing the Atom shell which ultimately became Electron. So I switched to Atom and loved its slick interface and nice pluggable features. It became my primary editor for all web development.

So Electron paved the way for VS Code and though at first, I was skeptical dues to the association with Visual Studio, I tried it out and was amazed by its speed and user experience. There was no turning back now. I slowly started using VS Code for most of my day to day development, except for Java which I was using IntelliJ by now. Fast forward now below are the editor/IDE I use for development.

  • VS Code: JavaScript, TypeScript, EJS, HTML, CSS, Golang, Python, Ruby, Shell, Docker, Kubernetes, Terraform and everything in between including writing this blog post.
  • IntelliJ Idea: Java, Scala, Kotlin (Though I use VS Code for minor edits and to read the code, etc)
  • VIM: For quick edits from the command line.

Plugins

Of course VS Code makes all this possible by allowing the use of plugins and there is a lot to choose from. Here are the plugins that I personally use to work on the above-said languages. You can use the code --install-extension command to install them from the terminal.

Language support

Based on the Languages you work with you can add syntax, utility and language support plugins for those. I use the below

JavaScript/TypeScript/Web

  • EJS language support - Adds EJS template support.

    code --install-extension DigitalBrainstem.javascript-ejs-support

  • Close HTML/XML tag - Auto close HTML/XML tags.

    code --install-extension Compulim.compulim-vscode-closetag

  • ESLint - Adds support for ESLint rules.

    code --install-extension dbaeumer.vscode-eslint

  • TSLint - Adds support for TSLint rules.

    code --install-extension ms-vscode.vscode-typescript-tslint-plugin

  • Prettier - Adds support for Prettier formatter.

    code --install-extension esbenp.prettier-vscode

  • es-beautifier - Formats JS according to Eslint rules.

    code --install-extension dai-shi.vscode-es-beautifier

Go

  • Go - Adds rich language support for Golang.

    code --install-extension ms-vscode.Go

JVM

  • Language Support for Java - Adds Java language support.

    code --install-extension redhat.java

  • Debugger for Java - Adds lightweight Java debugging support.

    code --install-extension vscjava.vscode-java-debug

  • JHipster JDL - Adds syntax support for JHipster JDL files.

    code --install-extension jhipster-ide.jdl

The Java support indeed is getting better and better, so I hope one day I can completely switch to VS Code.

Python

Cloud, Container & others

  • Docker - Adds Docker support(view and manage containers) and support for Docker, docker-compose files.

    code --install-extension ms-azuretools.vscode-docker

  • Jenkinsfile Support - Adds syntax highlighting support for Jenkinsfile’s.

    code --install-extension secanis.jenkinsfile-support

  • Terraform - Adds support for Terraform files.

    code --install-extension mauve.terraform

  • Markdown all in one - Full markdown support with live preview, keyboard shortcuts, etc.

    code --install-extension yzhang.markdown-all-in-one

  • PlantUML - Rich PlantUML support with live preview.

    code --install-extension jebbs.plantuml

  • Visual Studio IntelliCode - Adds AI assisted intellisense support for multiple languages.

    code --install-extension VisualStudioExptTeam.vscodeintellicode

  • YAML - Adds YAML support.

    code --install-extension redhat.vscode-yaml

Theme

Dark++ Italic

My default theme. Similar to VS Code default dark theme but has support for FiraCode and Operator Mono fonts. I personally use FiraCode.

code --install-extension idbartosz.darkpp-italic

Material icon theme

A nice icon theme based on material icons.

code --install-extension PKief.material-icon-theme

Peacock

Subtly changes the workspace color of your workspace. Helpful to identify when you have many windows open.

code --install-extension johnpapa.vscode-peacock

Tools

Auto rename tag

Automatically rename paired HTML/XML tags

code --install-extension formulahendry.auto-rename-tag

Bracket pair colorizer 2

Marks matching bracket pairs with unique colors. This really makes reading code nicer

code --install-extension CoenraadS.bracket-pair-colorizer-2

Change case

Convert between different case. Trust me this is so handy

code --install-extension wmaurer.change-case

Code spell checker

Fairly useful for spell checking within code. Takes cameCase etc into account

code --install-extension streetsidesoftware.code-spell-checker

Easy snippet maker

Useful to store re usable snippets.

code --install-extension tariky.easy-snippet-maker

EditorConfig for VS Code

Add support for EditorConfig.

code --install-extension EditorConfig.EditorConfig

Git History

Enable viewing Git history within VS Code.

code --install-extension donjayamanne.githistory

Gitignore

Makes it easy to work with .gitignore files.

code --install-extension codezombiech.gitignore

Hide gitignored

Hides patterns defined in .gitignore from the editors explorer.

code --install-extension npxms.hide-gitignored

Mark as excluded

Exclude stuff right from the explorer tree.

code --install-extension jcmordan.mark-as-excluded

Toggle Excluded Files

Easily toggle between showing and hiding excluded files/folders.

code --install-extension eamodio.toggle-excluded-files

IntelliJ IDEA Keybindings

I have bad muscle memory so wanted to use the same keyboard shortcuts as IntelliJ. There are mappings available for Sublime, Atom and so on.

code --install-extension k--kato.intellij-idea-keybindings

Sort JSON

Sorts JSON object keys.

code --install-extension richie5um2.vscode-sort-json

Test Explorer UI

Adds an explorer panel for running tests. Supports multiple languages and testing frameworks.

code --install-extension hbenl.vscode-test-explorer

Todo Tree

Aggregate TODO, FIXME, etc in a tree view in explorer.

code --install-extension Gruntfuggly.todo-tree

Terminal setup

If you are using Zsh shell with Oh-my-zsh like me as explained here, you might want to do the below to get the same terminal experience in the integrated VSCode terminal as well.

Follow these steps

  • Download and install a patched font.
  • On Linux, run fc-cache -f -v to refresh font cache.
  • On VSCode, open Preferences → Settings and click on the {} icon to open JSON mode and set the below
    1
    2
    3
    4
    5
    6
    
      "terminal.integrated.shell.linux": "/usr/bin/zsh",
      "terminal.integrated.fontFamily": "'SauceCodePro Nerd Font Mono','Source Code Pro'",
      "terminal.integrated.rightClickCopyPaste": true,
      "terminal.integrated.fontSize": 14,
      "terminal.integrated.cursorStyle": "underline",
      "terminal.integrated.cursorBlinking": true
    

    Replace linux with osx if you are on a Mac.


Conclusion

This might seem like too many plugins but on my configuration VS Code is lightning fast and loads up immediately and is faster then IntelliJ to load and work with. The beauty of VS Code is that you don’t need all the plugin all the time, you can disable the ones not required per workspace to make it even faster.

Many people ask me why I use VS Code when I have IntelliJ and my answer have been always the same. IntelliJ is great but its also quite heavy. While all those advanced features are needed for Java, Scala or Kotlin development, VS Code is perfectly capable of giving a nice developer experience for lightweight languages like JS, TS, Go, Python, Rust, Ruby, etc.

As a regular user of both IntelliJ and VS Code, I prefer VS Code as much as possible. The user experience is much nicer for my taste. In fact, I like the developer experience in VS Code better for JavaScript, TypeScript, Web, Python, and Golang. Also switching between them for JVM projects and others don’t feel weird for me as I have same keyboard mappings for both. The only time I fire up IntelliJ these days are when I want to do full-fledged Java development. For everything else, I use VS Code.


I hope you find this useful. If you have any question or if you think I missed something please add a comment.

If you like this article, please leave a like or a comment.

You can follow me on Twitter and LinkedIn.

comments powered by Disqus