ray-x / lsp_signature.nvim

LSP signature hint as you type
Apache License 2.0
2.03k stars 58 forks source link

[Error] executing vim.schedule lua callback ... lsp_signature.lua: 257 #129

Closed af-yamada closed 2 years ago

af-yamada commented 2 years ago

When I'm editing a scala program. I got a following error message.

Error executing vim.schedule lua callback: ...ck/packer/start/lsp_signature.nvim/lua/lsp_signature.lua:257: attempt to index a nil value

I'm using metals as a lsp with a version of 0.10.9. It's prone to appear editing in a quoted sentence.

ray-x commented 2 years ago

Could you share 1) The current line you trying editing 2) the function prototype

I think I may need to take care of the quote

af-yamada commented 2 years ago

Thank you for your reply.

  1. println(s" , then I got above message.
  2. the function prototype is println(x: Any): Unit
ray-x commented 2 years ago

Thanks, what s" mean? What would be the function call, is it something like println(s"hello") ?

af-yamada commented 2 years ago

Sorry for my poor explanation. It is String Interpolation in Scala. We can embed a variable into a string such as:

val name = "John" <- variable declaration println(s"Hello, $name") <- output: "Hello, John" with a new line. In the case, 's' is a preceding character showing the following string is String Interpolation.

ray-x commented 2 years ago

This is a metals bug from the log, here is the response from metals

{
    activeParameter = 0,
    activeSignature = 1,
    signatures = {{label = "s(args: Any*): String", parameters = {{label = "args: Any*"}}}}
  }

activeSignature was set to 1. The LSP spec shows the index should be 0-based. 1 will be an out of range value means NO signature available.

af-yamada commented 2 years ago

I see, zero-based indexing.

Thank you for your report and effort.

af-yamada commented 2 years ago

I think you corrected the issue. Thank you ver much.

ray-x commented 2 years ago

In fact, I am doing boundary check and try not through error when input is not correct. But glad it works for you .