lsp_signature.nvim icon indicating copy to clipboard operation
lsp_signature.nvim copied to clipboard

Can't get it working on LunarVim

Open carlosV2 opened this issue 1 year ago • 11 comments

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.

carlosV2 avatar Jul 19 '22 09:07 carlosV2

Based on the LunarVim doc, it should be something like this:

config = function() 
  cfg = {...}  -- add you config here
  require "lsp_signature".setup(cfg)
end

ray-x avatar Jul 19 '22 10:07 ray-x

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 😞

carlosV2 avatar Jul 19 '22 10:07 carlosV2

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.

ray-x avatar Jul 19 '22 11:07 ray-x

@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.

Dich0tomy avatar Jul 19 '22 12:07 Dich0tomy

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

FelipeLema avatar Jul 20 '22 16:07 FelipeLema

Boom! It works! Thanks so much @FelipeLema!

Also, thanks @B4mbus and @ray-x 😃

carlosV2 avatar Jul 21 '22 08:07 carlosV2

@FelipeLema that's good but I think you should be sending client and bufnr to lsp_signature's on_attach.

Dich0tomy avatar Jul 21 '22 15:07 Dich0tomy

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

FelipeLema avatar Jul 21 '22 16:07 FelipeLema

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'
        ...

abers avatar Oct 30 '22 00:10 abers

look like the packer did not load lsp_signature in your case.

ray-x avatar Oct 30 '22 03:10 ray-x

did you run PackerSync after adding use "ray-x/lsp_signature"?

FelipeLema avatar Nov 02 '22 12:11 FelipeLema