Instead of having imports from the same package on the same line I would like each import to be on a separate line to avoid merge conflicts. When I press Shift Alt O however, it puts all the imports on the same line between brackets. Is there a way to customise this shortcut so that it puts each import on a separate line?
e.g. instead of having
from typing import Dict, List, Tuple, Union
I would like to have
from typing import Dict
from typing import List
etc.
CodePudding user response:
Behind the scenes, Organize Imports for python uses isort
. By looking at
Or you can manually add the entry in settings.json
:
"python.sortImports.args": [
"--multi-line",
"7",
"--sl"
]