2021-10-11 09:21:38 +00:00
|
|
|
local require = require('lualine_require').require
|
2022-01-02 11:38:39 +00:00
|
|
|
local utils = require('lualine.utils.utils')
|
2021-10-11 09:21:38 +00:00
|
|
|
local M = {}
|
|
|
|
|
2021-10-12 14:04:47 +00:00
|
|
|
-- default symbols for diagnostics component
|
2021-10-11 09:21:38 +00:00
|
|
|
M.symbols = {
|
|
|
|
icons = {
|
2023-05-04 14:59:39 +00:00
|
|
|
error = ' ', -- x000f015a
|
|
|
|
warn = ' ', -- x000f002a
|
|
|
|
info = ' ', -- x000f02fd
|
|
|
|
hint = ' ', -- x000f0336
|
2021-10-11 09:21:38 +00:00
|
|
|
},
|
|
|
|
no_icons = { error = 'E:', warn = 'W:', info = 'I:', hint = 'H:' },
|
|
|
|
}
|
|
|
|
|
2021-10-12 14:04:47 +00:00
|
|
|
-- default options for diagnostics component
|
2021-10-11 09:21:38 +00:00
|
|
|
M.options = {
|
|
|
|
colored = true,
|
|
|
|
update_in_insert = false,
|
2021-10-21 11:55:35 +00:00
|
|
|
always_visible = false,
|
2023-10-18 05:00:32 +00:00
|
|
|
sources = { 'nvim_diagnostic', 'coc' },
|
2021-10-11 09:21:38 +00:00
|
|
|
sections = { 'error', 'warn', 'info', 'hint' },
|
2022-04-13 05:26:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function M.apply_default_colors(opts)
|
|
|
|
local default_diagnostics_color = {
|
2021-10-11 09:21:38 +00:00
|
|
|
error = {
|
|
|
|
fg = utils.extract_color_from_hllist(
|
2022-09-11 10:43:31 +00:00
|
|
|
{ 'fg', 'sp' },
|
2021-10-11 09:21:38 +00:00
|
|
|
{ 'DiagnosticError', 'LspDiagnosticsDefaultError', 'DiffDelete' },
|
|
|
|
'#e32636'
|
|
|
|
),
|
|
|
|
},
|
|
|
|
warn = {
|
|
|
|
fg = utils.extract_color_from_hllist(
|
2022-09-11 10:43:31 +00:00
|
|
|
{ 'fg', 'sp' },
|
2021-10-11 09:21:38 +00:00
|
|
|
{ 'DiagnosticWarn', 'LspDiagnosticsDefaultWarning', 'DiffText' },
|
|
|
|
'#ffa500'
|
|
|
|
),
|
|
|
|
},
|
|
|
|
info = {
|
|
|
|
fg = utils.extract_color_from_hllist(
|
2022-09-11 10:43:31 +00:00
|
|
|
{ 'fg', 'sp' },
|
2021-10-11 09:21:38 +00:00
|
|
|
{ 'DiagnosticInfo', 'LspDiagnosticsDefaultInformation', 'Normal' },
|
|
|
|
'#ffffff'
|
|
|
|
),
|
|
|
|
},
|
|
|
|
hint = {
|
|
|
|
fg = utils.extract_color_from_hllist(
|
2022-09-11 10:43:31 +00:00
|
|
|
{ 'fg', 'sp' },
|
2021-10-11 09:21:38 +00:00
|
|
|
{ 'DiagnosticHint', 'LspDiagnosticsDefaultHint', 'DiffChange' },
|
|
|
|
'#273faf'
|
|
|
|
),
|
|
|
|
},
|
2022-04-13 05:26:31 +00:00
|
|
|
}
|
|
|
|
opts.diagnostics_color = vim.tbl_deep_extend('keep', opts.diagnostics_color or {}, default_diagnostics_color)
|
|
|
|
end
|
2021-10-11 09:21:38 +00:00
|
|
|
|
|
|
|
return M
|