How to use as black formatter?
reagle opened this issue · comments
Joseph Reagle commented
I currently use plugins LSP-ruff for linting and sublack for formatting. I've read ruff can now format using black conventions; can I use LSP-ruff to replace sublack? If so, how would I format that?
Lucas Alber commented
ruff advertises itself as formatter. That means you can just run the lsp_format_document
command or add bind the command to a key:
{
"keys": [
"<your binding>"
],
"command": "lsp_format_document"
},
LSP does also have the lsp_format_on_save
setting, which would run the command every time you save. You can also enable this behavior only for certain syntaxes by using the "Syntax Specific Settings" for that.
Joseph Reagle commented
Thank you @LDAP.