Skip to content

Commit 909eea8

Browse files
committed
[SourceKit] Only verify the solver-based cursor info implementation if requested
This allows us to mark expected deviations between the AST-based and the solver-based implementation in the stress tester as XFails without breaking actual clients We always verify if a cursor info request is issued through `sourcekitd-test`.
1 parent 58aaa4f commit 909eea8

File tree

6 files changed

+10
-1
lines changed

6 files changed

+10
-1
lines changed

tools/SourceKit/include/SourceKit/Core/LangSupport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,7 @@ class LangSupport {
938938
bool SymbolGraph, bool CancelOnSubsequentRequest,
939939
ArrayRef<const char *> Args, Optional<VFSOptions> vfsOptions,
940940
SourceKitCancellationToken CancellationToken,
941+
bool VerifySolverBasedCursorInfo,
941942
std::function<void(const RequestResult<CursorInfoData> &)> Receiver) = 0;
942943

943944
virtual void

tools/SourceKit/lib/SwiftLang/SwiftLangSupport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,7 @@ class SwiftLangSupport : public LangSupport {
627627
ArrayRef<const char *> Args,
628628
Optional<VFSOptions> vfsOptions,
629629
SourceKitCancellationToken CancellationToken,
630+
bool VerifySolverBasedCursorInfo,
630631
std::function<void(const RequestResult<CursorInfoData> &)>
631632
Receiver) override;
632633

tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,6 +1885,7 @@ void SwiftLangSupport::getCursorInfo(
18851885
bool SymbolGraph, bool CancelOnSubsequentRequest,
18861886
ArrayRef<const char *> Args, Optional<VFSOptions> vfsOptions,
18871887
SourceKitCancellationToken CancellationToken,
1888+
bool VerifySolverBasedCursorInfo,
18881889
std::function<void(const RequestResult<CursorInfoData> &)> Receiver) {
18891890

18901891
std::string error;

tools/SourceKit/tools/sourcekitd-test/sourcekitd-test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,8 @@ static int handleTestInvocation(TestOptions Opts, TestOptions &InitOpts) {
770770
} else {
771771
sourcekitd_request_dictionary_set_int64(Req, KeyOffset, ByteOffset);
772772
}
773+
sourcekitd_request_dictionary_set_int64(Req, KeyVerifySolverBasedCursorInfo,
774+
true);
773775
addRequestOptionsDirect(Req, Opts);
774776
break;
775777
case SourceKitRequest::RangeInfo: {

tools/SourceKit/tools/sourcekitd/lib/Service/Requests.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1128,10 +1128,13 @@ static void handleSemanticRequest(
11281128
Req.getInt64(KeyRetrieveRefactorActions, Actionables, /*isOptional=*/true);
11291129
int64_t SymbolGraph = false;
11301130
Req.getInt64(KeyRetrieveSymbolGraph, SymbolGraph, /*isOptional=*/true);
1131+
int64_t VerifySolverBasedCursorInfo = false;
1132+
Req.getInt64(KeyVerifySolverBasedCursorInfo, VerifySolverBasedCursorInfo,
1133+
/*isOptional=*/true);
11311134
return Lang.getCursorInfo(
11321135
*SourceFile, Offset, Length, Actionables, SymbolGraph,
11331136
CancelOnSubsequentRequest, Args, std::move(vfsOptions),
1134-
CancellationToken,
1137+
CancellationToken, VerifySolverBasedCursorInfo,
11351138
[Rec](const RequestResult<CursorInfoData> &Result) {
11361139
reportCursorInfo(Result, Rec);
11371140
});

utils/gyb_sourcekit_support/UIDs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ def __init__(self, internal_name, external_name):
189189
KEY('OptimizeForIDE', 'key.optimize_for_ide'),
190190
KEY('RequiredBystanders', 'key.required_bystanders'),
191191
KEY('ReusingASTContext', 'key.reusingastcontext'),
192+
KEY('VerifySolverBasedCursorInfo', 'key.verifysolverbasedcursorinfo'),
192193
KEY('CompletionMaxASTContextReuseCount',
193194
'key.completion_max_astcontext_reuse_count'),
194195
KEY('CompletionCheckDependencyInterval',

0 commit comments

Comments
 (0)