feat(config): full vim.diagnostic config settings

This commit is contained in:
Matt Leong 2021-10-29 14:18:05 -07:00
parent 9ed1d49ae5
commit 8064cf355a
3 changed files with 21 additions and 16 deletions

View file

@ -4,6 +4,7 @@
local config = {}
-- statusline settings
config.statusline = {
main_icon = '',
}
@ -29,12 +30,13 @@ config.lsp = {
-- set to false to disable rename notification
rename_notification = false,
-- see :h vim.diagnostic.config for all diagnostic configuration options
diagnostic = {
-- disable diagnostic virtual text (see :h vim.diagnostic.config for all options)
-- disable diagnostic virtual text
virtual_text = false,
-- disable diagnostic signs (see :h vim.diagnostic.config for all options)
-- disable diagnostic signs
signs = false,
-- enable diagnostic update on insert
@ -70,6 +72,7 @@ config.lsp = {
-- specifc to efm, e.g. 'eslint', 'prettier', 'stylua'
disable_formatters = {'eslint'},
},
},
}

View file

@ -30,9 +30,17 @@ local default_config = {
lsp = {
format_on_save = true, -- true/false or table of filetypes {'.ts', '.js',}
rename_notification = true,
-- vim.diagnostic.config settiings
diagnostic = {
underline = true,
signs = true,
update_in_insert = false,
severity_sort = true,
float = {
show_header = false,
source = 'always',
border = 'single',
},
virtual_text = {
spacing = 4,
source = 'always',
@ -49,10 +57,15 @@ local default_config = {
},
},
servers = {
-- override lsp server options
--[[ rust_analyzer = {
opts = {}
}, ]]
-- enable/disable server + formatting
-- rust_analyzer = true, -- enable non-default servers (todo: support for custom server configs)
eslint = {
format = false,
}, -- enable/disable server + formatting
-- rust_analyzer = true, -- enable non-default servers (todo: support for custom server configs)
},
efm = {
format = true, -- true or false
disable_formatters = { 'eslint' }, -- e.g. 'eslint', 'prettier', 'stylua'

View file

@ -3,18 +3,7 @@ local icons = require('cosmic.core.theme.icons')
local M = {}
function M.init()
vim.diagnostic.config({
underline = 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,
source = 'always',
border = 'single',
},
})
vim.diagnostic.config(config.lsp.diagnostic)
local function do_diagnostic_signs()
local signs = {