cssls: exclude @tailwind
and @apply
at rule
...diagnostic errors
This commit is contained in:
parent
c0d156f728
commit
70c8eade7c
|
@ -1,5 +1,15 @@
|
|||
local M = {}
|
||||
|
||||
local function should_remove_diagnostic(messages_to_filter, message)
|
||||
for _, filter_message in ipairs(messages_to_filter) do
|
||||
if message:match(filter_message) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
M.definition = function()
|
||||
local params = vim.lsp.util.make_position_params()
|
||||
|
||||
|
@ -32,4 +42,27 @@ M.definition = function()
|
|||
end)
|
||||
end
|
||||
|
||||
M.on_publish_diagnostics = function(_, result, ctx, config)
|
||||
local client = vim.lsp.get_client_by_id(ctx.client_id)
|
||||
|
||||
if client.name == "cssls" then
|
||||
local filtered_diagnostics = {}
|
||||
|
||||
local messages_to_filter = {
|
||||
"Unknown at rule @apply",
|
||||
"Unknown at rule @tailwind",
|
||||
}
|
||||
|
||||
for _, diagnostic in ipairs(result.diagnostics) do
|
||||
if not should_remove_diagnostic(messages_to_filter, diagnostic.message) then
|
||||
table.insert(filtered_diagnostics, diagnostic)
|
||||
end
|
||||
end
|
||||
|
||||
result.diagnostics = filtered_diagnostics
|
||||
end
|
||||
|
||||
vim.lsp.diagnostic.on_publish_diagnostics(_, result, ctx, config)
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -1,16 +1,26 @@
|
|||
local lspconfig = require "lspconfig"
|
||||
local nvim_status = require "lsp-status"
|
||||
|
||||
local handlers = require "opdavies.lsp.handlers"
|
||||
|
||||
require("neodev").setup {}
|
||||
|
||||
local servers = {
|
||||
bashls = true,
|
||||
cssls = true,
|
||||
|
||||
cssls = {
|
||||
on_attach = function(client, bufnr)
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(handlers.on_publish_diagnostics, {})
|
||||
end,
|
||||
},
|
||||
|
||||
gopls = true,
|
||||
html = true,
|
||||
|
||||
intelephense = {
|
||||
filetypes = { "php", "module", "test", "inc" },
|
||||
},
|
||||
|
||||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
|
@ -36,8 +46,10 @@ local servers = {
|
|||
},
|
||||
},
|
||||
},
|
||||
|
||||
marksman = true,
|
||||
nil_ls = true,
|
||||
|
||||
tailwindcss = {
|
||||
filetypes = { "html", "javascript", "twig", "typescript", "vue" },
|
||||
|
||||
|
@ -49,9 +61,11 @@ local servers = {
|
|||
},
|
||||
},
|
||||
},
|
||||
|
||||
terraformls = true,
|
||||
tsserver = true,
|
||||
vuels = true,
|
||||
|
||||
yamlls = {
|
||||
settings = {
|
||||
yaml = {
|
||||
|
|
Reference in a new issue