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

@@ -149,6 +149,13 @@ public:
void addAssistProcessor(TextEditor::IAssistProcessor *processor);
void removeAssistProcessor(TextEditor::IAssistProcessor *processor);
SymbolSupport &symbolSupport();
// In contrast to the findLinkAt of symbol support this find link makes sure that there is only
// one request running at a time and cancels the running request if the document changes, cursor
// moves or another link is requested
void findLinkAt(TextEditor::TextDocument *document,
const QTextCursor &cursor,
Utils::LinkHandler callback,
const bool resolveTarget);
DocumentSymbolCache *documentSymbolCache();
HoverHandler *hoverHandler();
QList<LanguageServerProtocol::Diagnostic> diagnosticsAt(const Utils::FilePath &filePath,