From 354fb64b42f9677071a900cd149f5651fd236b30 Mon Sep 17 00:00:00 2001 From: ray-x Date: Sun, 15 Oct 2023 21:43:31 +1100 Subject: [PATCH] issue #287 diagnostic setup is hard coded --- README.md | 11 ++++++++++- doc/navigator.txt | 8 ++++++++ lua/navigator.lua | 14 +++++++++++--- lua/navigator/diagnostics.lua | 9 +-------- 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 10a2aec..80ef26a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Navigator + 12 require('nvim-autopairs').setup{ - Source code analysis and navigate tool @@ -315,6 +315,14 @@ require'navigator'.setup({ underline = true, virtual_text = true, -- show virtual for diagnostic message update_in_insert = false, -- update diagnostic message in insert mode + float = { -- setup for floating windows style + focusable = false, + sytle = 'minimal', + border = 'rounded', + source = 'always', + header = '', + prefix = '', + }, }, hover = { @@ -337,6 +345,7 @@ require'navigator'.setup({ diagnostic_virtual_text = true, -- show virtual for diagnostic message diagnostic_update_in_insert = false, -- update diagnostic message in insert mode display_diagnostic_qf = true, -- always show quickfix if there are diagnostic errors, set to false if you want to ignore it + -- set to 'trouble' to show diagnositcs in Trouble tsserver = { filetypes = {'typescript'} -- disable javascript etc, -- set to {} to disable the lspclient for all filetypes diff --git a/doc/navigator.txt b/doc/navigator.txt index c3a52cc..9b6da4e 100644 --- a/doc/navigator.txt +++ b/doc/navigator.txt @@ -311,6 +311,14 @@ Nondefault configuration example: underline = true, virtual_text = true, -- show virtual for diagnostic message update_in_insert = false, -- update diagnostic message in insert mode + float = { + focusable = false, + style = 'minimal', + border = 'rounded', + source = 'always', + header = '', + prefix = '', + } }, diagnostic_scrollbar_sign = {'▃', '▆', '█'}, -- experimental: diagnostic status in scroll bar area; set to false to disable the diagnostic sign, -- for other style, set to {'╍', 'ﮆ'} or {'-', '='} diff --git a/lua/navigator.lua b/lua/navigator.lua index 1d7e6e2..c6ba447 100644 --- a/lua/navigator.lua +++ b/lua/navigator.lua @@ -75,6 +75,14 @@ _NgConfigValues = { virtual_text = { spacing = 3, source = true }, -- show virtual for diagnostic message update_in_insert = false, -- update diagnostic message in insert mode severity_sort = { reverse = true }, + float = { + focusable = false, + sytle = 'minimal', + border = 'rounded', + source = 'always', + header = '', + prefix = '', + }, }, definition = { enable = true }, call_hierarchy = { enable = true }, @@ -130,8 +138,8 @@ _NgConfigValues = { disable_format_cap = {}, -- a list of lsp disable file format (e.g. if you using efm or vim-codeformat etc), empty by default disable_lsp = {}, -- a list of lsp server disabled for your project, e.g. denols and tsserver you may -- only want to enable one lsp server - display_diagnostic_qf = true, -- bool: always show quickfix if there are diagnostic errors - -- string: trouble use trouble to show diagnostic + display_diagnostic_qf = false, -- bool: always show quickfix if there are diagnostic errors + -- string: trouble use trouble to show diagnostic diagnostic_load_files = false, -- lsp diagnostic errors list may contains uri that not opened yet set to true -- to load those files diagnostic_virtual_text = true, -- show virtual for diagnostic message @@ -342,7 +350,7 @@ M.setup = function(cfg) end if _NgConfigValues.ts_fold == true then - require('navigator.foldts').on_attach() + require('navigator.foldts').on_attach() end local _start_client = vim.lsp.start_client diff --git a/lua/navigator/diagnostics.lua b/lua/navigator/diagnostics.lua index 4f9eceb..5565d50 100644 --- a/lua/navigator/diagnostics.lua +++ b/lua/navigator/diagnostics.lua @@ -320,14 +320,7 @@ function M.setup() signs = true, update_in_insert = _NgConfigValues.lsp.diagnostic.update_in_insert or false, severity_sort = _NgConfigValues.lsp.diagnostic.severity_sort, - float = { - focusable = false, - style = 'minimal', - border = 'rounded', - source = 'always', - header = '', - prefix = '', - }, + float = _NgConfigValues.lsp.diagnostic.float, } diagnostic_cfg.virtual_text = _NgConfigValues.lsp.diagnostic.virtual_text if