From 427007ee9b69735311a1a1380ffdb36ead5534b4 Mon Sep 17 00:00:00 2001 From: ray-x Date: Wed, 3 Nov 2021 10:35:09 +1100 Subject: [PATCH] bugfix issue #97 --- README.md | 26 ++++++++++++++++++++++++++ lua/navigator/lspwrapper.lua | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2d967d1..76afe02 100644 --- a/README.md +++ b/README.md @@ -596,6 +596,32 @@ Codelens for C++/ccls. Symbol reference ![nerdfont](https://github.com/ray-x/files/blob/master/img/navigator/icon_nerd.jpg?raw=true) +# Debug the plugin + +One simple way to gether debug info and understand what is wrong is output the debug logs + +```lua +require'navigator'.setup({ + debug = false, -- log output, set to true and log path: ~/.local/share/nvim/gh.log + }) +``` + +```lua +-- output the logs + +local log = require"navigator.util".log + +-- output your log + +local definition_hdlr = util.mk_handler(function(err, locations, ctx, _) + log('this is a log for locations', locations, "and ctx", ctx) + if err ~= nil then + return + end +end + +``` + # Break changes and known issues [known issues I am working on](https://github.com/ray-x/navigator.lua/issues/1) diff --git a/lua/navigator/lspwrapper.lua b/lua/navigator/lspwrapper.lua index 830b38f..7d9b9ef 100644 --- a/lua/navigator/lspwrapper.lua +++ b/lua/navigator/lspwrapper.lua @@ -438,7 +438,7 @@ local function apply_action(action, client, ctx) end if action.command then local command = type(action.command) == 'table' and action.command or action - local fn = vim.lsp.commands[command.command] + local fn = vim.lsp.commands and vim.lsp.commands[command.command] if fn then local enriched_ctx = vim.deepcopy(ctx) enriched_ctx.client_id = client.id