Ms-python Black Formatter not working?

Hello Cursors!

I’m enjoying trying out cursor with a Python project. I’m loving. it. Thank you very much!

The ms-python Black Formatter extension (the one with 2.2M downloads) seems not to work. Worked fine in regular vs code. Not a big deal, but I just got addicted to the auto-formatting.

I tried with the pre-rel v2024.1.10331006, and the rel v2024.0.0

Anything in particular to change or do? Happy to try something.
Thanks!

ps:
Version: 0.24.4
VSCode Version: 1.85.1
Commit: 1174f14681896d40a3d4e622344bddb40c086230
Date: 2024-01-29T20:09:58.730Z
Electron: 25.9.7
ElectronBuildId: undefined
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Linux x64 6.5.0-15-generic

2 Likes

Hi! I’m having the same problem

1 Like

Same problem here as well… Using latest version:

Version: 0.33.4
VSCode Version: 1.86.2
Commit: 2dd5b2855ac68f3a3d3babee87d22b399a9db7d0
Date: 2024-05-11T02:05:08.197Z
Electron: 27.2.3
ElectronBuildId: undefined
Chromium: 118.0.5993.159
Node.js: 18.17.1
V8: 11.8.172.18-electron.0
OS: Windows_NT x64 10.0.22631

It seems like something detects file changes, as in the Output window log for Black Formatter I can see ‘textDocument/didChange’ when I type, but it seems like it just never sends commands to reformat? I.e. I can change the file to something which should trigger a reformat, save it, and nothing happens except for the didChange events:

2024-05-18 14:14:11.640 [info] Global settings received on server:
{
    "cwd": "/vscode/cursor-server/bin/linux-x64/2dd5b2855ac68f3a3d3babee87d22b399a9db7d0",
    "workspace": "/vscode/cursor-server/bin/linux-x64/2dd5b2855ac68f3a3d3babee87d22b399a9db7d0",
    "args": [
        "--config",
        "src/pyproject.toml"
    ],
    "path": [],
    "interpreter": [],
    "importStrategy": "fromEnvironment",
    "showNotifications": "always"
}

2024-05-18 14:14:11.640 [info] sys.path used to run Server:
   /home/python/.cursor-server/extensions/ms-python.black-formatter-2024.2.0-universal/bundled/tool
   /app/src
   /app/src/wsgi
   /usr/local/lib/python312.zip
   /usr/local/lib/python3.12
   /usr/local/lib/python3.12/lib-dynload
   /app/src/venv/lib/python3.12/site-packages
   /home/python/.cursor-server/extensions/ms-python.black-formatter-2024.2.0-universal/bundled/libs
2024-05-18 14:14:11.643 [info] /app/src/venv/bin/python -m black --version
2024-05-18 14:14:11.643 [info] CWD formatter: /app
2024-05-18 14:14:11.740 [info] Version info for formatter running for /app:
black, 24.4.0 (compiled: yes)
Python (CPython) 3.12.2

2024-05-18 14:14:11.740 [info] SUPPORTED black>=22.3.0
FOUND black==24.4.0

2024-05-18 14:16:32.309 [info] [Trace - 2:16:32 PM] Sending notification 'textDocument/didChange'.
2024-05-18 14:16:33.631 [info] [Trace - 2:16:33 PM] Sending notification 'textDocument/didChange'.
2024-05-18 14:16:36.539 [info] [Trace - 2:16:36 PM] Sending notification 'textDocument/didChange'.
2024-05-18 14:16:43.330 [info] [Trace - 2:16:43 PM] Sending notification 'textDocument/didChange'.

same here. is this issue solved?

Same. Issue is still not solved.
Can we have an update for this? Thanks!

1 Like

Same. The Black Formatter plugin does not work for me in Cursor.

Hey, unfortunately we are unable to support 3rd party extensions ourselves, but if anyone diagnoses the cause of this issue and it’s something we can fix on our end, do let us know!

Hi, when I run in the terminal, it formats correctly! Do you think this is any useful input?

@danperks So you are saying a plugin that works everywhere but in cursor isn’t a cursor problem? I works at the command-line, it works in vscode. It only doesn’t work in cursor.

Having the same problem, this a huge downside to using cursor given how often LLM’s do silly stuff like leaving empty space everywhere!

I know this might not be actually a solution, but could be a workaround anyway; I started using Ruff instead and it’s working fine.

Still seeing issue. Working around it by running VSCode(!) in parallel for now.