Visual Studio Code (VSCode) is Microsoft’s IDE that works with almost every mainstream programming language, from Python to Rust. It also offers a vast network of plugins for each of those languages. Most plugins and extensions are third-party (often a labor of love from independent developers).
Python, one of the most popular languages on Earth, works wonderfully within VSCode (check out Dice’s Getting Started with Visual Studio Code and Python for more on that), and has a massive library of extensions you can download from within VSCode itself. Here we’ll discuss five options you’ll want to download to help make your Python coding experience better in this context.
Better Comments
This extension is great for developers working with multiple languages, as its list of supported programming languages seems endless. We really like it for Python developers who tend to get into code binges and forget to comment code as they go along.
Better Comments makes it really simple to go back and comment code; the extension supports categorization of comments as well as unique styling. Purple //TODO
comments and red Alerts
make it really simple to identify what requires your attention.
Python Indent
VSCode works with a ton of languages… but doesn’t seem to be proficient in any. This is why extensions are important—and why even the simplest extensions, such as Python Indent, are important.
Every time you press Enter while using VSCode, it places your cursor at the far-left side of the window. This isn’t optimal for Python, which is why Python Indent is critical to your workflow. It indents your code wisely, appreciating the status of your brackets (open indents further, closed resets your indentation), and can help you write empty functions by adding a closing bracket automatically. Python Indent just helps VSCode feel more like a proper Python IDE!
Python Docstring Generator
Docstrings are core to Python development, serving as mini documentation for any module, method, class, or function. Python Docstring Generator makes it really easy to document your code in VSCode and follows all standard formats.
It has support for args, kwargs, decorators, errors, and parameter types; it also defaults to multi-line docstring creation for a complete commenting experience. A feature we really like is its support for tabbed navigation; when you create a docstring, you can tab through it to add arguments.
Python Preview
This extension is really simple but extremely handy. It brings a visual view to VSCode for Python, which makes debugging code far simpler and likely quite a bit faster.
It helps you visualize your code and ensure what you’ve imagined is exactly what’s represented. Although it’s a simple extension, it works with the core Python language; unfortunately, installed libraries are not supported, and it’s limited to the default Python interpreter. Still, we like its simplicity, and think it’s especially handy for those learning to code.
Task Explorer
Whereas Python Preview is meant for simpler codebases and those learning to code, Task Explorer turns your VSCode experience all the way up. This extension allows you to visualize just about every function and action of your codebase without ever leaving VSCode.
It’s a sensational extension for those working with multiple languages, supporting tasks organized into a treeview where you can see parent nodes, grouped nodes, and folders for each project. Popular platforms such as NPM are supported, and the extension supports all of its common commands.
Bonus: Py Pack
This extension is actually 15 extensions packaged for delivery via a single download. It has some of the extensions we’ve discussed here today, as well as many others you might find useful. Check it out once you’re a little more used to working with Python within VSCode!