Editors, editors ...

2 minute read

Four years have gone by since I last wrote on this blog and my last post was about my experiments to turn Spacemacs into a Scala IDE. In the meanwhile, I have first switched to Sublime Text 3 and, as of last year, to Visual Studio Code. I’m sometimes asked by friends or colleagues why I chose VS Code over X (where, when talking about Scala, X is typically IntelliJ IDEA) and my answer inevitably starts with “Well, I use it in this and this way, so <…>”. Here are a few personal guidelines that drive my editor choice:

  • Responsiveness: working with microservices, I often end up having multiple projects open at the same time, sometimes just to make small changes; because of that, I find it important to be able to open a new project and to immediately be able to start browsing its code.
  • One source of truth: the language’s own build system (think sbt, leiningen, go, …) is the one and only source of truth; this one was born years ago, out of the frustration deriving from chasing inexistent errors reported by the IDE, only to eventually run sbt and find out that there was no error at all.
  • Learn by browsing: browsing a codebase is a great way to learn what it does, what it offers, and the motivations that led to its design (only to name a few); the editor should thus be able to jump to definitions and allow me to browse around.

Given that I keep a terminal window running at all times, to the right of the editor, I don’t strictly need to have an editor that comes with an integrated language server (though it’s of course nice to have, unless it comes at the expense of responsiveness): compilation errors will show up in the terminal and I can quickly jump to the offending line by clicking on them. Given that I have tests continuously running in the terminal, I also don’t need to be able to run them from the editor (same goes for running the application itself). As someone important said: “while there is value in the items on the right, I value the items on the left more”.

So, why VS Code in particular? I first gave it a try when Metals was first released and eventually stayed because:

  • it is very responsive while offering an extensive range of built-in features
  • it has a thriving community and is frequently released with tons of improvements or fixes
  • has lots of plugins, among which a solid vim emulation one (I’m addicted to modal editing)