forked from qt-creator/qt-creator
LanguageClient: Make sure to run callback in all code paths
... when receiving a reply for textDocument/definition. Change-Id: I08f3a22f7c39a33b7b84539125a76d0c0d625692 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -506,9 +506,6 @@ void ClangdTestLocalReferences::test()
|
|||||||
client()->findLocalUsages(doc, cursor, std::move(handler));
|
client()->findLocalUsages(doc, cursor, std::move(handler));
|
||||||
timer.start(10000);
|
timer.start(10000);
|
||||||
loop.exec();
|
loop.exec();
|
||||||
QEXPECT_FAIL("cursor not on identifier", "clangd bug: go to definition does not return", Abort);
|
|
||||||
QEXPECT_FAIL("template parameter member access",
|
|
||||||
"clangd bug: go to definition does not return", Abort);
|
|
||||||
QVERIFY(timer.isActive());
|
QVERIFY(timer.isActive());
|
||||||
timer.stop();
|
timer.stop();
|
||||||
|
|
||||||
|
@@ -78,14 +78,18 @@ static void handleGotoDefinitionResponse(const GotoDefinitionRequest::Response &
|
|||||||
{
|
{
|
||||||
if (Utils::optional<GotoResult> _result = response.result()) {
|
if (Utils::optional<GotoResult> _result = response.result()) {
|
||||||
const GotoResult result = _result.value();
|
const GotoResult result = _result.value();
|
||||||
if (Utils::holds_alternative<std::nullptr_t>(result))
|
if (Utils::holds_alternative<std::nullptr_t>(result)) {
|
||||||
return;
|
callback({});
|
||||||
if (auto ploc = Utils::get_if<Location>(&result)) {
|
} else if (auto ploc = Utils::get_if<Location>(&result)) {
|
||||||
callback(linkUnderCursor.value_or(ploc->toLink()));
|
callback(linkUnderCursor.value_or(ploc->toLink()));
|
||||||
} else if (auto plloc = Utils::get_if<QList<Location>>(&result)) {
|
} else if (auto plloc = Utils::get_if<QList<Location>>(&result)) {
|
||||||
if (!plloc->isEmpty())
|
if (!plloc->isEmpty())
|
||||||
callback(linkUnderCursor.value_or(plloc->value(0).toLink()));
|
callback(linkUnderCursor.value_or(plloc->value(0).toLink()));
|
||||||
|
else
|
||||||
|
callback({});
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
callback({});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user