lsp_signature.nvim
lsp_signature.nvim copied to clipboard
Can't get it working on LunarVim
Hi,
I have a fresh install of LunarVim. I've then tried to install this plugin as per LunarVim's documentation but I can't get it working. Following your issue I've arrived to the lua vim.lsp.buf.signature_help()
command which does indeed work but I can't seem to get it working while I type no matter what.
I've tried changing the configuration from on_attach
to setup
but I got still no luck.
Do you have any idea on what I can try/look at?
Thank you.
Based on the LunarVim doc, it should be something like this:
config = function()
cfg = {...} -- add you config here
require "lsp_signature".setup(cfg)
end
Hi @ray-x, many thanks for your quick reply.
This is how I have it configured right now but it does not work:
-- Additional Plugins
lvim.plugins = {
{
"ray-x/lsp_signature.nvim",
event = "BufRead",
config = function()
require "lsp_signature".setup({})
end
}
}
I feel like something fundamental is skipping me as it seems very obvious it should just work but it doesn't 😞
Do you have lspconfig enabled? Is it running correctly. You can check LspInfo from command line.
Also you can add some logs to see if require "lsp_signature".setup({})
is called.
@carlosV2 The only thing I have in my config is this:
require 'nvim-lsp-installer'.setup() -- For some reason seems like LunarVim is NOT doing that and it's needed?
local custom_on_attach = function(client, bufnr)
require 'lvim.lsp'.common_on_attach(client, bufnr)
require 'lsp_signature'.on_attach(client, bufnr)
end
local servers = require 'nvim-lsp-installer'.get_installed_servers()
for _, server in ipairs(servers) do
require 'lspconfig'[server.name].setup{ on_attach = custom_on_attach }
end
I didn't even need to call setup
on lsp_signature
and it works fine.
Here's my whole config if you want it. There's nothing more interesting than what I showed above, tho.
I'm using lunarvim and this 👇 is the config that I got that works
lvim.plugins = {
{
"ray-x/lsp_signature.nvim",
config = function()
require"lsp_signature".setup({
-- …
})
end,
},
-- …
}
-- …
lvim.lsp.on_attach_callback = function(client, bufnr)
-- …
require"lsp_signature".on_attach()
-- …
end
Boom! It works! Thanks so much @FelipeLema!
Also, thanks @B4mbus and @ray-x 😃
@FelipeLema that's good but I think you should be sending client and bufnr to lsp_signature's on_attach
.
Instructions in the README state that one should use setup{ ... }
and on_attach()
and that, as second choice, use just on_attach( { ... }, bufnr )
.
Unless I'm missing something else
I can't get lsp_signature to work with the suggested config on LunarVim's Extra Plugins. Trying the config from @FelipeLema I get a module 'lsp_signature' not found error.
Error executing vim.schedule lua callback: /home/.../.config/lvim/config.lua:255: module 'lsp_signature' not found:
no field package.preload['lsp_signature']
no file './lsp_signature.lua'
no file '/home/runner/work/neovim/neovim/.deps/usr/share/luajit-2.1.0-beta3/lsp_signature.lua'
...
look like the packer did not load lsp_signature in your case.
did you run PackerSync
after adding use "ray-x/lsp_signature"
?