diff --git a/README.md b/README.md index cd98ee0..0d8e813 100644 --- a/README.md +++ b/README.md @@ -406,6 +406,10 @@ Jump between symbols with treesitter (with `]r` and `[r`) ### Diagnostic +Visual studio code style show errors minimap in scroll bar area +![diagnostic_scroll_bar](https://user-images.githubusercontent.com/1681295/128736430-e365523d-810c-4c16-a3b4-c74969f45f0b.jpg) + + Diagnostic in single bufer ![diagnostic](https://github.com/ray-x/files/blob/master/img/navigator/diag.jpg?raw=true) diff --git a/lua/navigator/diagnostics.lua b/lua/navigator/diagnostics.lua index f62c537..7d3c6c2 100644 --- a/lua/navigator/diagnostics.lua +++ b/lua/navigator/diagnostics.lua @@ -12,7 +12,7 @@ local path_cur = require"navigator.util".path_cur() diagnostic_list[vim.bo.filetype] = {} local function error_marker(result, client_id) - if _NgConfigValues.diag_scroll_bar_sign == nil then + if _NgConfigValues.diag_scroll_bar_sign == nil then -- not enabled or already shown return end local first_line = vim.fn.line('w0') @@ -35,6 +35,10 @@ local function error_marker(result, client_id) return end + if _NG_VT_NS == nil then + _NG_VT_NS = vim.api.nvim_create_namespace("navigator_lua") + end + vim.api.nvim_buf_clear_namespace(0, _NG_VT_NS, 0, -1) -- total line num of current buffer @@ -133,6 +137,7 @@ local diag_hdlr = function(err, method, result, client_id, bufnr, config) error_marker(result, client_id) else vim.api.nvim_buf_clear_namespace(0, _NG_VT_NS, 0, -1) + _NG_VT_NS = nil end end