fixup: fixes issues in diagnostics component

- typo diagnostic_color -> diagnostics_color
- typo hin -> hint
- warning -> warn since that's what's used everywhere
- change default diagnostics colors slightly

fixes #55
This commit is contained in:
shadmansaleh 2021-09-17 14:40:10 +06:00
parent 8f866213e7
commit b76c410dba
4 changed files with 12 additions and 12 deletions

View File

@ -60,4 +60,4 @@ See [#24](https://github.com/shadmansaleh/lualine.nvim/pull/24) for details
- color_added, color_modified, color_removed are now available as added, - color_added, color_modified, color_removed are now available as added,
modified, removed in diff_color table option modified, removed in diff_color table option
- color_error, color_warning, color_info, color_hint are now available - color_error, color_warning, color_info, color_hint are now available
as error, warning, info, hint in diagnostics_color table option as error, warn, info, hint in diagnostics_color table option

View File

@ -368,7 +368,7 @@ sections = {
-- table of diagnostic sources, available sources: -- table of diagnostic sources, available sources:
-- 'nvim_lsp', 'coc', 'ale', 'vim_lsp' -- 'nvim_lsp', 'coc', 'ale', 'vim_lsp'
-- Or a function that returns a table like -- Or a function that returns a table like
-- {error=error_cnt, warning=warn_cnt, info=info_cnt, hint=hint_cnt} -- {error=error_cnt, warn=warn_cnt, info=info_cnt, hint=hint_cnt}
sources = {}, sources = {},
-- displays diagnostics from defined severity -- displays diagnostics from defined severity
sections = {'error', 'warn', 'info', 'hint'}, sections = {'error', 'warn', 'info', 'hint'},

View File

@ -351,7 +351,7 @@ Component specific local options ~
-- table of diagnostic sources, available sources: -- table of diagnostic sources, available sources:
-- 'nvim_lsp', 'coc', 'ale', 'vim_lsp' -- 'nvim_lsp', 'coc', 'ale', 'vim_lsp'
-- Or a function that returns a table like -- Or a function that returns a table like
-- {error=error_cnt, warning=warn_cnt, info=info_cnt, hint=hint_cnt} -- {error=error_cnt, warn=warn_cnt, info=info_cnt, hint=hint_cnt}
sources = {}, sources = {},
-- displays diagnostics from defined severity -- displays diagnostics from defined severity
sections = {'error', 'warn', 'info', 'hint'}, sections = {'error', 'warn', 'info', 'hint'},

View File

@ -51,7 +51,7 @@ local default_options = {
update_in_insert = false, update_in_insert = false,
sources = nil, sources = nil,
sections = { 'error', 'warn', 'info', 'hint' }, sections = { 'error', 'warn', 'info', 'hint' },
diagnostic_color = { diagnostics_color = {
error = { error = {
fg = modules.utils.extract_highlight_colors('LspDiagnosticsDefaultError', 'fg') fg = modules.utils.extract_highlight_colors('LspDiagnosticsDefaultError', 'fg')
or modules.utils.extract_highlight_colors('DiffDelete', 'fg') or modules.utils.extract_highlight_colors('DiffDelete', 'fg')
@ -60,7 +60,7 @@ local default_options = {
warn = { warn = {
fg = modules.utils.extract_highlight_colors('LspDiagnosticsDefaultWarning', 'fg') fg = modules.utils.extract_highlight_colors('LspDiagnosticsDefaultWarning', 'fg')
or modules.utils.extract_highlight_colors('DiffText', 'fg') or modules.utils.extract_highlight_colors('DiffText', 'fg')
or '#ffdf00', or '#ffa500',
}, },
info = { info = {
fg = modules.utils.extract_highlight_colors('LspDiagnosticsDefaultInformation', 'fg') fg = modules.utils.extract_highlight_colors('LspDiagnosticsDefaultInformation', 'fg')
@ -70,7 +70,7 @@ local default_options = {
hint = { hint = {
fg = modules.utils.extract_highlight_colors('LspDiagnosticsDefaultHint', 'fg') fg = modules.utils.extract_highlight_colors('LspDiagnosticsDefaultHint', 'fg')
or modules.utils.extract_highlight_colors('DiffChange', 'fg') or modules.utils.extract_highlight_colors('DiffChange', 'fg')
or '#d7afaf', or '#273faf',
}, },
}, },
} }
@ -91,22 +91,22 @@ Diagnostics.new = function(self, options, child)
if new_diagnostics.options.colored then if new_diagnostics.options.colored then
new_diagnostics.highlight_groups = { new_diagnostics.highlight_groups = {
error = modules.highlight.create_component_highlight_group( error = modules.highlight.create_component_highlight_group(
new_diagnostics.options.diagnostic_color.error, new_diagnostics.options.diagnostics_color.error,
'diagnostics_error', 'diagnostics_error',
new_diagnostics.options new_diagnostics.options
), ),
warn = modules.highlight.create_component_highlight_group( warn = modules.highlight.create_component_highlight_group(
new_diagnostics.options.diagnostic_color.warn, new_diagnostics.options.diagnostics_color.warn,
'diagnostics_warn', 'diagnostics_warn',
new_diagnostics.options new_diagnostics.options
), ),
info = modules.highlight.create_component_highlight_group( info = modules.highlight.create_component_highlight_group(
new_diagnostics.options.diagnostic_color.info, new_diagnostics.options.diagnostics_color.info,
'diagnostics_info', 'diagnostics_info',
new_diagnostics.options new_diagnostics.options
), ),
hint = modules.highlight.create_component_highlight_group( hint = modules.highlight.create_component_highlight_group(
new_diagnostics.options.diagnostic_color.hint, new_diagnostics.options.diagnostics_color.hint,
'diagnostics_hint', 'diagnostics_hint',
new_diagnostics.options new_diagnostics.options
), ),
@ -209,9 +209,9 @@ Diagnostics.get_diagnostics = function(sources)
source_result = type(source_result) == 'table' and source_result or {} source_result = type(source_result) == 'table' and source_result or {}
result[index] = { result[index] = {
error = source_result.error or 0, error = source_result.error or 0,
warn = source_result.warning or 0, warn = source_result.warn or 0,
info = source_result.info or 0, info = source_result.info or 0,
hint = source_result.hin or 0, hint = source_result.hint or 0,
} }
end end
end end