microsoft / vscode-isort

Import sorting for python using the isort library.
https://marketplace.visualstudio.com/items?itemName=ms-python.isort
MIT License
87 stars 21 forks source link

How to only execute isort without executing any other organizeImports provider? #112

Closed Spenhouet closed 2 years ago

Spenhouet commented 2 years ago

When I enable organizeImports, the code starts dancing on every save.

82044600-ebee6800-96ad-11ea-8da6-9e019d567c18

That is the line of code:

from transform_data import (preprocess_continous_image, transform_image_parallelized,
                            weighted_majority_resampling)

My config:

"[python]": {
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
      "source.organizeImports": true
    }
  },
  "python.formatting.provider": "yapf",
  "python.formatting.yapfArgs": [
    "--style",
    "{based_on_style: google, column_limit: 100}"
  ],

In 15. May 2020 I already reported this here: https://github.com/microsoft/vscode/issues/83586#issuecomment-629178158

One conclusion seems to be that one currently cannot choose what organizeImports provider one actually wants to run and there is more than just isort running (https://github.com/microsoft/vscode/issues/90221).

Since this was ignored previously, how can I just run isort without running anything else to avoid the above issue?

karthiknadig commented 2 years ago

Try adding "isort.args": ["--profile", "google"] setting.

Spenhouet commented 2 years ago

Also just noticed that this makes it stable in this case. Will need to see if this works in all cases. Will reopen an issue should I have a new reporduction.