Rename types

This commit is contained in:
Andras Schmelczer 2025-08-23 09:49:48 +01:00
parent 26cd95cfda
commit 49f2d69e59
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
6 changed files with 13 additions and 11 deletions

View file

@ -9,10 +9,7 @@ import type {
ViewUpdate
} from "@codemirror/view";
import { RemoteCursorWidget } from "./remote-cursor-widget";
import type {
CursorSpan,
DocumentWithMaybeOutdatedClientCursors
} from "sync-client";
import type { CursorSpan, MaybeOutdatedClientCursors } from "sync-client";
import type { App } from "obsidian";
import { MarkdownView } from "obsidian";
@ -120,7 +117,7 @@ export const remoteCursorsPlugin = ViewPlugin.fromClass(
);
export function setCursors(
clients: DocumentWithMaybeOutdatedClientCursors[],
clients: MaybeOutdatedClientCursors[],
app: App
): void {
cursors = [

View file

@ -1,7 +1,7 @@
import type { Workspace } from "obsidian";
import { FileView, setIcon } from "obsidian";
import type { SyncClient } from "sync-client";
import { DocumentUpdateStatus } from "sync-client";
import { DocumentSyncStatus } from "sync-client";
import "./editor-sync-line.scss";
export function updateEditorStatusDisplay(
@ -35,7 +35,7 @@ export function updateEditorStatusDisplay(
const isLoading =
client.getDocumentSyncingStatus(filePath) ==
DocumentUpdateStatus.SYNCING;
DocumentSyncStatus.SYNCING;
if (isLoading) {
element.classList.add("loading");

View file

@ -18,8 +18,8 @@ export type { PersistenceProvider } from "./persistence/persistence";
export type { CursorSpan } from "./services/types/CursorSpan";
export type { ClientCursors } from "./services/types/ClientCursors";
export type { NetworkConnectionStatus } from "./types/network-connection-status";
export type { DocumentWithMaybeOutdatedClientCursors } from "./types/maybe-outdated-client-cursors";
export { DocumentUpdateStatus } from "./types/document-update-status";
export type { MaybeOutdatedClientCursors } from "./types/maybe-outdated-client-cursors";
export { DocumentSyncStatus } from "./types/document-sync-status";
export { SyncClient } from "./sync-client";
import { Locks } from "./utils/locks";

View file

@ -1,4 +1,4 @@
export enum DocumentUpdateStatus {
export enum DocumentSyncStatus {
UP_TO_DATE = "UP_TO_DATE",
SYNCING = "SYNCING"
}

View file

@ -0,0 +1,5 @@
export enum DocumentUpToDateness {
UpToDate = "UpToDate", // easiest case, the client can just show the cursors as-is
Prior = "Prior", // The cursors are outdated, so the client has to guess the cursor positions based on local updates. This is only possible if this client's cursor has once been up-to-date in a given document.
Later = "Later" // The cursors are from a future version of a document, there's no way we can accuratly show them locally.
}

View file

@ -1,5 +1,5 @@
import type { ClientCursors } from "../services/types/ClientCursors";
export interface DocumentWithMaybeOutdatedClientCursors extends ClientCursors {
export interface MaybeOutdatedClientCursors extends ClientCursors {
isOutdated: boolean;
}