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(lsp): pass server resp through client handlers (1) #2770

Closed
wants to merge 1 commit into from

Conversation

jamestrew
Copy link
Contributor

For LSP methods/pickers:

  • references
  • definition
  • typeDefinition
  • implementation

Passes the server results through client (and neovim's) lsp handler function.
This lets those handlers deal with some of the language server specific idiosyncrasies.

Also refactors shared code between these pickers.

Other pickers/methods will need similar treatment.

For LSP methods/pickers:
- references
- definition
- typeDefinition
- implementation

Passes the server results through client (and neovim's) lsp handler
function.
This lets those handlers deal with some of the language server specific
idiosyncrasies.

Also refactors shared code between these pickers.

Other pickers/methods will need similar treatment.
@solson
Copy link

solson commented Nov 7, 2023

Thanks for the quick PR! When I re-try my reproduction steps from #2768, I run into this error:

Error executing vim.schedule lua callback: ...ker/start/telescope.nvim/lua/telescope/builtin/__lsp.lua:147: attempt to index local 'location' (a nil value)
stack traceback:
        ...ker/start/telescope.nvim/lua/telescope/builtin/__lsp.lua:147: in function 'handler'
        ...eovim-unwrapped-0.9.4/share/nvim/runtime/lua/vim/lsp.lua:1393: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

Which suggests that local location = items[1].user_data was nil.

@jamestrew
Copy link
Contributor Author

Ah.. it's probably a neovim version issue.
It looks like I'm relying on some bleeding edge changes on nightly (neovim/neovim#25830)

I think we're planning to bump the minimum neovim version requirement to 0.10 for telescope v0.2.0 but there's no timeline for that. Either we come up with a different approach or can't merge this until then.

I'm not sure if I'm in love with my solution anyways. This relies on the custom handlers eventually calling neovim's builtin handler or supporting a on_list option like the builtin one does. And I don't think this is a requirement for lsp handlers.

@josephcrawfordSRH
Copy link

josephcrawfordSRH commented Oct 21, 2024

@jamestrew any thoughts on when this may get released? This fixes an issue I have been having where I cannot jump to the definition for typescript dependencies which are imported via a URL.

I now see that this pull request is quite old and probably will not get merged, however, there does seem to still be an issue with telescope and jumping to defenitions.

neovim/nvim-lspconfig#761 (comment)

@jamestrew
Copy link
Contributor Author

See #2768 (comment)

telescope doesn't handle custom handlers and I don't see any great way of doing so as the linked comment explains.

I'm still thinking about this problem but I don't think this PR is the right approach now.

@jamestrew jamestrew closed this Oct 21, 2024
@josephcrawfordSRH
Copy link

@jamestrew is there a way to make telescope not handle these, I am not quite sure why gd to jump to a definition would go through telescope at all, I can see gr (references) but not jump to definition.

@jamestrew
Copy link
Contributor Author

That would be dependent on your neovim config. Somewhere you must have gd mapping to telescope.

@josephcrawfordSRH
Copy link

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