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

Lua LSP error #182

Open
appomsk opened this issue May 19, 2024 · 1 comment
Open

Lua LSP error #182

appomsk opened this issue May 19, 2024 · 1 comment

Comments

@appomsk
Copy link

appomsk commented May 19, 2024

When trying to edit a lua file:

LSP[lua_ls]: Error ON_ATTACH_ERROR: "...nAtNCc/usr/share/nvim/runtime/lua/vim/lsp/inlay_hint.l
ua:408: enable: expected boolean, got number"

I think the problem is in lspconfig.lua. There is some information - neovim/neovim#26679.

@aquinjay
Copy link

aquinjay commented Jun 5, 2024

Updating the lspconfig.lua file methods M.on_attach and M.toggle_inlay_hints with the below code fixed the issue for me.

M.on_attach = function(client, bufnr) 
  lsp_keymaps(bufnr)

  if client.supports_method "textDocument/inlayHint" then
    vim.lsp.inlay_hint.enable(true, {  bufnr })
  end
end

M.toggle_inlay_hints = function()
  local bufnr = vim.api.nvim_get_current_buf()
  vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr }), { bufnr })
end

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

2 participants