fix: nil problem when jump to location when tab drop is set as jump_type (#2760)

* feat(lsp_definitions): adding `tab drop` as `jump_type`

* feat(lsp-jump-types): `tab drop` for LSP features

Now, you're able to use `tab drop` as `jump_type` for these LSP
features: references, type definitions, definitions an implementations.

* fix(docs): reordering `tab drop` option

* feat: generate docs

* fix: nil problem with `vim.uri_to_fname`

* fix: removing warning about `file_uri` variable not being used

---------

Co-authored-by: Simon Hauser <simon.hauser@helsinki-systems.de>
This commit is contained in:
Hicro
2023-11-05 23:06:57 -03:00
committed by GitHub
parent 4522d7e3ea
commit 20bf20500c

View File

@@ -200,7 +200,11 @@ local function list_or_jump(action, title, opts)
elseif opts.jump_type == "vsplit" then
vim.cmd "vnew"
elseif opts.jump_type == "tab drop" then
local file_path = vim.uri_to_fname(flattened_results[1].uri)
local file_uri = flattened_results[1].uri
if file_uri == nil then
file_uri = flattened_results[1].targetUri
end
local file_path = vim.uri_to_fname(file_uri)
vim.cmd("tab drop " .. file_path)
end
end