Home > Software engineering >  How to turn off VS Code's Python auto-fix feature in Pylance?
How to turn off VS Code's Python auto-fix feature in Pylance?

Time:10-07

I need to make some targeted edits in a Python source tree. VSCode's Pylance extension is "helping" me by removing unused imports in a file, every time I save the file.

How can I turn this feature off, aside from disabling the Pylance extension entirely?

CodePudding user response:

Add the following configuration in settings.json to turn off automatic deletion of unused imports

    "editor.codeActionsOnSave": {
        "source.fixAll": false,
    },

There are two settings.json files. The Workspace settings.json file will overwrite the same configurations in User settings.json

enter image description here

  • Related