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.reference): single reference direct jump #3137

Merged
merged 2 commits into from
May 29, 2024
Merged

Conversation

jamestrew
Copy link
Contributor

@jamestrew jamestrew commented May 26, 2024

follow up to #3099

clean up list_to_jump to work mostly with vim.lsp.util.locations_to_items output from the get-go

and closes #3118

@Conni2461
Copy link
Member

i am going to review this tomorrow

@Conni2461 Conni2461 self-requested a review May 27, 2024 20:55
@Conni2461 Conni2461 self-assigned this May 27, 2024
@Conni2461
Copy link
Member

Conni2461 commented May 28, 2024

works for both 0.9 and 0.10, can be merged after two nits are addressed, thanks. i like that solution more than #3120

thanks for fixing the issue :)

@jamestrew jamestrew merged commit 127159a into master May 29, 2024
@jamestrew jamestrew deleted the fix/lsp-reference branch May 29, 2024 01:34
@jamestrew
Copy link
Contributor Author

thanks for reviewing!

@lawrenceho
Copy link
Contributor

Unfortunately this broke the jump to Java classes such as java.lang.String because the JDT URI is not a file name.
With item.filename being jdt:https://contents/java.base/java.lang/String.class..., the call vim.uri_from_fname(item.filename) in item_to_location would convert the JDT URI into an invalid URI by adding file:https:// in front of jdt:https:// and encode the already encoded URI again. The jump would fail as a result.

Error message:

Error executing vim.schedule lua callback: /usr/share/nvim/runtime/lua/vim/lsp/util.lua:1136: Cursor position outside buffer
stack traceback:
	[C]: in function 'nvim_win_set_cursor'
	/usr/share/nvim/runtime/lua/vim/lsp/util.lua:1136: in function 'jump_to_location'
	...nvim/lazy/telescope.nvim/lua/telescope/builtin/__lsp.lua:197: in function 'handler'
	/usr/share/nvim/runtime/lua/vim/lsp/client.lua:685: in function ''
	vim/_editor.lua: in function <vim/_editor.lua:0>

@jamestrew
Copy link
Contributor Author

@lawrenceho that's unfortunate. I'll see what we can do to remedy this.

@lawrenceho
Copy link
Contributor

Thank you @jamestrew. By the way, I can create a PR for this by adopting the same approach used in vim.uri_from_bufnr.

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.

Fix :Telescope lsp_references Failing to Jump Directly to Single Reference
3 participants