fix(formatters): always select null-ls by default (#1810)

This commit is contained in:
kylo252 2021-10-20 20:01:51 +02:00 committed by GitHub
parent cfdd5e61f9
commit 03e5760e59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 10 deletions

View file

@ -86,15 +86,14 @@ function M.common_capabilities()
end
local function select_default_formater(client)
local client_formatting = client.resolved_capabilities.document_formatting
or client.resolved_capabilities.document_range_formatting
if client.name == "null-ls" or not client_formatting then
if client.name == "null-ls" or not client.resolved_capabilities.document_formatting then
return
end
Log:debug("Checking for formatter overriding for " .. client.name)
local formatters = require "lvim.lsp.null-ls.formatters"
local client_filetypes = client.config.filetypes or {}
for _, filetype in ipairs(client_filetypes) do
if lvim.lang[filetype] and #vim.tbl_keys(lvim.lang[filetype].formatters) > 0 then
if #vim.tbl_keys(formatters.list_registered_providers(filetype)) > 0 then
Log:debug("Formatter overriding detected. Disabling formatting capabilities for " .. client.name)
client.resolved_capabilities.document_formatting = false
client.resolved_capabilities.document_range_formatting = false