Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 215
Mike DePalatis Avatar asked Jan 26 '26 16:01

Mike DePalatis


1 Answers

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

like image 189
jtunhag Avatar answered Jan 29 '26 07:01

jtunhag



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!