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

Need help in understanding on_attach vs setup config #341

Open
sbushmanov opened this issue Sep 13, 2024 · 3 comments
Open

Need help in understanding on_attach vs setup config #341

sbushmanov opened this issue Sep 13, 2024 · 3 comments

Comments

@sbushmanov
Copy link

sbushmanov commented Sep 13, 2024

I've setup lsp_signature with the following in my lsp_signature.lua (lazy):

return {
  "ray-x/lsp_signature.nvim",
  event = "LspAttach",
  lazy = true,
  config = function()
    require("lsp_signature").setup {
      hint_enable = true
    }
  end
}

However, this doesn't work at all.

After a bit of experimenting I succeeded in showing up signature help (still without a panda) with the following:

return {
  "ray-x/lsp_signature.nvim",
  event = "LspAttach",
  lazy = true,
  config = function()
    require("lsp_signature").on_attach {
      hint_enable = true
    }
  end
}

Can somebody please guide me on the proper way on setting up the plugin (lazy) and explaining the difference between the 2?

@ray-x
Copy link
Owner

ray-x commented Sep 15, 2024

With latest lazy.nvim
You should be able to use

{
    'ray-x/lsp_signature.nvim',
    event = { 'InsertEnter' },
    opts = {
      ...
    }
  }

@sbushmanov
Copy link
Author

sbushmanov commented Sep 15, 2024

Sorry, does't work with the suggested setup.

And even when I tried to restore the previous setup that used to work Im getting:

Error detected while processing CursorHold Autocommands for "<buffer=1>":
Error executing lua callback: ...vim/lazy/lsp_signature.nvim/lua/lsp_signature/helper.lua:756: attempt to c
all field 'empty' (a nil value)
stack traceback:
        ...vim/lazy/lsp_signature.nvim/lua/lsp_signature/helper.lua:756: in function 'check_lsp_cap'
        .../nvim/lazy/lsp_signature.nvim/lua/lsp_signature/init.lua:669: in function 'signature'
        .../nvim/lazy/lsp_signature.nvim/lua/lsp_signature/init.lua:907: in function 'on_UpdateSignature'
        ...vim/lazy/lsp_signature.nvim/lua/lsp_signature/helper.lua:28: in function <...vim/lazy/lsp_signat
ure.nvim/lua/lsp_signature/helper.lua:27>
Press ENTER or type command to continue

And even though lua vim.lsp.buf.signature_help() does produces signature (accompanied with some error messages) lua require'lsp_signature'.signature() only produces error message

@ray-x
Copy link
Owner

ray-x commented Sep 16, 2024

The error you saw was fixed.
Also, use the attach method making sure the setup is after lsp_config.

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