@@ -141,10 +141,10 @@ public final class DocumentManager {
141
141
/// - newVersion: The new version of the document. Must be greater than the
142
142
/// latest version of the document.
143
143
/// - edits: The edits to apply to the document
144
- /// - requiresUpcomingEdits: Flag to return upcoming editst. Will be
145
- /// calling ``willEditDocument`` for each edit made
146
- /// - Returns: The snapshot of the document before the edit and the snapshot
147
- /// of the document after the edit, including all edits that were made .
144
+ /// - Returns: The snapshot of the document before the edit, the snapshot, and edits.
145
+ /// The edits are sequential, ie. the edits are
146
+ /// expected to be applied in order and later values in this array assume that
147
+ /// previous edits are already applied .
148
148
@discardableResult
149
149
public func edit(
150
150
_ uri: DocumentURI ,
@@ -157,9 +157,9 @@ public final class DocumentManager {
157
157
}
158
158
let preEditSnapshot = document. latestSnapshot
159
159
160
- var upcomingEdits : [ SourceEdit ] = [ ]
160
+ var sourceEdits : [ SourceEdit ] = [ ]
161
161
for edit in edits {
162
- upcomingEdits . append ( SourceEdit ( edit: edit, lineTableBeforeEdit: document. latestLineTable) )
162
+ sourceEdits . append ( SourceEdit ( edit: edit, lineTableBeforeEdit: document. latestLineTable) )
163
163
164
164
if let range = edit. range {
165
165
document. latestLineTable. replace (
@@ -179,7 +179,7 @@ public final class DocumentManager {
179
179
logger. error ( " Document version did not increase on edit from \( document. latestVersion) to \( newVersion) " )
180
180
}
181
181
document. latestVersion = newVersion
182
- return ( preEditSnapshot, document. latestSnapshot, upcomingEdits )
182
+ return ( preEditSnapshot, document. latestSnapshot, sourceEdits )
183
183
}
184
184
}
185
185
@@ -191,7 +191,6 @@ public final class DocumentManager {
191
191
return document. latestSnapshot
192
192
}
193
193
}
194
-
195
194
}
196
195
197
196
extension DocumentManager {
@@ -214,7 +213,7 @@ extension DocumentManager {
214
213
}
215
214
}
216
215
217
- /// Convenience wrapper for `edit(_:newVersion:edits:requiresUpcomingEdits: updateDocumentTokens:)`
216
+ /// Convenience wrapper for `edit(_:newVersion:edits:updateDocumentTokens:)`
218
217
/// that logs on failure.
219
218
@discardableResult
220
219
func edit(
@@ -231,7 +230,6 @@ extension DocumentManager {
231
230
}
232
231
233
232
fileprivate extension SourceEdit {
234
-
235
233
init ( edit: TextDocumentContentChangeEvent , lineTableBeforeEdit: LineTable ) {
236
234
if let range = edit. range {
237
235
guard let offset = lineTableBeforeEdit. utf8OffsetOf ( line: range. lowerBound. line, utf16Column: range. lowerBound. utf16index) ,
@@ -249,5 +247,4 @@ fileprivate extension SourceEdit {
249
247
)
250
248
}
251
249
}
252
-
253
250
}
0 commit comments