From 20bf20500c95208c3ac0ef07245065bf94dcab15 Mon Sep 17 00:00:00 2001 From: Hicro <75737377+HicaroD@users.noreply.github.com> Date: Sun, 5 Nov 2023 23:06:57 -0300 Subject: [PATCH] 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 --- lua/telescope/builtin/__lsp.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/telescope/builtin/__lsp.lua b/lua/telescope/builtin/__lsp.lua index 5a8884ddfd..01a19912c7 100644 --- a/lua/telescope/builtin/__lsp.lua +++ b/lua/telescope/builtin/__lsp.lua @@ -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