LanguageClient: cancel find link at requests on rerequest

This avoids triggering the callback if we already requested a find link
at for a different position. Additionally we also cancel the request if
the document changes or the cursor moves inbetween requesting the link
and receiving the response.

Change-Id: Iffc7b08012a649397e7ca7dfc99d314a1bbf19f7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2023-08-08 15:30:55 +02:00
parent 098ddf11e8
commit a137f2b23d
5 changed files with 37 additions and 7 deletions

View File

@@ -463,7 +463,7 @@ void LanguageClientManager::editorOpened(Core::IEditor *editor)
[document = textEditor->textDocument()]
(const QTextCursor &cursor, const Utils::LinkHandler &callback, bool resolveTarget) {
if (auto client = clientForDocument(document))
client->symbolSupport().findLinkAt(document, cursor, callback, resolveTarget);
client->findLinkAt(document, cursor, callback, resolveTarget);
});
connect(widget, &TextEditorWidget::requestUsages, this,
[document = textEditor->textDocument()](const QTextCursor &cursor) {