DEV Community

loading...
Cover image for My Top 10 Visual Studio Code Extensions for Python in 2020

My Top 10 Visual Studio Code Extensions for Python in 2020

ritulsingh profile image Ritul Singh ・3 min read

1.Python extension for Visual Studio Code

by Microsoft
Python
First and foremost - the Python plugin for VS Code. Out of the box, there is no support for Python in the VS Code, but when you open a Python file, VS Code will immediately suggest this plugin. It adds all the necessary features like:

  • Syntax highlighting for Python files
  • Intellisense (code-completion suggestions)
  • Ability to start a debugger

2. Bracket Pair Colorizer

by CoenraadS
Bracket Pair Colorizer
This extension allows matching brackets to be identified with colors. The user can define which tokens to match, and which colors to use.

3. Better Comments

by Aaron Bond
Better Comments
The Better Comments extension will help you create more human-friendly comments in your code.
With this extension, you will be able to categorize your annotations into, Alerts, Queries, TODOs.

4. Error Lens

by Alexander
Error Lens
Sometimes the error marks in VS Code are hard to spot (especially the “info” hints). If you don’t wrap lines, it’s even worse - the error can be in the part of the code not visible on the screen.
That’s why I’m using Error Lens. It lets me modify how the errors should be displayed. It can display the error message next to the line where it occurs and a Sublime-like error icon in the gutter (next to the line number)

5. Git Graph

by Mhutchie
Git Graph
If your working with code I assume you use a repository to safely store it. Git graph adds another dimension to the way you use the VS Code. It adds a nice user interface of your Git history and adds the ability to create/checkout new branches with the click of a button.

6. GitLens Git supercharged

by Eric Amodio
GitLens
This extension has at the time of writing already has more than 5 million downloads! This extension is not only a game-changer it makes sure you use Git in other ways you normally wouldn’t have used it within your CLI.

7. Python Preview

by Dongli
Python
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.

8. Bookmarks

by Alessandro Fragnani
Bookmarks
This extension lets you bookmark locations in your code, easily list all your bookmarks in a sidebar, and move between them with keyboard shortcuts.

9. TODO Highlight

by Wayou Liu
TODO Highlight
Highlights all TODO/FIXME/NOTE in the code, so you can easily spot them. You can easily customize it by adding new words and changing the highlight style.

10. Python Indent

by Kevin Rose
Python Indent
Every time you press the Enter key in a python context, this extension will parse your python file up to the location of your cursor, and determine exactly how much the next line (or two in the case of hanging indents) should be indented and how much nearby lines should be un-indented.

Conclusion

These are my top extensions for python that I am using in 2020, there are of-course more extensions that I am using (Django-snippets, Flask-snippets) but I wanted to focus on the extensions that I am using for python only. If you have an extension that is not included in this list, please share it in the comments. Happy Coding!

Discussion (10)

pic
Editor guide
Collapse
michaelcurrin profile image
Michael

For interest, Pylance is a newer alternate to the MS Python one. Pylance is meant to be smarter but doesn't support everything the same like it broke trying to parse a module import which worked fine on the old extension so I ditched Pylance

Collapse
sshine profile image
Simon Shine

I came to this blog post exactly because I experienced problems with Pylance and virtualenv. My project lives in a sandbox, and it seems that Pylance can't see that from the environment variables available when VSCode was launched.

Collapse
michaelcurrin profile image
Michael

You may get some use of my .env file and settings.json file here.

github.com/MichaelCurrin/py-projec...

They were setup for MS Python to use a virtual env. The .env also includes a reference to a main package so that imports within the project work

Pylance might use another approach which hopefully is covered in its docs

Thread Thread
sshine profile image
Simon Shine

Thanks. I'll keep that in mind if I need to scale something using Python. :)

If I use the other Python extension for VSCode, it detects dependencies nicely. I only tried Pylance because a VSCode pop-up recommended it as a better alternative, which it turned out not to be on all accounts.

Thread Thread
michaelcurrin profile image
Michael

There's things I miss in VS Code that you get in PyCharm. Like builtin intellisense, debugging and refactoring support. No extensions needed.

And it can run Linting with its own linter. VS Code makes you install a linter inside your virtual env otherwise the lint options in the editor don't work.

VS Code does support templating better like for mixing HTML and JS and Liquid a single Flask jinja file. And VS Code has better support for JS files

Thread Thread
sshine profile image
Simon Shine

I simply prefer not to have to change my editor every time I change programming language. The moment PyCharm gets good LSP support for Scala and Haskell, I’ll consider it. ;)

Collapse
michaelcurrin profile image
Michael

Thanks for sharing.

On the Python Preview one, how does that compare with the builtin debug plus the Microsoft Python extension? The debugger let's you step through code and see values inline in your code and show all variables at various scopes in the debug pane. It works well for JavaScript.

So far the extension looks to have the same info but in a different layout.

Collapse
ritulsingh profile image
Ritul Singh Author

Thanks for your comment...😘😘

Collapse
michaelcurrin profile image
Michael

I like using the TODO one.

I have Bookmarks installed but I always forget to use it and I get by without it. What is your approach to using it and does it save you time?

Collapse
ritulsingh profile image
Ritul Singh Author

It helps me to navigate in my code, moving between important positions easily and quickly. No more need to search for code.