Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 7 commits into from
Nov 6, 2023

Conversation

HicaroD
Copy link
Contributor

@HicaroD HicaroD commented Oct 26, 2023

Description

I recently implemented a feature to add tab_drop as jump_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 from nvim-lspconfig due to problems with nil when trying to jump to the location.

That was being caused the file path (flattened_results[1].uri) being passed in the method vim.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 called targetUri (flattened_results[1].targetUri) that represents the target URI (as the name says). I tried to replace uri for targetUri 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 with gopls, Python with pyright, Rust with rust-analyzer and C++ with clangd)

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Used the feature for jumping to the definition in the following programmings languages and its language servers: Dart with dartls, Go with gopls, Python with pyright, Rust with rust-analyzer and C++ with clangd.

Configuration:

  • Neovim version (nvim --version):

    NVIM v0.9.2
    Build type: Release
    LuaJIT 2.1.1694285958
    
  • Operating system and version:

    OS: Manjaro Linux x86_64
    Kernel: 6.1.55-1-MANJARO
    

Checklist:

  • My code follows the style guidelines of this project (stylua)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (lua annotations)

Copy link
Contributor

@jamestrew jamestrew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for the late response
lgtm thanks!

@jamestrew jamestrew merged commit 20bf205 into nvim-telescope:master Nov 6, 2023
6 checks passed
rameshsanth pushed a commit to rameshsanth/telescope.nvim that referenced this pull request Nov 17, 2023
…p_type` (nvim-telescope#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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants