mirror of
https://github.com/ViViDboarder/vim-settings.git
synced 2024-12-22 18:17:35 +00:00
Fix null-ls formatter conflict
This commit is contained in:
parent
1e0ae56e92
commit
da77afdfb3
@ -15,16 +15,19 @@ local function disable_formatter_filetypes_for_existing_servers(sources, preserv
|
|||||||
return not vim.tbl_contains(preserve or {}, ft)
|
return not vim.tbl_contains(preserve or {}, ft)
|
||||||
end, server_filetypes)
|
end, server_filetypes)
|
||||||
|
|
||||||
-- Map disabled filetypes onto list of sources
|
local NULL_LS_FORMATTING = require("null-ls").methods.FORMATTING
|
||||||
local NULL_LS_FORMATTING = require("null-ls.methods").FORMATTING
|
|
||||||
local formatters = vim.tbl_filter(function(builtin)
|
|
||||||
return builtin.METHOD == NULL_LS_FORMATTING
|
|
||||||
end, sources)
|
|
||||||
|
|
||||||
-- Apply with statement to all filtered formatters to disable filetypes
|
-- Apply with statement to all filtered formatters to disable filetypes
|
||||||
vim.tbl_map(function(builtin)
|
sources = vim.tbl_map(function(builtin)
|
||||||
return builtin.with({ disabled_filetypes = server_filetypes })
|
if
|
||||||
end, formatters)
|
builtin.method == NULL_LS_FORMATTING
|
||||||
|
or (type(builtin.method) == "table" and utils.list_contains(builtin.method, NULL_LS_FORMATTING))
|
||||||
|
then
|
||||||
|
return builtin.with({ disabled_filetypes = server_filetypes })
|
||||||
|
end
|
||||||
|
|
||||||
|
return builtin
|
||||||
|
end, sources)
|
||||||
|
|
||||||
return sources
|
return sources
|
||||||
end
|
end
|
||||||
@ -60,7 +63,7 @@ function M.configure(options)
|
|||||||
null_ls.builtins.diagnostics.hadolint,
|
null_ls.builtins.diagnostics.hadolint,
|
||||||
}
|
}
|
||||||
|
|
||||||
disable_formatter_filetypes_for_existing_servers(sources, { "python" })
|
sources = disable_formatter_filetypes_for_existing_servers(sources, { "python" })
|
||||||
|
|
||||||
-- Add custom or modified sources
|
-- Add custom or modified sources
|
||||||
vim.list_extend(sources, {
|
vim.list_extend(sources, {
|
||||||
|
Loading…
Reference in New Issue
Block a user