You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got nerd-sniped over the weekend while playing around with the language server. Saving my findings here for later.
Some LSP requests like document link, document symbol, and code lens are made automatically by the editor as a document is edited. They do appear to be debounced (at least in vscode), but the delay is shorter than ours, so these requests are often processed before the AST has been re-compiled. I have seen the document links fall out of sync for this reason.
I would like to make these LSP requests wait for the delayed update if it exists, since the change event always seems to arrive first. Something like this:
on didChange, trigger a delayed update and set an "awaiting update" flag to true
on document link/symbol request, if "awaiting update" is true, wait on an "updated" condition variable
on update, signal the "updated" condition variable, unblocking all relevant LSP requests
The problem I'm seeing is the lock associated with the condition. If the requests need to acquire the lock in order to wait on the condition variable, then the update thread can't acquire that lock to signal the condition variable. Maybe I need to use a read-write lock to handle this.
The text was updated successfully, but these errors were encountered:
I got nerd-sniped over the weekend while playing around with the language server. Saving my findings here for later.
Some LSP requests like document link, document symbol, and code lens are made automatically by the editor as a document is edited. They do appear to be debounced (at least in vscode), but the delay is shorter than ours, so these requests are often processed before the AST has been re-compiled. I have seen the document links fall out of sync for this reason.
I would like to make these LSP requests wait for the delayed update if it exists, since the change event always seems to arrive first. Something like this:
The problem I'm seeing is the lock associated with the condition. If the requests need to acquire the lock in order to wait on the condition variable, then the update thread can't acquire that lock to signal the condition variable. Maybe I need to use a read-write lock to handle this.
The text was updated successfully, but these errors were encountered: