Apply changes in reverse order even in new API to match behaviour with internal api

This commit is contained in:
Sheetal Nandi
2019-02-27 14:07:15 -08:00
parent e6068f405b
commit 03377f70b7
2 changed files with 3 additions and 3 deletions

View File

@@ -2107,7 +2107,7 @@ namespace ts.server {
})),
request.arguments.changedFiles && mapIterator(arrayIterator(request.arguments.changedFiles), file => ({
fileName: file.fileName,
changes: mapDefinedIterator(arrayIterator(file.textChanges), change => {
changes: mapDefinedIterator(arrayReverseIterator(file.textChanges), change => {
const scriptInfo = Debug.assertDefined(this.projectService.getScriptInfo(file.fileName));
const start = scriptInfo.lineOffsetToPosition(change.start.line, change.start.offset);
const end = scriptInfo.lineOffsetToPosition(change.end.line, change.end.offset);

View File

@@ -127,12 +127,12 @@ ${file.content}`;
{
start: { line: 1, offset: 1 },
end: { line: 1, offset: 1 },
newText: "let zz = 10;",
newText: "let zzz = 10;",
},
{
start: { line: 1, offset: 1 },
end: { line: 1, offset: 1 },
newText: "let zzz = 10;",
newText: "let zz = 10;",
}
]
}