From f4ab5b56dae695657cb15ae69e938038c0acfa62 Mon Sep 17 00:00:00 2001 From: Shadman <13149513+shadmansaleh@users.noreply.github.com> Date: Fri, 10 Dec 2021 06:00:06 +0600 Subject: [PATCH] fix: diagnostics component in nvim-0.5 (#476) --- examples/evil_lualine.lua | 2 +- lua/lualine/components/diagnostics/init.lua | 2 +- lua/tests/spec/lualine_spec.lua | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/examples/evil_lualine.lua b/examples/evil_lualine.lua index d618dc9..2621336 100644 --- a/examples/evil_lualine.lua +++ b/examples/evil_lualine.lua @@ -137,7 +137,7 @@ ins_left { 'progress', color = { fg = colors.fg, gui = 'bold' } } ins_left { 'diagnostics', - sources = { 'nvim_lsp' }, + sources = { 'nvim_diagnostic' }, symbols = { error = ' ', warn = ' ', info = ' ' }, diagnostics_color = { color_error = { fg = colors.red }, diff --git a/lua/lualine/components/diagnostics/init.lua b/lua/lualine/components/diagnostics/init.lua index 85034ae..5de000a 100644 --- a/lua/lualine/components/diagnostics/init.lua +++ b/lua/lualine/components/diagnostics/init.lua @@ -58,7 +58,7 @@ function M:init(options) print 'no sources for diagnostics configured' return '' end - if vim.fn.has 'nvim-0.6' then + if vim.fn.has 'nvim-0.6' == 1 then for i, name in ipairs(self.options.sources) do if name == 'nvim_lsp' then self.options.sources[i] = 'nvim_diagnostic' diff --git a/lua/tests/spec/lualine_spec.lua b/lua/tests/spec/lualine_spec.lua index cbd3fe8..49741b8 100644 --- a/lua/tests/spec/lualine_spec.lua +++ b/lua/tests/spec/lualine_spec.lua @@ -32,10 +32,7 @@ describe('Lualine', function() end, icon = '', }, - { - 'diagnostics', - sources = { 'nvim_lsp', 'coc' }, - }, + 'diagnostics', }, lualine_c = { 'filename' }, lualine_x = { 'encoding', 'fileformat', 'filetype' },