From 5db167d318c474f2891671e5a2390262ea72df43 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 15 Dec 2021 22:03:57 -0400 Subject: [PATCH] feat(modules/bufferline): move to new `vim.diagnostic` api --- lua/doom/modules/config/doom-bufferline.lua | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lua/doom/modules/config/doom-bufferline.lua b/lua/doom/modules/config/doom-bufferline.lua index 6a6e5a8..25ff1b8 100644 --- a/lua/doom/modules/config/doom-bufferline.lua +++ b/lua/doom/modules/config/doom-bufferline.lua @@ -97,11 +97,20 @@ return function() sort_by = "directory", custom_areas = { right = function() + local nvim_is_05 = require("doom.utils").nvim_is_05 + local result = {} - local error = vim.lsp.diagnostic.get_count(0, [[Error]]) - local warning = vim.lsp.diagnostic.get_count(0, [[Warning]]) - local info = vim.lsp.diagnostic.get_count(0, [[Information]]) - local hint = vim.lsp.diagnostic.get_count(0, [[Hint]]) + local error = vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR }) + local warning =vim.diagnostic.get(0, { severity = vim.diagnostic.severity.WARN }) + local info = vim.diagnostic.get(0, { severity = vim.diagnostic.severity.INFO }) + local hint = vim.diagnostic.get(0, { severity = vim.diagnostic.severity.HINT }) + + if nvim_is_05 then + error = vim.lsp.diagnostic.get_count(0, [[Error]]) + warning = vim.lsp.diagnostic.get_count(0, [[Warning]]) + info = vim.lsp.diagnostic.get_count(0, [[Information]]) + hint = vim.lsp.diagnostic.get_count(0, [[Hint]]) + end if error ~= 0 then result[1] = {