feature: diagnostic sign in scroll bar area enable by default

neovim_0_5
ray-x 3 years ago
parent 7dd5d50691
commit 0584a5cd06

@ -216,7 +216,8 @@ require'navigator'.setup({
lsp = {
format_on_save = true, -- set to false to disasble lsp code format on save (if you are using prettier/efm/formater etc)
diag_scroll_bar_sign = nil, -- experimental: set to {'╍', 'ﮆ'} to enable diagnostic status in scroll bar area
diag_scroll_bar_sign = {'▃', '█'}, -- experimental: diagnostic status in scroll bar area; set to nil to disable the diagnostic sign,
-- for other style, set to {'╍', 'ﮆ'} or {'-', '='}
disply_diagnostic_qf = true, -- always show quickfix if there are diagnostic errors, set to false if you want to
ignore it

@ -19,7 +19,7 @@ _NgConfigValues = {
lsp = {
format_on_save = true, -- set to false to disasble lsp code format on save (if you are using prettier/efm/formater etc)
disply_diagnostic_qf = true, -- always show quickfix if there are diagnostic errors
diag_scroll_bar_sign = nil, -- set to {'╍', 'ﮆ'} to enable diagnostic status in scroll bar area
diag_scroll_bar_sign = {'', ''}, -- set to nil to disable, set to {'╍', 'ﮆ'} to enable diagnostic status in scroll bar area
tsserver = {
-- filetypes = {'typescript'} -- disable javascript etc,
-- set to {} to disable the lspclient for all filetype

@ -24,7 +24,7 @@ local function error_marker(result, client_id)
return
end
log(result, bufnr)
trace(result, bufnr)
if result == nil or result.diagnostics == nil or #result.diagnostics == 0 then
local diag_cnt = vim.lsp.diagnostic.get_count(bufnr, [[Error]])
@ -35,19 +35,20 @@ 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
local winid = vim.fn.win_getid(vim.fn.winnr())
local total_num = vim.fn.getbufinfo(vim.fn.winbufnr(winid))[1].linecount
-- window size of current buffer
local wwidth = vim.fn.winwidth(winid)
local wheight = vim.fn.winheight(winid)
if total_num <= wheight then
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)
if total_num <= wheight then
first_line = 0
end

Loading…
Cancel
Save