Reputation: 711
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?
Upvotes: 15
Views: 5034
Reputation: 185
Using Pylance (as of v2020.8.0), you can disable this by setting
"python.analysis.autoImportCompletions": false
https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#202080-5-august-2020
Upvotes: 17
Reputation: 15990
There currently isn't a way. You have a couple of options on how to deal with it:
Upvotes: 1