ray-x / go.nvim

G'day Nvimer, Joyful Gopher: Discover the Feature-Rich Go Plugin for Neovim
MIT License
1.91k stars 119 forks source link

Getting error about `inlay_hint` #398

Closed 1995parham closed 7 months ago

1995parham commented 7 months ago

I am using the nightly build of neovim and recently I've got the following error:

Error executing vim.schedule lua callback: ...share/nvim/site/pack/packer/opt/go.nvim/lua/go/inlay.lua:312: attempt to call field 'inlay_hint' (a table value)
ray-x commented 7 months ago

It seems something modified the internal vim.lsp.inlay_hint. It is type is function for neovim nightly and it is nil for release version

1995parham commented 7 months ago

Yes, you are right. Yesterday neovim merged https://github.com/neovim/neovim/issues/25069, I think a change is required in the code to make it compatible with the upcoming release.

luv2code commented 7 months ago

Changing this line from

      vim.lsp.inlay_hint(bufnr, enabled)

to

      vim.lsp.inlay_hint.enable(bufnr, enabled)

fixed it for me.

It looks like they changed the API to enable more lsp interactions with inlay hints.

1995parham commented 7 months ago

@ray-x what do you think about providing MR for changing this by version constraint?

ray-x commented 7 months ago

Update pushed. I have to drop support for users who stay with the old version of nightly.

1995parham commented 7 months ago

Awesome :heart_eyes: :woman_dancing: