zyxue
zyxue

Reputation: 8820

How to find which isort is vscode exactly using

https://code.visualstudio.com/docs/python/editing#_sort-imports

I have set

    "[python]": {
        "editor.codeActionsOnSave": {
            "source.organizeImports": true
        }
    },

in vscode, it looks the right python interpreter is chosen, but it doesn't produce sorted imports as expected. I suspect a wrong isort is being used by vscode, how could I find out which isort is vscode exactly using?

Upvotes: 6

Views: 6737

Answers (2)

Brett Cannon
Brett Cannon

Reputation: 15980

VS Code ships with its own copy of isort that it uses which is currently isort 5.10.1. You can look in the Output panel in the Python channel to see how the extension is executing isort.

But do note that the Python extension is moving away from embedded isort support and instead to a dedicated isort extension.

Upvotes: 7

julie
julie

Reputation: 323

To further answer your question.

  1. Open the output console ctrl-shift-u

In the toolbar at the top of the output panel there is a dropdown list of logs/outputs that you can select.

  1. Select Python.
  2. Save a python file. You will see the commands that run, both formatting and runOnSave which are configured in the vscode settings file.

Upvotes: 2

Related Questions