Understanding python.analysis.fixAll in Pylance
June 23, 2026 ยท View on GitHub
Pylance is a fast, feature-rich language server extension for Python in Visual Studio Code, powered by the Pyright static type checker. It provides type checking, completions, navigation, refactorings, and code actions that help keep Python codebases consistent.
One of those code actions is Pylance Fix All. The python.analysis.fixAll setting controls which Pylance fixes are included when you run that action.
What python.analysis.fixAll does
python.analysis.fixAll is an array of fix commands. When Pylance runs its Fix All code action, it applies only the commands listed in this setting.
The default value is an empty array:
"python.analysis.fixAll": []
That means source.fixAll.pylance does not apply any changes until you explicitly opt in to one or more fix commands.
Accepted values
python.analysis.fixAll currently supports these values:
source.unusedImports- Remove unused imports.
source.convertImportFormat- Convert import format according to the
python.analysis.importFormatsetting.
- Convert import format according to the
source.convertImportStar- Convert wildcard imports such as
from module import *into explicit imports.
- Convert wildcard imports such as
source.addTypeAnnotation- Add type annotations to variables and functions when Pylance can infer them.
How to configure the setting
You can configure python.analysis.fixAll in your workspace or user settings.json.
Example: remove unused imports only
"python.analysis.fixAll": [
"source.unusedImports"
]
Example: combine multiple Pylance fixes
"python.analysis.fixAll": [
"source.unusedImports",
"source.convertImportFormat",
"source.convertImportStar",
"source.addTypeAnnotation"
]
Use a smaller list if you want a more conservative Fix All workflow.
Use with VS Code Fix All
After you configure python.analysis.fixAll, you can use VS Code's Fix All workflow for the current file.
Pylance uses the configured list when VS Code runs Fix All or requests fix-all source actions. In practice, that means the Pylance fixes you opted into are the ones available through the source.fixAll.pylance code action.
For example, if you configure:
"python.analysis.fixAll": [
"source.unusedImports",
"source.convertImportStar"
]
then Pylance Fix All applies only those two fixes.
Use on save in VS Code
You can also run Pylance Fix All automatically through VS Code's save actions.
Add source.fixAll.pylance to editor.codeActionsOnSave in your settings.json:
{
"[python]": {
"editor.codeActionsOnSave": {
"source.fixAll.pylance": "explicit"
}
}
}
This tells VS Code to run the Pylance fix-all source action on save for Python files, using whatever commands you configured in python.analysis.fixAll.
For example:
{
"python.analysis.fixAll": ["source.unusedImports", "source.convertImportFormat"],
"[python]": {
"editor.codeActionsOnSave": {
"source.fixAll.pylance": "explicit"
}
}
}
With that configuration, saving a Python file runs Pylance Fix All and applies only unused-import removal and import-format conversion.
Related settings
python.analysis.importFormat- Used by
source.convertImportFormatto decide whether imports should be written in absolute or relative form.
- Used by
Frequently asked questions
Why does Pylance Fix All do nothing?
If python.analysis.fixAll is left at its default empty array, source.fixAll.pylance has no configured fixes to apply.
Does python.analysis.fixAll affect all fix providers in VS Code?
No. It controls the fixes applied by Pylance's source.fixAll.pylance code action.
Can I enable only one kind of fix?
Yes. Add only the commands you want to the array. For example, if you want Fix All to remove unused imports but nothing else, configure only source.unusedImports.
For more information on Pylance settings and customization, refer to the Pylance Settings and Customization documentation.