Python organize imports completely missing?

Hi Cursor team,

I am using both vscode and cursor and find that in cursor the organize import feature is somehow not even present. CMD + SHIFT + P “organize”, “imports” does not show up at all and I am unable to set up a working shortcut that would actually organize imports.

What exactly am I doing wrong ?

M

2 Likes

Have same issue

I’ve got import sorting working using the following:

  1. Install Black extension by mikoz
  2. Install ms-python isort
  3. Add the following to your settings.json
  "[python]": {
    "editor.defaultFormatter": "mikoz.black-py",
    "editor.tabSize": 4,
    "editor.codeActionsOnSave": {
      "source.organizeImports": "explicit"
    },
    "editor.formatOnSave": false,
    "editor.formatOnType": true
  },
  "isort.args": ["--profile", "black"]

Note I’ve had to turn off formatOnSave at the moment as that seems to be broken but you can still format using the hotkeys. This causes Black to call isort and format too.

2 Likes

Thank you very much!

Now it works :slight_smile: