ojroques / nvim-lspfuzzy

A Neovim plugin to make the LSP client use FZF
BSD 2-Clause "Simplified" License
316 stars 11 forks source link

Error expected table, got number when doing vim.lsp.buf.declaration #14

Closed petejodo closed 3 years ago

petejodo commented 3 years ago

I'm a bit new to lua configuration but this is about as far as I got...

My setup is basic e.g. require('lspfuzzy').setup {} and when running vim.lsp.buf.declaration() is giving me this error. The result parameter in the returned handler in make_location_handler is of type number for some reason :man_shrugging:

local debug = require("debug")                                                                                                                     
xpcall(function() vim.lsp.buf.declaration() end, function() print(debug.traceback()) end)
EOF
stack traceback:
^I[string ":lua"]:2: in function <[string ":lua"]:2>
^I[C]: in function 'assert'
^Ivim/shared.lua:199: in function 'tbl_isempty'
^I...im/site/pack/packer/start/nvim-lspfuzzy/lua/lspfuzzy.lua:135: in function 'handler' <-------------
^I/usr/share/nvim/runtime/lua/vim/lsp.lua:1276: in function 'request'
^I/usr/share/nvim/runtime/lua/vim/lsp/buf.lua:69: in function 'declaration'
^I[string ":lua"]:2: in function <[string ":lua"]:2>
^I[C]: in function 'xpcall'
^I[string ":lua"]:2: in main chunk
ojroques commented 3 years ago

Yes it happens when the language server has no support for declarations which is the case here.

The error message is not very helpful I agree, I will change it asap.

ojroques commented 3 years ago

I've added a wrapper for handlers that catch errors and print their messages.

petejodo commented 3 years ago

Awesome, thanks for the quick response