File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
Sources/SourceKitLSP/Swift Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -888,12 +888,15 @@ extension SwiftLanguageService {
888
888
buildSettings: buildSettings
889
889
)
890
890
return . full( diagnosticReport)
891
- } catch let error as CancellationError {
892
- throw error
893
891
} catch {
894
892
// VS Code does not request diagnostics again for a document if the diagnostics request failed.
895
893
// Since sourcekit-lsp usually recovers from failures (e.g. after sourcekitd crashes), this is undesirable.
896
894
// Instead of returning an error, return empty results.
895
+ // Do forward cancellation because we don't want to clear diagnostics in the client if they cancel the diagnostic
896
+ // request.
897
+ if ResponseError ( error) == . cancelled {
898
+ throw error
899
+ }
897
900
logger. error (
898
901
"""
899
902
Loading diagnostic failed with the following error. Returning empty diagnostics.
Original file line number Diff line number Diff line change @@ -337,7 +337,7 @@ final class PullDiagnosticsTests: XCTestCase {
337
337
let requestID = project. testClient. send (
338
338
DocumentDiagnosticsRequest ( textDocument: TextDocumentIdentifier ( uri) )
339
339
) { result in
340
- XCTAssertEqual ( result. failure ? . code , . cancelled)
340
+ XCTAssertEqual ( result, . failure ( ResponseError . cancelled) )
341
341
diagnosticResponseReceived. fulfill ( )
342
342
}
343
343
project. testClient. send ( CancelRequestNotification ( id: requestID) )
You can’t perform that action at this time.
0 commit comments