-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support textDocument/formatting
#61
Comments
Not sure what the convention for linter lsps and formatting command but at least something like |
For example if someone setup null-ls with black and ruff-lsp that support formatting then he will need to control which lsp should handle formatting command https://github.com/jose-elias-alvarez/null-ls.nvim/wiki/Formatting-on-save#choosing-a-client-for-formatting |
We actually do support that -- it's used in the VS Code extension. So we support |
I think RuffFixAll command should be added to the nvim-lspconfig see my link how eslint do this in nvim-lspconfig. |
I'm still seeing this issue. Testing in neovim, using the configuration listed here: https://beta.ruff.rs/docs/editor-integrations/#language-server-protocol-official Running
Can confirm this by querying the client capabilities itself (prints local on_attach = function(client, bufnr)
print(client.supports_method("textDocument/formatting"))
end I can see 9f289ec got reverted, so unsure whether this is a config issue, or something that hasn't landed in main yet |
It looks like the only way to have ruff-lsp format a document right now is via a
textDocument/codeAction
. From my experience, most LSP servers allow document formatting viatextDocument/formatting
.It took me a bit to realize, because the example Neovim config registers a keymap for
vim.lsp.buf.format()
, so I was a bit baffled trying to use that to format a file, as ruff-lsp does nothing when that request is issued right now.The text was updated successfully, but these errors were encountered: