I've been using Visual Studio Code daily now (for Python development) for about six months — long enough to give it a thorough review. Before, I was using Sublime Text with a few plugins, which worked very well— but, I am continually shocked at just how good VS Code is, in comparison, and I'd like to share with you my observations / opinions.
Note: this post is written for those that use text–editors (e.g. Sublime Text), not IDEs (e.g. PyCharm) daily.
Reasons to Use VS Code for Python Development:
Auto–Complete that Just Works™
VS Code features incredibly fast, accurate, and virtualenv–aware code completion for Python code. If you install a module into your virtualenv from the command–line, the auto–completion for that module is instantly available.
Best of all, it doesn't slow you down when you're typing, like it does in Sublime Text. It's fast, feels native, and is supremely great. Highly recommended productivity tool.
Format on Save
I have VS Code configured to automatically run black on any Python file I'm writing, when I save the file. I don't have to manually re–format my code when I'm refactoring — black does it for me. Best of all, this functionality is built–in to VS Code, no plugin needed.
I can easily disable this with either a keyboard shortcut or just clicking the "Formatting" toggle button at the bottom of the window.
PyTest–Aware Test Discoverer
This feature is great — it allows you to run any single arbitrary test, with a single click!
The VS Code Python team has put forth lots of effort (and worked with our team, quite closely) to support Pipenv projects out–of–the–box. That means not only are your Pipenv virtualenvs automatically discovered and activated, but
Pipfile.lock are formatted correctly (as JSON & TOML, respectively).
Reasons to Use VS Code In General:
In addition to the fantastic support for Python, there are many generally good reasons to use VS Code as your daily editor:
Community buy–in / energy
The plugin/theme community has generally shifted it's focus from developing themes for Sublime Text and Atom, and all of that energy is going into the VS Code ecosystem.
Great built–in terminal emulator
This is something I always wanted in Sublime Text, but was never able to have. The Terminal Emulator built–in to VS Code is first–class (it uses the same engine as Hyper Terminal, under the covers), and I haven't had any problems with it whatsoever.
I have mine mapped to ⌘2 (Hyper is ⌘1).
Fantastic Git/VCS integration
Gutter markers, commit in the browser, push/pull, the works.
No new shortcuts!
If you have another editor installed (e.g. Sublime Text), VS Code will ask you if you'd like it to adopt that editor's keyboard shortcuts.
Conclusion & Final Thoughts
VS Code's priority list is multi–faceted, but can be represented thusly:
- Be an extremely powerful, stable (yet continually–updated), and configurable engine, upon which a developer can configure (with some help from the community) their ultimate dev environment.
- Have extremely sane reasonable defaults, so everything "just works" out of the box, no configuration needed.
Sublime Text now feels old and hacky to me in comparison. Not something I'd use for serious production work — that's what VS Code is for.
Thanks for reading!