Open S4deghN opened 8 months ago
I wanted to add that syntax highlighting on small projects doesn't introduce any discernible lag. And that I also tested the same project with a minimal neovim with native lsp config to see if it's a clangd issue but neovim didn't have any problem with syntax highlighting.
I tried debugging this as I was experiencing that myself. It looks to me that on many changes, e.g. when "dd" is spammed, the synchronous server calls cannot keep up and block for a longer period. I fixed it on my side by making the call at lspserver.vim#L564 asynchronous and calling "UpdateTokens" in the callback. I am not sure if this is a good solution as I am not aware of the reason for a synchronous call in the first place (maybe just to prevent race conditions?).
@MisterSnuvi could you provide they way you fixed this? I tried making it asynchronous, but results using my solution were mixed, so I still keep semantic highlighting off.
@eithrial I changed the lines from lspserver.vim#564 to 568 to
564 │ lspserver.rpc_a(method, params, (_, reply) => {
565 │ if reply->empty()
566 │ return
567 │ endif
568 │ semantichighlight.UpdateTokens(lspserver, bnr, reply)
569 │ })
It's not perfectly stable with this but the lags are mostly gone.
@eithrial I changed the lines from lspserver.vim#564 to 568 to
564 │ lspserver.rpc_a(method, params, (_, reply) => { 565 │ if reply->empty() 566 │ return 567 │ endif 568 │ semantichighlight.UpdateTokens(lspserver, bnr, reply) 569 │ })
It's not perfectly stable with this but the lags are mostly gone.
I want to confirm that this diminishes the lag for me too, but it's not all gone.
takes seconds to delete a line or undo it same for loading buffers. just disabling
semanticHighlight
make everything snappy. any idea what's the issue?this is my config for reference: