fix(nvim): diagnostic sign
This commit is contained in:
@@ -67,30 +67,3 @@ for _, server in ipairs(servers) do
|
|||||||
end
|
end
|
||||||
lspconfig[server].setup(config)
|
lspconfig[server].setup(config)
|
||||||
end
|
end
|
||||||
|
|
||||||
local diag_config1 = {
|
|
||||||
virtual_text = {
|
|
||||||
severity = {
|
|
||||||
max = vim.diagnostic.severity.WARN,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
virtual_lines = {
|
|
||||||
severity = {
|
|
||||||
min = vim.diagnostic.severity.ERROR,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
local diag_config2 = {
|
|
||||||
virtual_text = true,
|
|
||||||
virtual_lines = false,
|
|
||||||
}
|
|
||||||
vim.diagnostic.config(diag_config1)
|
|
||||||
local diag_config_basic = false
|
|
||||||
vim.keymap.set("n", "<leader>ll", function()
|
|
||||||
diag_config_basic = not diag_config_basic
|
|
||||||
if diag_config_basic then
|
|
||||||
vim.diagnostic.config(diag_config2)
|
|
||||||
else
|
|
||||||
vim.diagnostic.config(diag_config1)
|
|
||||||
end
|
|
||||||
end, { desc = "Toggle diagnostic virtual_lines" })
|
|
||||||
|
|||||||
@@ -4,26 +4,47 @@ local opt = require("core.globals").keymap_opt
|
|||||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, opt)
|
vim.keymap.set("n", "K", vim.lsp.buf.hover, opt)
|
||||||
vim.keymap.set("n", "<leader>lR", vim.lsp.buf.rename, opt)
|
vim.keymap.set("n", "<leader>lR", vim.lsp.buf.rename, opt)
|
||||||
|
|
||||||
|
local icons = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||||
|
local signs = {}
|
||||||
|
for type, icon in pairs(icons) do
|
||||||
|
local hl = "DiagnosticSign" .. type
|
||||||
|
signs[hl] = { text = icon, texthl = hl, numhl = hl }
|
||||||
|
end
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
virtual_text = { spacing = 4, prefix = "●" },
|
virtual_text = { spacing = 4, prefix = "●" },
|
||||||
signs = true,
|
signs = signs,
|
||||||
underline = true,
|
underline = true,
|
||||||
update_in_insert = true,
|
update_in_insert = true,
|
||||||
severity_sort = true,
|
severity_sort = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
|
||||||
for type, icon in pairs(signs) do
|
|
||||||
local hl = "DiagnosticSign" .. type
|
|
||||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||||
border = "single",
|
border = "single",
|
||||||
})
|
})
|
||||||
--[[ vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
|
||||||
border = "single",
|
|
||||||
focusable = false,
|
|
||||||
relative = "cursor",
|
|
||||||
}) ]]
|
|
||||||
|
|
||||||
|
local diag_config1 = {
|
||||||
|
virtual_text = {
|
||||||
|
severity = {
|
||||||
|
max = vim.diagnostic.severity.WARN,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
virtual_lines = {
|
||||||
|
severity = {
|
||||||
|
min = vim.diagnostic.severity.ERROR,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
local diag_config2 = {
|
||||||
|
virtual_text = true,
|
||||||
|
virtual_lines = false,
|
||||||
|
}
|
||||||
|
vim.diagnostic.config(diag_config1)
|
||||||
|
local diag_config_basic = false
|
||||||
|
vim.keymap.set("n", "<leader>ll", function()
|
||||||
|
diag_config_basic = not diag_config_basic
|
||||||
|
if diag_config_basic then
|
||||||
|
vim.diagnostic.config(diag_config2)
|
||||||
|
else
|
||||||
|
vim.diagnostic.config(diag_config1)
|
||||||
|
end
|
||||||
|
end, { desc = "Toggle diagnostic virtual_lines" })
|
||||||
|
|||||||
Reference in New Issue
Block a user