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

<leader>lh #175

Open
v0ry opened this issue Feb 8, 2024 · 11 comments
Open

<leader>lh #175

v0ry opened this issue Feb 8, 2024 · 11 comments

Comments

@v0ry
Copy link

v0ry commented Feb 8, 2024

E5108: Error executing lua ~/.config/nvim/lua/user/lspconfig.lua:36: attempt to inde x field 'inlay_hint' (a nil value) stack traceback: ~/.config/nvim/lua/user/lspconfig.lua:36: in function 'toggle_inlay_hints' [string ":lua"]:1: in main chunk

Here is 36
M.toggle_inlay_hints = function() local bufnr = vim.api.nvim_get_current_buf() vim.lsp.inlay_hint.enable(bufnr, not vim.lsp.inlay_hint.is_enabled(bufnr)) end

@shreyas-a-s
Copy link

I think to use inlay_hints feature we need neovim v0.10 or later

@jrock2004
Copy link

@shreyas-a-s so I am on NVIM v0.10.0-dev-2538+g8ba552bd5-Homebrew and I do not get the error anymore but it also does not toggle hints

image

@shreyas-a-s
Copy link

shreyas-a-s commented Mar 8, 2024

@jrock2004 Maybe it is indeed broken. I will test the latest neovim nightly on my machine (linux, not macOS btw) and reply back.

@shreyas-a-s
Copy link

@jrock2004 Found the culprit!

It's just that in the settings for lua_ls, at lua/user/lspsettings/lua_ls.lua, hints are disabled:

hint = {
  enable = false, -- this is the culprit line
  arrayIndex = "Disable",
  await = true,
  paramName = "Disable",
  paramType = true,
  semicolon = "All",
  setType = false,
},

I've enabled hints (i.e. set enable = true) and set the paramName to "All" and I can see hints when toggling with <space>lh. See the 'modename' and semicolons in this picture:

image

NOTE: Atleast for me, when I open a lua file like this there is a delay of couple of seconds before lua language server fully analyses the code in current folder recursively. Hints can only be toggled after this delay. So when testing, after opening a file, wait a few seconds before trying to toggle hints.

I hope this was the issue. Please tell if it works.

@jrock2004
Copy link

jrock2004 commented Mar 8, 2024

@shreyas-a-s Works like a champ. Thanks

@shreyas-a-s
Copy link

shreyas-a-s commented Mar 8, 2024

@jrock2004 That's the thing. You need to go to lua/user/lspsettings/lua_ls.lua and set paramName = "All" to see the modename.

@jrock2004
Copy link

@shreyas-a-s Yeah that is what I was missing hence I updated my comment :)

@shreyas-a-s
Copy link

Oh sorry, I think I was too fast there. :)

Happy that I could be of help.

@shreyas-a-s
Copy link

shreyas-a-s commented Mar 8, 2024

@jrock2004 If that's it and there's nothing more with regards to this, it would be great if you could close the issue as completed so that the issue section stays pristine. ;-)

@jrock2004
Copy link

@shreyas-a-s I am not the author so I cannot close

@shreyas-a-s
Copy link

@jrock2004 My bad, Oopsies. I thought you were the one. Then let's wait for THE actual One to return.

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

No branches or pull requests

3 participants