mirror of
https://github.com/LunarVim/LunarVim.git
synced 2024-09-21 02:55:09 +02:00
fix(lsp): use correct check for formatter override (#1726)
This commit is contained in:
parent
5fef931d87
commit
195b07a464
2 changed files with 1 additions and 8 deletions
|
@ -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
|
||||||
|
|
|
@ -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()
|
||||||
|
|
Loading…
Reference in a new issue