fix(lsp): use correct check for formatter override (#1726)

This commit is contained in:
kylo252 2021-10-09 13:38:35 +02:00 committed by GitHub
parent 5fef931d87
commit 195b07a464
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 8 deletions

View file

@ -94,11 +94,10 @@ local function select_default_formater(client)
Log:debug("Checking for formatter overriding for " .. client.name) Log:debug("Checking for formatter overriding for " .. client.name)
local client_filetypes = client.config.filetypes or {} local client_filetypes = client.config.filetypes or {}
for _, filetype in ipairs(client_filetypes) do for _, filetype in ipairs(client_filetypes) do
if not vim.tbl_isempty(lvim.lang[filetype].formatters) then if lvim.lang[filetype] and #vim.tbl_keys(lvim.lang[filetype].formatters) > 0 then
Log:debug("Formatter overriding detected. Disabling formatting capabilities for " .. client.name) Log:debug("Formatter overriding detected. Disabling formatting capabilities for " .. client.name)
client.resolved_capabilities.document_formatting = false client.resolved_capabilities.document_formatting = false
client.resolved_capabilities.document_range_formatting = false client.resolved_capabilities.document_range_formatting = false
return
end end
end end
end end

View file

@ -10,12 +10,6 @@ function M.is_client_active(name)
return false return false
end end
function M.disable_formatting_capability(client)
-- FIXME: figure out a reasonable way to do this
client.resolved_capabilities.document_formatting = false
require("core.log"):debug(string.format("Turning off formatting capability for language server [%s] ", client.name))
end
function M.get_active_client_by_ft(filetype) function M.get_active_client_by_ft(filetype)
local matches = {} local matches = {}
local clients = vim.lsp.get_active_clients() local clients = vim.lsp.get_active_clients()