From 04e5d57a22b08632446ef252862a409021e718c1 Mon Sep 17 00:00:00 2001 From: Quinten Kock Date: Wed, 3 Dec 2025 04:20:02 +0100 Subject: [PATCH] fix lsp syncing --- src/app/filestate.ts | 5 ++++- src/app/lsp.ts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) 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);