fix: nil problem when jump to location when tab drop
is set as jump_type
#2760
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
I recently implemented a feature to add
tab_drop
asjump_type
option for some LSP pickers in Telescope. I tested in two programming languages (Python and Go) and it worked fine. Today, I tried to write some Rust code and I was not able to use the "Go to definition" feature fromnvim-lspconfig
due to problems withnil
when trying to jump to the location.That was being caused the file path (
flattened_results[1].uri
) being passed in the methodvim.uri_to_fname
was nil. That got me confuse because it works really well with Python (pyright
) and Go (gopls
), but not in Rust (rust-analyzer
). After that, I realized that there is another attribute calledtargetUri
(flattened_results[1].targetUri
) that represents the target URI (as the name says). I tried to replaceuri
fortargetUri
and it worked well with Rust, but Go and Python didn't accept it and the nil problem came back now with Python and Go.Therefore, I making that PR for addressing this issue and now it is working fine with all the languages that I tested (Dart with
dartls
, Go withgopls
, Python withpyright
, Rust withrust-analyzer
and C++ withclangd
)Type of change
How Has This Been Tested?
dartls
, Go withgopls
, Python withpyright
, Rust withrust-analyzer
and C++ withclangd
.Configuration:
Neovim version (nvim --version):
Operating system and version:
Checklist: