Fix slowdown due to locking the main thread when sending text buffer changes to the LSP.

This commit is contained in:
Martín Lucas Golini
2025-08-14 00:17:16 -03:00
parent 461030d6b3
commit 929b38410b
6 changed files with 45 additions and 23 deletions

View File

@@ -70,8 +70,7 @@ void LSPDocumentClient::onDocumentTextChanged( const DocumentContentChange& chan
++mVersion;
// If several change event are being fired, the thread pool can't guaranteed that it will be
// executed in FIFO. Se we accumulate the events in a queue and fire them in correct order.
mServer->queueDidChange( mDoc->getURI(), mVersion, "", { change } );
mServer->getThreadPool()->run( [this, change]() { mServer->processDidChangeQueue(); } );
mServer->queueAndProcess( mDoc->getURI(), mVersion, { change } );
requestSymbolsDelayed();
requestSemanticHighlightingDelayed();
}