microsoft / vscode-black-formatter

Formatting support for Python using the Black formatter
https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter
MIT License
151 stars 35 forks source link

Black Formatter incompatible with `esbonio` package required by Esbonio extension #189

Closed eddyg closed 1 year ago

eddyg commented 1 year ago

I just starting getting notified:

The Black Formatter server crashed 5 times in the last 3 minutes. The server will not be restarted.

I had recently installed the Esbonio extension, which requires the esbonio package.

The esbonio package seems to depend on (a different version of) pygls, so when it gets installed as a dependency into the project's venv, it conflicts with what Black Formatter expects:

  File "/Users/eddyg/.vscode/extensions/ms-python.black-formatter-2022.7.13271013/bundled/tool/server.py", line 46, in <module>
    LSP_SERVER = server.LanguageServer(max_workers=MAX_WORKERS)
TypeError: LanguageServer.__init__() missing 2 required positional arguments: 'name' and 'version'

This was the cause of the crashing messages I received, so figured I'd mention it.

karthiknadig commented 1 year ago

The underlying packages should be updated here.

karthiknadig commented 1 year ago

@eddyg I just published a pre-release that should work. Please give it a try, v2023.1.*

eddyg commented 1 year ago

Thanks for the quick followup, Karthik! 🚀

I've tested the pre-release version of the Black Formatter extension with the Esbonio extension and no more crashes! 👍