Skip to content

Commit 4c0221e

Browse files
committed
Only Invalidate Cancellations
1 parent 53605e4 commit 4c0221e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Sources/CodeEditSourceEditor/Highlighting/HighlighProviding/HighlightProviderState.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,13 @@ private extension HighlightProviderState {
191191
highlights: highlights,
192192
rangeToHighlight: range
193193
)
194-
case .failure:
195-
self?.invalidate(IndexSet(integersIn: range))
194+
case .failure(let error):
195+
// Only invalidate if it was cancelled.
196+
if let error = error as? HighlightProvidingError, error == .operationCancelled {
197+
self?.invalidate(IndexSet(integersIn: range))
198+
} else {
199+
self?.logger.debug("Highlighter Error: \(error.localizedDescription)")
200+
}
196201
}
197202
}
198203
}

0 commit comments

Comments
 (0)