Issafalcon / lsp-overloads.nvim

Extends the native nvim-lsp handlers to allow easier navigation through method overloads.
MIT License
97 stars 4 forks source link

Error executing vim.schedule lua callback: vim/keymap.lua:0: Shortname is too long: ic #8

Closed ambroisie closed 1 year ago

ambroisie commented 2 years ago

Just installed this plugin and went to try it out on a small project.

When I am writing the arguments to an overloaded function, I keep having this error after every argument.

Here's the traceback I get popping-up:

Error executing vim.schedule lua callback: vim/keymap.lua:0: Shortname is too long: ic                                                                                                                                                                                           
stack traceback:                                                                                                                                                                                                                                                                 
        [C]: in function 'nvim_buf_set_keymap'                                                                                                                                                                                                                                   
        vim/keymap.lua: in function 'set'                                                                                                                                                                                                                                        
        ...-overloads.nvim/lua/lsp-overloads/ui/signature_popup.lua:26: in function 'add_mapping'                                                                                                                                                                                
        .../start/lsp-overloads.nvim/lua/lsp-overloads/handlers.lua:82: in function 'add_signature_mappings'                                                                                                                                                                     
        .../start/lsp-overloads.nvim/lua/lsp-overloads/handlers.lua:174: in function 'handler'                                                                                                                                                                                   
        ...eovim-unwrapped-0.7.2/share/nvim/runtime/lua/vim/lsp.lua:1025: in function ''                                                                                                                                                                                         
        vim/_editor.lua: in function <vim/_editor.lua:0>                                                                                                                                                                                                                         
Issafalcon commented 2 years ago

Hi @ambroisie , thanks for raising an issue!

I've tried to reproduce this myself with no luck (I use the plugin daily, and haven't come across this yet). I'll admit, I have only really used it thoroughly with C# code, however.

Could you please provide answers for the following to help diagnose:

ambroisie commented 2 years ago

Hello @Issafalcon, here are the specs:

neovim --version ``` NVIM v0.7.2 Build type: Release LuaJIT 2.1.0-beta3 Compiled by nixbld Features: +acl +iconv +tui ```

I am testing in C++, using clangd (version 14.0.6), on this project. More specifically in src/bignum/bignum.cc:19-26.

The code being tested ```diff bool do_less_than(digits_type const& lhs, digits_type const& rhs) { if (lhs.size() != rhs.size()) { return lhs.size() < rhs.size(); } + std::lexicographical_compare(); + return std::lexicographical_compare(lhs.rbegin(), lhs.rend(), rhs.rbegin(), rhs.rend()); } ```

My on_attach configuration is here. I have not pushed the commit where I add this plugin, but I simply did the default configuration as described in the README.

Plug-in configuration ```diff -- Format on save if client.resolved_capabilities.document_formatting then vim.cmd([[ augroup LspFormatting autocmd! * autocmd BufWritePre lua vim.lsp.buf.formatting_sync() augroup END ]]) end + -- Signature documentation + if client.server_capabilities.signatureHelpProvider then + require('lsp-overloads').setup(client, { }) + end + -- Mappings local wk = require("which-key") ```
Issafalcon commented 2 years ago

Thanks for the info @ambroisie . This is a strange one. I can't reproduce your issue, but when I try and perform the exact steps above on the repo you posted, I get a lot of LSP warning saying:

warning: multiple different client offset_encodings detected for buffer, this is not supported yet

The clang client attaches to the buffer, but the plugin acts like it isn't even firing up when I try and trigger the lsp-overload in the particular file you mentioned (I added some logs in to see if it even triggers the handler, but it doesn't). Even when I try and run the standard built in signatureHelper request over the lexicographical_compare method, I get a message saying that No signature help is available.

Now the unusual part is, if I open the /tests/unit/bignum.cc file and I try the same thin in there, the plugin works without issues. I also still get those LSP warnings, but I would imagine they are red herrings.

I'm not very experience with C++ or the additional files in this repo, so I can't really say what's going on. I tried with another repo https://github.com/Aryan-Khanijo/Bookshop-Management-System-CPP-Project to see if I could reproduce, but the plugin functions perfectly fine for me when I'm working on this repo as well (still with the offset_encoding warnings).

I can only assume something subtle is going on with the attachment of the LSP client to the buffer, or the buffer position parameters are somehow getting messed up when the request is sent to the LSP.

I'd be interested to see if you were able to get the plugin to work with the other files like I did.

Issafalcon commented 1 year ago

Hi @ambroisie - If you get chance to corroborate my last comment, or have any additional info that might help get to the bottom of why this happens (and only seemingly with that one file) that would be great.

I'll leave this issue open for a while, but if nobody else is having the same problem, I don't think I have the expertise or the time to dig around too much into this.