mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-08-30 14:49:43 +02:00
fix(formatters): always select null-ls by default (#1810)
This commit is contained in:
parent
cfdd5e61f9
commit
03e5760e59
5 changed files with 10 additions and 10 deletions
|
@ -19,7 +19,7 @@ end
|
||||||
|
|
||||||
local function make_formatters_info(ft)
|
local function make_formatters_info(ft)
|
||||||
local null_formatters = require "lvim.lsp.null-ls.formatters"
|
local null_formatters = require "lvim.lsp.null-ls.formatters"
|
||||||
local registered_formatters = null_formatters.list_supported_names(ft)
|
local registered_formatters = null_formatters.list_registered_providers(ft)
|
||||||
local supported_formatters = null_formatters.list_available(ft)
|
local supported_formatters = null_formatters.list_available(ft)
|
||||||
local section = {
|
local section = {
|
||||||
"Formatters info",
|
"Formatters info",
|
||||||
|
@ -37,7 +37,7 @@ end
|
||||||
local function make_linters_info(ft)
|
local function make_linters_info(ft)
|
||||||
local null_linters = require "lvim.lsp.null-ls.linters"
|
local null_linters = require "lvim.lsp.null-ls.linters"
|
||||||
local supported_linters = null_linters.list_available(ft)
|
local supported_linters = null_linters.list_available(ft)
|
||||||
local registered_linters = null_linters.list_supported_names(ft)
|
local registered_linters = null_linters.list_registered_providers(ft)
|
||||||
local section = {
|
local section = {
|
||||||
"Linters info",
|
"Linters info",
|
||||||
fmt(
|
fmt(
|
||||||
|
@ -151,6 +151,7 @@ function M.toggle_popup(ft)
|
||||||
vim.cmd('let m=matchadd("LvimInfoIdentifier", " ' .. ft .. '$")')
|
vim.cmd('let m=matchadd("LvimInfoIdentifier", " ' .. ft .. '$")')
|
||||||
vim.cmd 'let m=matchadd("string", "true")'
|
vim.cmd 'let m=matchadd("string", "true")'
|
||||||
vim.cmd 'let m=matchadd("string", "active")'
|
vim.cmd 'let m=matchadd("string", "active")'
|
||||||
|
vim.cmd 'let m=matchadd("boolean", "inactive")'
|
||||||
vim.cmd 'let m=matchadd("string", "")'
|
vim.cmd 'let m=matchadd("string", "")'
|
||||||
vim.cmd 'let m=matchadd("error", "false")'
|
vim.cmd 'let m=matchadd("error", "false")'
|
||||||
-- tbl_set_highlight(registered_providers, "LvimInfoIdentifier")
|
-- tbl_set_highlight(registered_providers, "LvimInfoIdentifier")
|
||||||
|
|
|
@ -104,12 +104,12 @@ return {
|
||||||
|
|
||||||
-- add formatter
|
-- add formatter
|
||||||
local formatters = require "lvim.lsp.null-ls.formatters"
|
local formatters = require "lvim.lsp.null-ls.formatters"
|
||||||
local supported_formatters = formatters.list_supported_names(buf_ft)
|
local supported_formatters = formatters.list_registered_providers(buf_ft)
|
||||||
vim.list_extend(buf_client_names, supported_formatters)
|
vim.list_extend(buf_client_names, supported_formatters)
|
||||||
|
|
||||||
-- add linter
|
-- add linter
|
||||||
local linters = require "lvim.lsp.null-ls.linters"
|
local linters = require "lvim.lsp.null-ls.linters"
|
||||||
local supported_linters = linters.list_supported_names(buf_ft)
|
local supported_linters = linters.list_registered_providers(buf_ft)
|
||||||
vim.list_extend(buf_client_names, supported_linters)
|
vim.list_extend(buf_client_names, supported_linters)
|
||||||
|
|
||||||
return table.concat(buf_client_names, ", ")
|
return table.concat(buf_client_names, ", ")
|
||||||
|
|
|
@ -86,15 +86,14 @@ function M.common_capabilities()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function select_default_formater(client)
|
local function select_default_formater(client)
|
||||||
local client_formatting = client.resolved_capabilities.document_formatting
|
if client.name == "null-ls" or not client.resolved_capabilities.document_formatting then
|
||||||
or client.resolved_capabilities.document_range_formatting
|
|
||||||
if client.name == "null-ls" or not client_formatting then
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
Log:debug("Checking for formatter overriding for " .. client.name)
|
Log:debug("Checking for formatter overriding for " .. client.name)
|
||||||
|
local formatters = require "lvim.lsp.null-ls.formatters"
|
||||||
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 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)
|
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
|
||||||
|
|
|
@ -4,7 +4,7 @@ local null_ls = require "null-ls"
|
||||||
local services = require "lvim.lsp.null-ls.services"
|
local services = require "lvim.lsp.null-ls.services"
|
||||||
local Log = require "lvim.core.log"
|
local Log = require "lvim.core.log"
|
||||||
|
|
||||||
function M.list_supported_names(filetype)
|
function M.list_registered_providers(filetype)
|
||||||
local null_ls_methods = require "null-ls.methods"
|
local null_ls_methods = require "null-ls.methods"
|
||||||
local formatter_method = null_ls_methods.internal["FORMATTING"]
|
local formatter_method = null_ls_methods.internal["FORMATTING"]
|
||||||
local registered_providers = services.list_registered_providers_names(filetype)
|
local registered_providers = services.list_registered_providers_names(filetype)
|
||||||
|
|
|
@ -4,7 +4,7 @@ local null_ls = require "null-ls"
|
||||||
local services = require "lvim.lsp.null-ls.services"
|
local services = require "lvim.lsp.null-ls.services"
|
||||||
local Log = require "lvim.core.log"
|
local Log = require "lvim.core.log"
|
||||||
|
|
||||||
function M.list_supported_names(filetype)
|
function M.list_registered_providers(filetype)
|
||||||
local null_ls_methods = require "null-ls.methods"
|
local null_ls_methods = require "null-ls.methods"
|
||||||
local linter_method = null_ls_methods.internal["DIAGNOSTICS"]
|
local linter_method = null_ls_methods.internal["DIAGNOSTICS"]
|
||||||
local registered_providers = services.list_registered_providers_names(filetype)
|
local registered_providers = services.list_registered_providers_names(filetype)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue