Skip to content

Commit 95ce3d6

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 c95d3e2 commit 95ce3d6

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
@@ -2039,8 +2039,14 @@ void SwiftLangSupport::getCursorInfo(
20392039
fileSystem, Receiver, Offset, Actionables,
20402040
SymbolGraph](
20412041
const RequestResult<CursorInfoData> &Res) {
2042+
if (Res.isCancelled()) {
2043+
// If the AST-based result got cancelled, we don’t want to start
2044+
// solver-based cursor info anymore.
2045+
Receiver(Res);
2046+
return;
2047+
}
20422048
// AST based completion *always* produces a result
2043-
bool NoResults = Res.isError() || Res.isCancelled();
2049+
bool NoResults = Res.isError();
20442050
if (Res.isValue()) {
20452051
NoResults = Res.value().Symbols.empty();
20462052
}

0 commit comments

Comments
 (0)