-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Refactoring: Sort Imports
Don Jayamanne edited this page Oct 3, 2017
·
3 revisions
There are a three options to invoke the sort imports command, they are as follows:
Option 1 (Command Palette)
- Launch the Command Palette via the shortcut (⇧⌘P or Ctrl+Shift+P)
- Select the 'Sort Imports' command
Option 2 (Quick Fix)
- Launch the Quick Fix command from the Command Palette (or use the short cut ⌘. or cmd+.)
- Select the 'Sort Imports' command from the menu
Launching the Quick Fix command from the Command Palette
Launching the Quick Fix command using the keyboard shortcut
- Setup a custom keyboard short cut for the command 'python.sortImports'
- Open a python file
- Invoke the above command using the designated keyboard shortcut
Sorting is performed using the isort package.
The sort behaviour can be configured by using the relevant isort configuration settings (https://github.com/timothycrosley/isort#configuring-isort).