[SourceKit] When AST-based cursor info is cancelled, don’t run solver-based cursor info

Running solver-based cursor info in the callback that is informed about cancellation extends the window for a deadlock.
This commit is contained in:
Alex Hoppen
2023-06-22 21:29:08 +02:00
parent 8caf9997c9
commit b66dfadea5

View File

@@ -2041,8 +2041,14 @@ void SwiftLangSupport::getCursorInfo(
fileSystem, Receiver, Offset, Actionables,
SymbolGraph](
const RequestResult<CursorInfoData> &Res) {
if (Res.isCancelled()) {
// If the AST-based result got cancelled, we dont want to start
// solver-based cursor info anymore.
Receiver(Res);
return;
}
// AST based completion *always* produces a result
bool NoResults = Res.isError() || Res.isCancelled();
bool NoResults = Res.isError();
if (Res.isValue()) {
NoResults = Res.value().Symbols.empty();
}