Refactor & lint

This commit is contained in:
Andras Schmelczer 2025-12-07 15:46:00 +00:00
parent e47d8a8179
commit 6608804d34
16 changed files with 126 additions and 133 deletions

View file

@ -16,14 +16,14 @@ import { EventListeners } from "../utils/data-structures/event-listeners";
// known remote cursor positions, and for each document, tries to return the latest cursor positions that are
// not from the future.
export class CursorTracker {
private readonly updateLock = new Lock();
// The returned position may be accurate, if it matches the document version, or outdated, in which case
// the client has to heuristically guess it's current position based on the local edits.
public readonly onRemoteCursorsUpdated = new EventListeners<
(cursors: MaybeOutdatedClientCursors[]) => unknown
>();
private readonly updateLock = new Lock();
private knownRemoteCursors: (ClientCursors & {
upToDateness: DocumentUpToDateness;
})[] = [];
@ -72,7 +72,6 @@ export class CursorTracker {
}
);
this.fileChangeNotifier.onFileChanged.add(async (relativePath) =>
this.updateLock.withLock(async () => {
for (const clientCursor of this.knownRemoteCursors) {
@ -156,7 +155,6 @@ export class CursorTracker {
this.webSocketManager.updateLocalCursors({ documentsWithCursors });
}
public reset(): void {
this.knownRemoteCursors = [];
this.lastLocalCursorState = [];