feat(config): add configurable diagnostic settings
This commit is contained in:
parent
3233a424e9
commit
4acead695c
3 changed files with 36 additions and 16 deletions
|
@ -13,6 +13,20 @@ config.lsp = {
|
|||
-- true/false or table of filetypes {'.ts', '.js',}
|
||||
format_on_save = true,
|
||||
|
||||
diagnostic = {
|
||||
-- disable diagnostic virtual text (see :h vim.diagnostic.config for all options)
|
||||
virtual_text = false,
|
||||
|
||||
-- disable diagnostic signs (see :h vim.diagnostic.config for all options)
|
||||
signs = false,
|
||||
|
||||
-- enable diagnostic update on insert
|
||||
update_in_insert = true,
|
||||
|
||||
-- disable underline for diagnostic
|
||||
underline = false,
|
||||
}
|
||||
|
||||
servers = {
|
||||
|
||||
-- enable/disable server + formatting
|
||||
|
|
|
@ -17,6 +17,24 @@ local default_config = {
|
|||
},
|
||||
lsp = {
|
||||
format_on_save = true, -- true/false or table of filetypes {'.ts', '.js',}
|
||||
diagnostic = {
|
||||
signs = true,
|
||||
update_in_insert = false,
|
||||
virtual_text = {
|
||||
spacing = 4,
|
||||
source = 'always',
|
||||
severity = {
|
||||
min = vim.diagnostic.severity.HINT,
|
||||
},
|
||||
-- todo: icons for diagnostics?
|
||||
--[[ format = function(diagnostic)
|
||||
if diagnostic.severity == vim.diagnostic.severity.ERROR then
|
||||
return string.format('E: %s', diagnostic.message)
|
||||
end
|
||||
return diagnostic.message
|
||||
end, ]]
|
||||
},
|
||||
},
|
||||
servers = {
|
||||
eslint = {
|
||||
format = false,
|
||||
|
|
|
@ -1,25 +1,13 @@
|
|||
local config = require('cosmic.config')
|
||||
local icons = require('cosmic.core.theme.icons')
|
||||
local M = {}
|
||||
|
||||
function M.init()
|
||||
vim.diagnostic.config({
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
virtual_text = {
|
||||
spacing = 4,
|
||||
source = 'always',
|
||||
severity = {
|
||||
min = vim.diagnostic.severity.HINT,
|
||||
},
|
||||
-- todo: icons for diagnostics?
|
||||
--[[ format = function(diagnostic)
|
||||
if diagnostic.severity == vim.diagnostic.severity.ERROR then
|
||||
return string.format('E: %s', diagnostic.message)
|
||||
end
|
||||
return diagnostic.message
|
||||
end, ]]
|
||||
},
|
||||
signs = true,
|
||||
update_in_insert = config.lsp.diagnostic.update_in_insert,
|
||||
virtual_text = config.lsp.diagnostic.virtual_text,
|
||||
signs = config.lsp.diagnostic.signs,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
show_header = false,
|
||||
|
|
Loading…
Add table
Reference in a new issue