VS Code automatically deletes unused imports and even more annoyingly it deletes imports that are used, but commented out. So for example, if I was to save this code:
from pprint import pprint
# pprint("foo")
It would remove the first line. So how can I turn this feature off, because it constantly forces me to rewrite the imports?
Check your settings.json
(User and Workspace) for the following settings, delete this configuration or change it to false
.
"editor.codeActionsOnSave": {
"source.fixAll": true,
},
Search for "editor.codeActionsOnSave" in settings. click "Edit in settings.json"
"editor.codeActionsOnSave": {
"source.organizeImports": "never"
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With