forked from qt-creator/qt-creator
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:
@@ -137,13 +137,13 @@ static TextDocumentPositionParams generateDocPosParams(TextEditor::TextDocument
|
||||
return TextDocumentPositionParams(documentId, pos);
|
||||
}
|
||||
|
||||
void SymbolSupport::findLinkAt(TextEditor::TextDocument *document,
|
||||
const QTextCursor &cursor,
|
||||
Utils::LinkHandler callback,
|
||||
const bool resolveTarget)
|
||||
MessageId SymbolSupport::findLinkAt(TextEditor::TextDocument *document,
|
||||
const QTextCursor &cursor,
|
||||
Utils::LinkHandler callback,
|
||||
const bool resolveTarget)
|
||||
{
|
||||
if (!m_client->reachable())
|
||||
return;
|
||||
return {};
|
||||
GotoDefinitionRequest request(generateDocPosParams(document, cursor, m_client));
|
||||
std::optional<Utils::Link> linkUnderCursor;
|
||||
if (!resolveTarget) {
|
||||
@@ -165,6 +165,7 @@ void SymbolSupport::findLinkAt(TextEditor::TextDocument *document,
|
||||
request,
|
||||
m_client->dynamicCapabilities(),
|
||||
m_client->capabilities());
|
||||
return request.id();
|
||||
}
|
||||
|
||||
bool SymbolSupport::supportsFindUsages(TextEditor::TextDocument *document) const
|
||||
|
||||
Reference in New Issue
Block a user