astrocommunity icon indicating copy to clipboard operation
astrocommunity copied to clipboard

fix(java): use builtin nvim 0.10 "go to definition/declaration" function

Open Juniar-Rakhman opened this issue 1 year ago • 3 comments

📑 Description

Using Neovim 0.10 and java-pack, the default keybinding for go to definition "gd" and go to declaration "gD" is no longer working.

The following error message is shown:

[telescope.builtin.lsp_*]: server does not support definitionProvider

To fix this the default "gd" and "gD" need to be mapped to the following command:

vim.lsp.buf.definition()
vim.lsp.buf.declaration()

List of changes:

  • [x] added config to override default telescope "gd" and "gD" key binding.

Juniar-Rakhman avatar May 19 '24 09:05 Juniar-Rakhman

Review Checklist

Does this PR follow the [Contribution Guidelines](development guidelines)? Following is a partial checklist:

Proper conventional commit scoping:

  • If you are adding a new plugin, the scope would be the name of the category it is being added into. ex. feat(utility): added noice.nvim plugin

  • If you are modifying a pre-existing plugin or pack, the scope would be the name of the plugin folder. ex. fix(noice-nvim): fix LSP handler error

  • [ ] Pull request title has the appropriate conventional commit type and scope where the scope is the name of the pre-existing directory in the project as described above

  • [ ] README is properly formatted and uses fenced in links with <url> unless they are inside a [title](url)

  • [ ] Proper usage of opts table rather than setting things up with the config function.

github-actions[bot] avatar May 19 '24 09:05 github-actions[bot]

are these functions only available on neovim 0.10?

Uzaaft avatar May 19 '24 11:05 Uzaaft

@Uzaaft

I thought it was new to 0.10 but it was also available in 0.9.5. I never had to look for it in 0.9.5 as it was working just fine.

After some more googling, I think this is more of a Telescope issue: https://github.com/nvim-telescope/telescope.nvim/issues/2898#issuecomment-2117962082

I'm fine with this changes not included in the pack. I can modify my own keymaps until Telescope release a fix.

I'm not sure if this is affecting other LSP's though. If it is then maybe we should change default "gd" and "gD" behavior in the core?

Juniar-Rakhman avatar May 19 '24 12:05 Juniar-Rakhman

Telescope has released a new version with this fix

mehalter avatar May 21 '24 12:05 mehalter

@mehalter Sorry, but this issue is still happening in telescope v0.1.7. Tested on jdtls and gopls project, got the same error. Works fine with ts/js project though.

Edit: nvm it works after I did a clean reinstallation of astronvim :)

Juniar-Rakhman avatar May 22 '24 03:05 Juniar-Rakhman