In addition to "source.organizeImports": "explicit"
and "isort.args":["--profile", "black"]
, using "isort.importStrategy": "fromEnvironment"
will allow isort
to use the current env to properly sort imports in files from the local / dev package being used.
From: https://marketplace.visualstudio.com/items?itemName=ms-python.isort#settings.
Full example:
{
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
},
},
"isort.args":["--profile", "black"],
"isort.importStrategy": "fromEnvironment"
}