bugfix on_attach is nil and diagnostic update

neovim_0_5
ray-x 3 years ago
parent 93460890c6
commit 8982fd4206

@ -4,9 +4,10 @@ _NgConfigValues ={
code_action_icon = '', code_action_icon = '',
width = nil, -- valeu of cols TODO allow float e.g. 0.6 width = nil, -- valeu of cols TODO allow float e.g. 0.6
height = nil, height = nil,
on_attach = function(client, bufnr) on_attach = nil,
-- your on_attach will be called at end of navigator on_attach -- function(client, bufnr)
end, -- -- 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_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", sumneko_binary = vim.fn.expand("$HOME") .. "/github/sumneko/lua-language-server/bin/macOS/lua-language-server",
code_action_prompt = { code_action_prompt = {

@ -31,7 +31,13 @@ local diag_hdlr = function(err, method, result, client_id, br, config)
item.col = v.range.start.character + 1 item.col = v.range.start.character + 1
item.uri = uri item.uri = uri
local head = "🐛" 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 = "👎" head = "👎"
end end
local bufnr = vim.uri_to_bufnr(uri) local bufnr = vim.uri_to_bufnr(uri)
@ -67,6 +73,7 @@ M.diagnostic_handler =
update_in_insert = false update_in_insert = false
} }
) )
M.show_diagnostic = function() M.show_diagnostic = function()
vim.lsp.diagnostic.get_all() vim.lsp.diagnostic.get_all()
@ -91,10 +98,9 @@ M.show_diagnostic = function()
end end
-- log(display_items) -- log(display_items)
if #display_items > 0 then 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 end
end end
return M return M

@ -75,7 +75,9 @@ M.on_attach = function(client, bufnr)
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true capabilities.textDocument.completion.completionItem.snippetSupport = true
local config = require'navigator'.config_value 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 end
M.setup = function(cfg) M.setup = function(cfg)

Loading…
Cancel
Save