diff --git a/src/app/filestate.ts b/src/app/filestate.ts index ebdc665..e121e5f 100644 --- a/src/app/filestate.ts +++ b/src/app/filestate.ts @@ -210,10 +210,13 @@ export class OpenFile implements WorkspaceFile { private changeSet: ChangeSet; get changes(): ChangeSet { if (!this.changeSet) { - this.changeSet = ChangeSet.empty(this.rootState.val.doc.length); + this.clearChanges(); } return this.changeSet; } + clearChanges(): void { + this.changeSet = ChangeSet.empty(this.rootState.val.doc.length); + } // Return an EditorView to be used by the LSP Workspace for position mapping. // If `main` is provided and belongs to this open file, return it. Otherwise diff --git a/src/app/lsp.ts b/src/app/lsp.ts index 143a539..09d96bd 100644 --- a/src/app/lsp.ts +++ b/src/app/lsp.ts @@ -109,7 +109,7 @@ class OpenFileWorkspace extends Workspace { result.push({ file, prevDoc, changes }); file.doc = file.rootState.val.doc; file.version = this.nextFileVersion(file.uri); - file.changes = ChangeSet.empty(file.doc.length); + file.clearChanges(); } for (const e of file.editors) { const plugin = LSPPlugin.get(e.view);