import type { Root } from "@hylimo/diagram-common"; import type { ActionMessage } from "sprotty-protocol"; import type { Connection } from "vscode-languageserver"; import type { Diagram } from "./diagram/diagram.js"; import type { DiagramErrorAction } from "@hylimo/diagram-protocol"; import { type IncrementalUpdate, type DynamicLanguageServerConfig } from "@hylimo/diagram-protocol"; /** * Manages DiagramServer instances and associates them with TextDocuments * Handles removing of clients automatically, however addings must be done manually as the Diagram * must be provided. */ export declare class DiagramServerManager { private readonly connection; /** * Diagram servers by client id */ private readonly diagramServers; /** * Lookup from TextDocument uri to array of client ids */ private readonly diagramServersByDocument; /** * Gets the document uri associated with the client */ private readonly documentLookup; /** * Creates a new DiagramServerManager based on the provided connetion * * @param connection handles LSP communication */ constructor(connection: Connection); /** * Adds a new client with the diagram to serve * * @param clientId the unique id of the client, throws an error if already known * @param diagram the diagram to serve * @param config the current config */ addClient(clientId: string, diagram: Diagram, config: DynamicLanguageServerConfig): void; /** * Updates the model of each DiagramServer associated with diagram * * @param id the id of the diagram * @param newRoot the new root of the diagram */ updatedDiagram(id: string, newRoot: Root): void; /** * Incrementally updates the model of each DiagramServer associated with diagram based on the provided updates * * @param id the id of the diagram * @param updates the updates to apply * @param sequenceNumber the sequence number of the update */ incrementalUpdateDiagram(id: string, updates: IncrementalUpdate[], sequenceNumber: number): void; /** * Sends an error action to all DiagramServers associated with the diagram * * @param id the id of the diagram * @param errorAction the error action to send */ sendErrorToDiagram(id: string, errorAction: DiagramErrorAction): void; /** * Called to update the editor config of each DiagramServer * * @param config the new config */ onDidChangeConfig(config: DynamicLanguageServerConfig): void; /** * Sends the config to the diagram server * * @param diagramServer the diagram server to send the config to * @param config the config to send */ private sendEditorConfigAndSettingsToDiagramServer; /** * Handles a received ActionMessage * * @param message the received ActionMessage * @returns the result optained from the diagram server */ acceptAction(message: ActionMessage): Promise; /** * Removes a client with a specified id * * @param clientId the id of the client to remove */ removeClient(clientId: string): void; } //# sourceMappingURL=diagramServerManager.d.ts.map