VSCode extension for removing unused imports using autoflake from the GUI.
- Running autoflake for specific file(s) and folder(s).
- Running autoflake for the workspace.
- Running autoflake as a formatter.
- Displaying a prompt for one-click installation if autoflake is not installed.
autoflake>=1.5.2
It may work with lower versions, but some of the options will not work.
If autoflake is not installed, it can be installed with one click by accepting the prompt from this extension. Alternatively, you can install it manually with the following command.
pip install -U autoflake
This extension contributes the following settings: (Most of the available options in autoflake.)
autoflake-extension.expand-star-imports
: expand wildcard star imports with undefined names; this only triggers if there is only one star import in the file; this is skipped if there are any uses of__all__
ordel
in the fileautoflake-extension.remove-all-unused-imports
: remove all unused imports (not just those from the standard library)autoflake-extension.ignore-init-module-imports
: exclude init.py when removing unused importsautoflake-extension.remove-duplicate-keys
: remove all duplicate keys in objectsautoflake-extension.remove-unused-variables
: remove unused variablesautoflake-extension.remove-rhs-for-unused-variables
: remove RHS of statements when removing unused variables (unsafe)autoflake-extension.check
: return error code if changes are neededautoflake-extension.jobs
: number of parallel jobs; match CPU count if value is 0 (default: 0)autoflake-extension.exclude
: exclude file/directory names that match these globsautoflake-extension.imports
: by default, only unused standard library imports are removed; specify a list of additional modules/packagesautoflake-extension.extension.useIntegratedTerminal
: Whether to use integrated terminal instead of hidden terminal. (Not recommended)
If you are setting autoflake-extension.extension.useIntegratedTerminal
to true
and using venv and intentionally somewhat deactivate venv after this extension opened a teminal, it will not work unless you close the terminal.