Skip to content

Commit b66dfad

Browse files
committed
[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.
1 parent 8caf999 commit b66dfad

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2041,8 +2041,14 @@ void SwiftLangSupport::getCursorInfo(
20412041
fileSystem, Receiver, Offset, Actionables,
20422042
SymbolGraph](
20432043
const RequestResult<CursorInfoData> &Res) {
2044+
if (Res.isCancelled()) {
2045+
// If the AST-based result got cancelled, we don’t want to start
2046+
// solver-based cursor info anymore.
2047+
Receiver(Res);
2048+
return;
2049+
}
20442050
// AST based completion *always* produces a result
2045-
bool NoResults = Res.isError() || Res.isCancelled();
2051+
bool NoResults = Res.isError();
20462052
if (Res.isValue()) {
20472053
NoResults = Res.value().Symbols.empty();
20482054
}

0 commit comments

Comments
 (0)