diff --git a/lua/navigator.lua b/lua/navigator.lua index 8e1c427..57de288 100644 --- a/lua/navigator.lua +++ b/lua/navigator.lua @@ -4,9 +4,10 @@ _NgConfigValues ={ code_action_icon = ' ', width = nil, -- valeu of cols TODO allow float e.g. 0.6 height = nil, - on_attach = function(client, bufnr) - -- your on_attach will be called at end of navigator on_attach - end, + on_attach = nil, + -- function(client, bufnr) + -- -- your on_attach will be called at end of navigator on_attach + -- end, sumneko_root_path = vim.fn.expand("$HOME") .. "/github/sumneko/lua-language-server", sumneko_binary = vim.fn.expand("$HOME") .. "/github/sumneko/lua-language-server/bin/macOS/lua-language-server", code_action_prompt = { diff --git a/lua/navigator/diagnostics.lua b/lua/navigator/diagnostics.lua index f9b591d..78077dd 100644 --- a/lua/navigator/diagnostics.lua +++ b/lua/navigator/diagnostics.lua @@ -31,7 +31,13 @@ local diag_hdlr = function(err, method, result, client_id, br, config) item.col = v.range.start.character + 1 item.uri = uri local head = "🐛" - if v.severity > 1 then + if v.severity == 1 then + head = "🈲" + end + if v.severity == 2 then + head = "☣️" + end + if v.severity > 2 then head = "👎" end local bufnr = vim.uri_to_bufnr(uri) @@ -67,6 +73,7 @@ M.diagnostic_handler = update_in_insert = false } ) + M.show_diagnostic = function() vim.lsp.diagnostic.get_all() @@ -91,10 +98,9 @@ M.show_diagnostic = function() end -- log(display_items) if #display_items > 0 then - gui.new_list_view({items = display_items, api = "🚑 Diagnostic"}) + gui.new_list_view({items = display_items, api = "🚑🐛 Diagnostic "}) end end end - return M diff --git a/lua/navigator/lspclient/attach.lua b/lua/navigator/lspclient/attach.lua index b0cde9d..c062ccc 100644 --- a/lua/navigator/lspclient/attach.lua +++ b/lua/navigator/lspclient/attach.lua @@ -75,7 +75,9 @@ M.on_attach = function(client, bufnr) local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities.textDocument.completion.completionItem.snippetSupport = true local config = require'navigator'.config_value - if config ~= nil then config.on_attach(client, bufnr) end + if config ~= nil and config.on_attach ~= nil then + config.on_attach(client, bufnr) + end end M.setup = function(cfg)