Skip to content

Commit 61c3d0c

Browse files
committed
Revert "Merge pull request #1886 from ahoppen/sourcekitd-request-diagnostics"
This reverts commit 9771138, reversing changes made to 9a1c75e.
1 parent d8a8e3c commit 61c3d0c

File tree

2 files changed

+5
-47
lines changed

2 files changed

+5
-47
lines changed

Sources/SourceKitLSP/Swift/DiagnosticReportManager.swift

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -110,27 +110,11 @@ actor DiagnosticReportManager {
110110
keys.compilerArgs: compilerArgs as [SKDRequestValue],
111111
])
112112

113-
let dict: SKDResponseDictionary
114-
do {
115-
dict = try await self.sourcekitd.send(
116-
skreq,
117-
timeout: options.sourcekitdRequestTimeoutOrDefault,
118-
fileContents: snapshot.text
119-
)
120-
} catch SKDError.requestFailed(let sourcekitdError) {
121-
var errorMessage = sourcekitdError
122-
if errorMessage.hasPrefix("error response (Request Failed): error: ") {
123-
errorMessage = String(errorMessage.dropFirst(40))
124-
}
125-
return RelatedFullDocumentDiagnosticReport(items: [
126-
Diagnostic(
127-
range: Position(line: 0, utf16index: 0)..<Position(line: 0, utf16index: 0),
128-
severity: .error,
129-
source: "SourceKit",
130-
message: "Internal SourceKit error: \(errorMessage)"
131-
)
132-
])
133-
}
113+
let dict = try await self.sourcekitd.send(
114+
skreq,
115+
timeout: options.sourcekitdRequestTimeoutOrDefault,
116+
fileContents: snapshot.text
117+
)
134118

135119
try Task.checkCancellation()
136120

Tests/SourceKitLSPTests/PullDiagnosticsTests.swift

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -405,30 +405,4 @@ final class PullDiagnosticsTests: XCTestCase {
405405
let note = try XCTUnwrap(diagnostic.relatedInformation?.only)
406406
XCTAssertEqual(note.location, try project.location(from: "1️⃣", to: "1️⃣", in: "FileA.swift"))
407407
}
408-
409-
func testDiagnosticsFromSourcekitdRequestError() async throws {
410-
let project = try await MultiFileTestProject(
411-
files: [
412-
"test.swift": """
413-
func test() {}
414-
""",
415-
"compile_flags.txt": "-invalid-argument",
416-
]
417-
)
418-
let (uri, _) = try project.openDocument("test.swift")
419-
let diagnostics = try await project.testClient.send(
420-
DocumentDiagnosticsRequest(textDocument: TextDocumentIdentifier(uri))
421-
)
422-
XCTAssertEqual(
423-
diagnostics.fullReport?.items,
424-
[
425-
Diagnostic(
426-
range: Range(Position(line: 0, utf16index: 0)),
427-
severity: .error,
428-
source: "SourceKit",
429-
message: "Internal SourceKit error: unknown argument: '-invalid-argument'"
430-
)
431-
]
432-
)
433-
}
434408
}

0 commit comments

Comments
 (0)