VSCode python extension: How can I disable autocompletion from inserting import statements?

Viewed 3034

In VS Code's Python extension I sometimes find that autocompletion can include options for things that are not yet imported in the file I'm editing. When selecting one of those options imports sometimes get inserted at the top of the module without notification. While I can see the utility in this feature I don't really like the behavior since it does this silently and puts them in alphabetical order disregarding any other sorting I may choose. Is there a way to disable this feature?

2 Answers

There currently isn't a way. You have a couple of options on how to deal with it:

  1. Make a feature request at https://github.com/microsoft/python-language-server
  2. Switch to Jedi as your intellisense engine
  3. Set up isort to sort your imports the way you want automatically
Related