diff --git a/README.md b/README.md index b1b4882..44901b7 100644 --- a/README.md +++ b/README.md @@ -242,7 +242,9 @@ require'navigator'.setup({ The plugin can work with multiple LSP, e.g sqls+gopls+efm. But there are cases you may need to disable some of the servers. (Prevent loading multiple LSP for same source code.) e.g. I saw strange behaviours when I use pyls+pyright+pyls_ms together. If you have multiple similar LSP installed and have trouble with the plugin, please enable only one at a time. -To disable a LSP server, set `filetypes` to {} e.g. + +### Disable a lsp client loading from navigator +To disable a specific LSP, set `filetypes` to {} e.g. ```lua require'navigator'.setup({ diff --git a/lua/navigator/gui.lua b/lua/navigator/gui.lua index 4f9898e..6f63049 100644 --- a/lua/navigator/gui.lua +++ b/lua/navigator/gui.lua @@ -172,37 +172,27 @@ function M.new_list_view(opts) -- data = display_data, data = data, border = border, - on_confirm = opts.on_confirm or function(pos) - if pos == 0 then - pos = 1 - end - local l = idx(data, pos) - if l.filename ~= nil then - log("openfile ", l.filename, l.lnum, l.col) - util.open_file_at(l.filename, l.lnum, l.col) + on_confirm = opts.on_confirm or function(item) + if item.filename ~= nil then + log("openfile ", item.filename, item.lnum, item.col) + util.open_file_at(item.filename, item.lnum, item.col) end end, - on_move = opts.on_move or function(pos) - if pos == 0 then - pos = 1 - end - - local l = idx(data, pos) -- bug it not work with fzy filter - trace(data) - trace("on move", pos, l) - trace("on move", pos, l.text or l, l.uri, l.filename) + on_move = opts.on_move or function(item) + trace("on move", pos, item) + trace("on move", pos, item.text or item, item.uri, item.filename) -- todo fix - if l.uri == nil then - l.uri = "file:///" .. l.filename + if item.uri == nil then + item.uri = "file:///" .. item.filename end return M.preview_uri({ - uri = l.uri, + uri = item.uri, width = width, height = lheight, -- this is to cal offset preview_height = pheight, - lnum = l.lnum, - col = l.col, - range = l.range, + lnum = item.lnum, + col = item.col, + range = item.range, offset_x = 0, offset_y = offset_y, border = border,