fix lsp syncing

This commit is contained in:
Quinten Kock 2025-12-03 04:20:02 +01:00
parent 954827a0d6
commit 04e5d57a22
2 changed files with 5 additions and 2 deletions

View File

@ -210,10 +210,13 @@ export class OpenFile implements WorkspaceFile {
private changeSet: ChangeSet; private changeSet: ChangeSet;
get changes(): ChangeSet { get changes(): ChangeSet {
if (!this.changeSet) { if (!this.changeSet) {
this.changeSet = ChangeSet.empty(this.rootState.val.doc.length); this.clearChanges();
} }
return this.changeSet; 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. // 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 // If `main` is provided and belongs to this open file, return it. Otherwise

View File

@ -109,7 +109,7 @@ class OpenFileWorkspace extends Workspace {
result.push({ file, prevDoc, changes }); result.push({ file, prevDoc, changes });
file.doc = file.rootState.val.doc; file.doc = file.rootState.val.doc;
file.version = this.nextFileVersion(file.uri); file.version = this.nextFileVersion(file.uri);
file.changes = ChangeSet.empty(file.doc.length); file.clearChanges();
} }
for (const e of file.editors) { for (const e of file.editors) {
const plugin = LSPPlugin.get(e.view); const plugin = LSPPlugin.get(e.view);