1
0
Fork 0

Arreglado el tema de diagnostics en statusline

This commit is contained in:
deadguy 2021-12-25 21:28:02 -03:00
parent 82a12e0134
commit f785201b06
Signed by: dgy
GPG Key ID: 37CA55B52CF63730
1 changed files with 23 additions and 25 deletions

View File

@ -9,8 +9,8 @@ end
-- diagnostics symbol config
local symbol_config = {
indicator_hint = "",
indicator_info = "",
indicator_hint = " ",
indicator_info = " ",
indicator_warning = "",
indicator_error = "",
}
@ -20,10 +20,10 @@ local statusline_colors = {
active = "%#StatusLine#",
inactive = "%#StatusLineNC#",
git = "%#diffChanged#",
err = "%#DiagnosticSignError#",
warn = "%#DiagnosticSignWarn#",
nfo = "%#DiagnosticSignInfo#",
hnt = "%#DiagnosticSignHint#",
err = "%#LspDiagnosticsLineNrError#",
warn = "%#LspDiagnosticsLineNrWarning#",
nfo = "%#LspDiagnosticsLineNrInformation#",
hnt = "%#LspDiagnosticsLineNrHint#",
line_col = "%#Delimiter#",
percentage = "%#Delimiter#",
}
@ -79,27 +79,25 @@ local get_diagnostics = function()
end
local status_parts = {}
if not Is_htruncated(truncation_limit) then
local warnings = vim.diagnostic.get(0, { severity = vim.diagnostic.severity.WARN })
local hints = vim.diagnostic.get(0, { severity = vim.diagnostic.severity.HINT })
local infos = vim.diagnostic.get(0, { severity = vim.diagnostic.severity.INFO })
local errors = vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR })
local warnings = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.WARN })
local hints = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.HINT })
local infos = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.INFO })
local errors = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR })
if errors > 0 then
table.insert(status_parts, statusline_colors.err .. symbol_config.indicator_error .. errors)
end
if errors > 0 then
table.insert(status_parts, statusline_colors.err .. symbol_config.indicator_error .. errors)
end
if warnings > 0 then
table.insert(status_parts, statusline_colors.warn .. symbol_config.indicator_warning .. warnings)
end
if warnings > 0 then
table.insert(status_parts, statusline_colors.warn .. symbol_config.indicator_warning .. warnings)
end
if infos > 0 then
table.insert(status_parts, statusline_colors.nfo .. symbol_config.indicator_info .. infos)
end
if infos > 0 then
table.insert(status_parts, statusline_colors.nfo .. symbol_config.indicator_info .. infos)
end
if hints > 0 then
table.insert(status_parts, statusline_colors.hnt .. symbol_config.indicator_hint .. hints)
end
if hints > 0 then
table.insert(status_parts, statusline_colors.hnt .. symbol_config.indicator_hint .. hints)
end
local status_diagnostics = vim.trim(table.concat(status_parts, " "))
@ -128,7 +126,7 @@ end
-- active statusline
local statusline_normal = function()
-- local diagnostics = get_diagnostics()
local diagnostics = get_diagnostics()
local flags = statusline_colors.active .. get_flags()
local filename = statusline_colors.active .. get_filename()
local git = statusline_colors.git .. get_git_status()
@ -136,7 +134,7 @@ local statusline_normal = function()
local percentage = statusline_colors.percentage .. get_percentage()
return table.concat({
-- diagnostics,
diagnostics,
flags,
"%=% ",
filename,