feat(downstream): check client capability before formatting

This commit is contained in:
NotAShelf 2023-02-17 00:24:47 +03:00
parent 23af12349a
commit b63d17507e
No known key found for this signature in database
GPG key ID: 5B5C8895F28445F1

View file

@ -204,8 +204,10 @@ in {
buffer = bufnr, buffer = bufnr,
callback = function() callback = function()
if vim.g.formatsave then if vim.g.formatsave then
if client.supports_method("textDocument/formatting") then
local params = require'vim.lsp.util'.make_formatting_params({}) local params = require'vim.lsp.util'.make_formatting_params({})
client.request('textDocument/formatting', params, nil, bufnr) client.request('textDocument/formatting', params, nil, bufnr)
end
end end
end end
}) })