Skip to content

Revert "[SourceKit] Don't build an AST if no semantic info is requested" #40491

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/SourceKit/CodeExpand/code-expand-rdar77665805.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ func test() {

// RUN: %sourcekitd-test \
// RUN: -req=open %s -- %s == \
// RUN: -req=edit -offset=0 -length=53 -replace="" -req-opts=enablesyntaxmap=0,enablesubstructure=0,enablediagnostics=0 -dont-print-response %s -- %s == \
// RUN: -req=edit -offset=0 -length=53 -replace="" -req-opts=enablesyntaxmap=0,enablesubstructure=0,enablediagnostics=0 %s -- %s == \
// RUN: -req=expand-placeholder -offset=23 -length=18 %s \
// RUN: | %FileCheck %s

Expand Down
2 changes: 1 addition & 1 deletion test/SourceKit/CursorInfo/cursor_after_edit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
// buffer to calculate line and column (before rdar://78161348).
// RUN: %sourcekitd-test \
// RUN: -req=open -text-input %t/empty.swift %t/func.swift -- %t/func.swift == \
// RUN: -req=edit -offset=0 -length=0 -replace="func foo() {}" -req-opts=enablesyntaxmap=0,enablesubstructure=0,enablediagnostics=0 -dont-print-response %t/func.swift -- %t/func.swift == \
// RUN: -req=edit -offset=0 -length=0 -replace="func foo() {}" -req-opts=enablesyntaxmap=0,enablesubstructure=0,enablediagnostics=0 %t/func.swift -- %t/func.swift == \
// RUN: -req=cursor -offset=5 %t/func.swift -- %t/func.swift
6 changes: 3 additions & 3 deletions test/SourceKit/Sema/edit_nowait.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
// EDIT_NOWAIT-NEXT: }

// RUN: %sourcekitd-test \
// RUN: -req=open -req-opts=enablesyntaxmap=0,enablesubstructure=1,enablediagnostics=0 %t/t.swift -- %t/t.swift == \
// RUN: -req=open -req-opts=enablesyntaxmap=0,enablesubstructure=0,enablediagnostics=0 %t/t.swift -- %t/t.swift == \
// RUN: -req=print-annotations %t/t.swift == \
// RUN: -req=edit -offset=0 -replace="func foo() { warn("") }" -length=16 -req-opts=enablesyntaxmap=0,enablesubstructure=1,enablediagnostics=0 %t/t.swift == \
// RUN: -req=edit -offset=13 -replace="print" -length=4 -req-opts=enablesyntaxmap=0,enablesubstructure=1,enablediagnostics=0 %t/t.swift == \
// RUN: -req=edit -offset=0 -replace="func foo() { warn("") }" -length=16 -req-opts=enablesyntaxmap=0,enablesubstructure=0,enablediagnostics=0 %t/t.swift == \
// RUN: -req=edit -offset=13 -replace="print" -length=4 -req-opts=enablesyntaxmap=0,enablesubstructure=0,enablediagnostics=0 %t/t.swift == \
// RUN: -req=print-annotations %t/t.swift \
// RUN: | %FileCheck --check-prefix=ANNOTATION %s

Expand Down
13 changes: 1 addition & 12 deletions tools/SourceKit/tools/sourcekitd/lib/API/Requests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2664,18 +2664,7 @@ class SKEditorConsumer : public EditorConsumer {
sourcekitd_response_t createResponse();

bool needsSemanticInfo() override {
if (Opts.SyntacticOnly) {
return false;
} else if (isSemanticEditorDisabled()) {
return false;
} else if (!documentStructureEnabled() &&
!syntaxMapEnabled() &&
!diagnosticsEnabled() &&
!syntaxTreeEnabled()) {
return false;
} else {
return true;
}
return !Opts.SyntacticOnly && !isSemanticEditorDisabled();
}

void handleRequestError(const char *Description) override;
Expand Down