Skip to content

Commit 5746e83

Browse files
committed
Simplify change command invocation
1 parent 8bbb64a commit 5746e83

File tree

3 files changed

+17
-23
lines changed

3 files changed

+17
-23
lines changed

dist/main/typescriptBuffer.js

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/main/typescriptBuffer.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/main/typescriptBuffer.ts

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -235,22 +235,16 @@ export class TypescriptBuffer {
235235
// that all subsequent "change" commands will be sequenced after
236236
// the ones we pushed
237237
await Promise.all(
238-
changes.map(change => {
239-
const {start, oldExtent, newText} = change
240-
241-
const end = {
242-
endLine: start.row + oldExtent.row + 1,
243-
endOffset: (oldExtent.row === 0 ? start.column + oldExtent.column : oldExtent.column) + 1,
244-
}
245-
246-
return client.execute("change", {
247-
...end,
238+
changes.map(({oldRange, newText}) =>
239+
client.execute("change", {
248240
file: filePath,
249-
line: start.row + 1,
250-
offset: start.column + 1,
241+
line: oldRange.start.row + 1,
242+
offset: oldRange.start.column + 1,
243+
endLine: oldRange.end.row + 1,
244+
endOffset: oldRange.end.column + 1,
251245
insertString: newText,
252-
})
253-
}),
246+
}),
247+
),
254248
)
255249

256250
this.lastUpdatedAt = Date.now()

0 commit comments

Comments
 (0)