ray-x / lsp_signature.nvim

LSP signature hint as you type
Apache License 2.0
2.01k stars 56 forks source link

textDocument/signatureHelp received after LSP exit #258

Open kting28 opened 1 year ago

kting28 commented 1 year ago

With lsp_signature enabled with clangd, I frequently get these error messages printed on the console:

RPC[Error] code_name = UnknownErrorCode, message = “Failed to parse includes”

After some investigations it seems to be related to LSP exiting before the signature query reply is sent back. Sample steps:

  1. Open a file with LSP is enabled and wait for parsing to start
  2. Exit the editor
  3. Some RPC[Error] messages are printed on the console. From the lsp.log, these seems to be received (or sent?) after the LSP has exited.

For example in the log below, you can see LSP has finished then next line the RPC error is received and printed on stderr

[ERROR][2023-02-20 20:19:36] .../vim/lsp/rpc.lua:733    "rpc"   "clangd"    "stderr"    'V[20:19:36.934] <<< {"jsonrpc":"2.0","method":"exit"}\n\nI[20:19:36.934] <-- exit\nI[20:19:36.934] LSP finished, exiting with status 0\n'
[ERROR][2023-02-20 20:19:36] .../vim/lsp/rpc.lua:733    "rpc"   "clangd"    "stderr"    'I[20:19:36.934] --> reply:textDocument/signatureHelp(4) 3165 ms, error: Failed to parse includes\nV[20:19:36.934] >>> {"error":{"code":-32001,"message":"Failed to parse includes"},"id":4,"jsonrpc":"2.0"}\n\n'
[DEBUG][2023-02-20 20:19:36] .../vim/lsp/rpc.lua:388    "rpc.receive"   {  error = {    code = -32001,    message = "Failed to parse includes"  },  id = 4,  jsonrpc = "2.0"}
[ERROR][2023-02-20 20:19:36] .../vim/lsp/rpc.lua:733    "rpc"   "clangd"    "stderr"    "V[20:19:36.936] ASTWorker rebuilding evicted AST to run DocumentSymbols: <--redacted path to file--> version 0\n"

This is a minor issue as the message are only printed on exit but it's quite annoying. Anyway to supress?

kting28 commented 1 year ago

btw I don't seem to see the same issue with other signature help plugins such as cmp-nvim-lsp-signature-help. Is this related to the "async" signature requests this plugin is design to do? I.e. LSP is stopped while there are outstanding queries?

ray-x commented 1 year ago

Do you mean when you quit nvim you saw RPC[Error] code_name = UnknownErrorCode, message = “Failed to parse includes” ?

kting28 commented 1 year ago

Do you mean when you quit nvim you saw RPC[Error] code_name = UnknownErrorCode, message = “Failed to parse includes” ?

Yup. It's not consistent but for larger files I see multiple lines of these. Does not happen if I waited long enough after opening a file; probably after all queries are made?

ray-x commented 1 year ago

Ok, I think it is related to the async request I sent. But I have not seen the same issue so far. Might be also because the clangd is slow or your project is large. How you exit your nvim? Do you have a keybind or you do :wq from cmdline? More specifically, are you exit Insert mode before you exit?

kting28 commented 1 year ago

Yea the project is plenty large. It takes 10 seconds to index from scratch and a few more for diagnostics to be loaded in plugins like Trouble.

I have only tried :q , not from insert, was just inspecting the files. If I stay in the file for a while the chance of seeing these are less.

On Mon, Feb 20, 2023, 11:07 PM rayx @.***> wrote:

Ok, I think it is related to the async request I sent. But I have not seen the same issue so far. Might be also because the clangd is slow or your project is large. How you exit your nvim? Do you have a keybind or you do :wq from cmdline? More specifically, are you exit Insert mode before you exit?

— Reply to this email directly, view it on GitHub https://github.com/ray-x/lsp_signature.nvim/issues/258#issuecomment-1437955832, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF2RAXA6DQLYTLP3HUSGAO3WYRSRVANCNFSM6AAAAAAVCSOFCE . You are receiving this because you authored the thread.Message ID: @.***>