From 2137056646743e7448ebb9bb5ae0fb1a5f0fcdec Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Thu, 4 Apr 2024 10:07:26 -0700 Subject: [PATCH] Adjustment for the removal of `IncrementalEdit(offset:length:replacement:)` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This initializer was only introduced very recently since `IncrementalEdit` stores the replacement bytes instead of just the replacement length. We are now changing `IncrementalEdit` store the range it’s replacing as `Range` instead of `ByteSourceRange`. Companion of https://github.com/apple/swift-syntax/pull/2588 --- Sources/SourceKitLSP/Swift/DocumentFormatting.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sources/SourceKitLSP/Swift/DocumentFormatting.swift b/Sources/SourceKitLSP/Swift/DocumentFormatting.swift index d4af05157..9987ebcc8 100644 --- a/Sources/SourceKitLSP/Swift/DocumentFormatting.swift +++ b/Sources/SourceKitLSP/Swift/DocumentFormatting.swift @@ -105,9 +105,11 @@ private func edits(from original: DocumentSnapshot, to edited: String) -> [TextE let sequentialEdits = difference.map { change in switch change { case .insert(offset: let offset, element: let element, associatedWith: _): - IncrementalEdit(offset: offset, length: 0, replacement: [element]) + let absolutePosition = AbsolutePosition(utf8Offset: offset) + return IncrementalEdit(range: absolutePosition..