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