From 388711d97d7605a75e22feb4de3f779566b00c68 Mon Sep 17 00:00:00 2001 From: ray-x Date: Mon, 22 Nov 2021 01:32:45 +1100 Subject: [PATCH] issue #101 disable diagnostic_scrollbar --- README.md | 2 +- lua/navigator.lua | 8 ++++++-- lua/navigator/diagnostics.lua | 10 ++++++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 45db918..13d7089 100644 --- a/README.md +++ b/README.md @@ -265,7 +265,7 @@ require'navigator'.setup({ -- to disable all default config and use your own lsp setup set -- disable_lsp = 'all' -- Default {} - diagnostic_scroll_bar_sign = {'▃', '▆', '█'}, -- experimental: diagnostic status in scroll bar area; set to nil to disable the diagnostic sign, + diagnostic_scrollbar_sign = {'▃', '▆', '█'}, -- experimental: diagnostic status in scroll bar area; set to false to disable the diagnostic sign, -- for other style, set to {'╍', 'ﮆ'} or {'-', '='} diagnostic_virtual_text = true, -- show virtual for diagnostic message diagnostic_update_in_insert = false, -- update diagnostic message in insert mode diff --git a/lua/navigator.lua b/lua/navigator.lua index 199c4c2..8ac2292 100644 --- a/lua/navigator.lua +++ b/lua/navigator.lua @@ -135,8 +135,12 @@ local extend_config = function(opts) for k, v in pairs(value) do -- level 3 if type(_NgConfigValues[key][k]) == "table" then - for k2, v2 in pairs(v) do - _NgConfigValues[key][k][k2] = v2 + if type(v) == "table" then + for k2, v2 in pairs(v) do + _NgConfigValues[key][k][k2] = v2 + end + else + _NgConfigValues[key][k] = v end else _NgConfigValues[key][k] = v diff --git a/lua/navigator/diagnostics.lua b/lua/navigator/diagnostics.lua index a260da1..90f3233 100644 --- a/lua/navigator/diagnostics.lua +++ b/lua/navigator/diagnostics.lua @@ -42,13 +42,15 @@ local function get_count(bufnr, level) end local function error_marker(result, ctx, config) + if _NgConfigValues.lsp.diagnostic_scrollbar_sign == nil or _NgConfigValues.lsp.diagnostic_scrollbar_sign == {} + or _NgConfigValues.lsp.diagnostic_scrollbar_sign == false then -- not enabled or already shown + return + end + vim.defer_fn(function() if vim.tbl_isempty(result.diagnostics) then return end - if _NgConfigValues.lsp.diagnostic_scrollbar_sign == nil then -- not enabled or already shown - return - end local first_line = vim.fn.line('w0') -- local rootfolder = vim.fn.expand('%:h:t') -- get the current file root folder @@ -170,7 +172,7 @@ end local update_err_marker_async = function() local debounce = require'navigator.debounce'.debounce_trailing - return debounce(20, error_marker) + return debounce(200, error_marker) end local diag_hdlr = mk_handler(function(err, result, ctx, config)