Hi, may I know how to use Black formatter so that it will auto format on save?
The docs:
I have installed the LSP server, what’s the next step for auto format on save?
Thanks in advance
Hi, may I know how to use Black formatter so that it will auto format on save?
The docs:
A more modern alternative for subblack is python-black. It formats documents on save by default and directly uses black within ST’s plugin_host. It doesn’t need langauge servers or anything else.
To enable format on save for LSP, checkout its "lsp_format_on_save"
setting.
Is it possible to do it without this package?
I’d like to use Black’s suggestion with LSP, now the only thing I’m lack of is maybe something to configure Sublime Text to use Black:
This is quite easy on VSCode because there is a dropdown in the setting to choose the default formatter or can do something like:
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}