| 1 |
local require = require('lualine_require').require |
| 2 |
local utils = require('lualine.utils.utils') |
| 3 |
local M = {} |
| 4 |
|
| 5 |
-- default symbols for diagnostics component |
| 6 |
M.symbols = { |
| 7 |
icons = { |
| 8 |
error = ' ', -- x000f015a |
| 9 |
warn = ' ', -- x000f002a |
| 10 |
info = ' ', -- x000f02fd |
| 11 |
hint = ' ', -- x000f0336 |
| 12 |
}, |
| 13 |
no_icons = { error = 'E:', warn = 'W:', info = 'I:', hint = 'H:' }, |
| 14 |
} |
| 15 |
|
| 16 |
-- default options for diagnostics component |
| 17 |
M.options = { |
| 18 |
colored = true, |
| 19 |
update_in_insert = false, |
| 20 |
always_visible = false, |
| 21 |
sources = { 'nvim_diagnostic', 'coc' }, |
| 22 |
sections = { 'error', 'warn', 'info', 'hint' }, |
| 23 |
} |
| 24 |
|
| 25 |
function M.apply_default_colors(opts) |
| 26 |
local default_diagnostics_color = { |
| 27 |
error = { |
| 28 |
fg = utils.extract_color_from_hllist( |
| 29 |
{ 'fg', 'sp' }, |
| 30 |
{ 'DiagnosticError', 'LspDiagnosticsDefaultError', 'DiffDelete' }, |
| 31 |
'#e32636' |
| 32 |
), |
| 33 |
}, |
| 34 |
warn = { |
| 35 |
fg = utils.extract_color_from_hllist( |
| 36 |
{ 'fg', 'sp' }, |
| 37 |
{ 'DiagnosticWarn', 'LspDiagnosticsDefaultWarning', 'DiffText' }, |
| 38 |
'#ffa500' |
| 39 |
), |
| 40 |
}, |
| 41 |
info = { |
| 42 |
fg = utils.extract_color_from_hllist( |
| 43 |
{ 'fg', 'sp' }, |
| 44 |
{ 'DiagnosticInfo', 'LspDiagnosticsDefaultInformation', 'Normal' }, |
| 45 |
'#ffffff' |
| 46 |
), |
| 47 |
}, |
| 48 |
hint = { |
| 49 |
fg = utils.extract_color_from_hllist( |
| 50 |
{ 'fg', 'sp' }, |
| 51 |
{ 'DiagnosticHint', 'LspDiagnosticsDefaultHint', 'DiffChange' }, |
| 52 |
'#273faf' |
| 53 |
), |
| 54 |
}, |
| 55 |
} |
| 56 |
opts.diagnostics_color = vim.tbl_deep_extend('keep', opts.diagnostics_color or {}, default_diagnostics_color) |
| 57 |
end |
| 58 |
|
| 59 |
return M |