ray-x / go.nvim

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

/usr/share/nvim/runtime/lua/vim/lsp/inlay_hint.lua:375: enable: expected boolean, got table #454

Closed diegoroccia closed 2 months ago

diegoroccia commented 2 months ago

My current configuration: I am running on neovim 0.10-dev, with go.nvim updated to the current master, which includes the fix provided in #452

  {
    "ray-x/go.nvim",
    dependencies = { -- optional packages
      "ray-x/guihua.lua",
      "neovim/nvim-lspconfig",
    },
    ft = { "go", "gomod" },
    build = " :lua require(\"go.install\").update_all_sync()",
    opts = {
      lsp_cfg = false,
    },
  }

and the lsp configuration is as follow

local M = require("go.lsp").config() -- config() return the go.nvim gopls setup

vim.tbl_deep_extend("force", M, {
  gopls = {
    analyses = {
      shadow = true,
      nilness = true,
      unusedparams = true,
      unusedwrite = true,
      useany = true,
    },
    experimentalPostfixCompletions = true,
    gofumpt = true,
    staticcheck = true,
    usePlaceholders = true,
    hints = {
      assignVariableTypes = true,
      compositeLiteralFields = true,
      compositeLiteralTypes = true,
      constantValues = true,
      functionTypeParameters = true,
      parameterNames = true,
      rangeVariableTypes = true,
    },
  },
})

return M

after the latest neovim updates, when I open a go file, I get the following error

Error executing vim.schedule lua callback: /usr/share/nvim/runtime/lua/vim/lsp/inlay_hint.lua:375: enable: expected boolean, got table
stack traceback:
    [C]: in function 'error'
    vim/shared.lua: in function 'validate'
    /usr/share/nvim/runtime/lua/vim/lsp/inlay_hint.lua:375: in function 'enable'
    ...goroccia/.local/share/nvim/lazy/go.nvim/lua/go/inlay.lua:322: in function ''
    vim/_editor.lua: in function <vim/_editor.lua:0>

everything else lsp related still works

ray-x commented 2 months ago

Both Neovim and go.nvim will need to be updated to the latest master. There was a breaking change from Neovim regarding inlay-hint

diegoroccia commented 2 months ago

I have NeoVim v0.10.0-dev-3021+g0547347e7 built from source

NVIM v0.10.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.1703358377

and just updated go.nvim, but I am still getting the same error

diegoroccia commented 2 months ago

apologies, I tried with another configuration and the hints work, so it must be something wrong with my configuration. I'll investigate it further

rodhash commented 2 months ago

Hi

Any chance we can fix or workaround this situation without upgrading to the latest nvim nightly?

I'm having the same issue and I'm running version NVIM v0.10.0-dev-a84b454 .. while upgrading to the newest nvim nightly fix this issue it also seems to introduce a more annoying issue, it doesn't display the "horiz" line from the "fillchars" so whenever I split my screen (and I do that quite often) things get too weird.. you know, a file split but without any line between them ..

Right now I'm locking my plugin to the previous version which seems to run okay right now.. but was wondering if any fix is coming in the next versions..

  {
    "ray-x/go.nvim",
    tag = "v0.2.0",
    ...

Thanks in advance

diegoroccia commented 2 months ago

@rodhash I suggest to open a new issue, this one is closed