/****************************************************************************** * Copyright 2021 TypeFox GmbH * This program and the accompanying materials are made available under the * terms of the MIT License, which is available in the project root. ******************************************************************************/ import type { CancellationToken, Connection } from 'vscode-languageserver'; import type { ActionMessage, DiagramOptions, DiagramServer } from 'sprotty-protocol'; import type { LangiumDocument, ServiceRegistry, URI } from 'langium'; import type { LangiumSprottyServices, LangiumSprottySharedServices } from './sprotty-services.js'; /** * A `DiagramServer` instance can handle exactly one client diagram. The host application * can open multiple diagrams with different IDs. This service manages the `DiagramServer` * instances, creating one instance for each received `clientId` and discarding it when the * client closes the respective diagram. */ export interface DiagramServerManager { /** * Find the DiagramServer instances that match the given document URI. */ findServersForUri(documentUri: URI): DiagramServer[]; /** * Called when an action message is sent from the client to the server. */ acceptAction(message: ActionMessage): Promise; /** * The client application notified closing of a specific diagram client. */ removeClient(clientId: string): void; } export declare class DefaultDiagramServerManager implements DiagramServerManager { protected readonly connection?: Connection; protected readonly serviceRegistry: ServiceRegistry; protected readonly diagramServerFactory: (clientId: string, options?: DiagramOptions) => DiagramServer; protected readonly diagramServerMap: Map; protected changedUris: URI[]; protected outdatedDocuments: Map; constructor(services: LangiumSprottySharedServices); /** * Listen to incoming document change notifications and keep track of such changed documents. */ protected documentsUpdated(changed: URI[], deleted: URI[]): void; /** * Listen to completed builds and trigger diagram updates accordingly. */ protected documentsBuilt(built: LangiumDocument[], cancelToken: CancellationToken): Promise; protected updateDiagrams(documents: Map, cancelToken: CancellationToken): Promise; /** * Determine whether we should actually update the given document. The default implementation skips * updating if there are lexer errors or parser errors. */ protected shouldUpdateDiagram(document: LangiumDocument, _language: LangiumSprottyServices): boolean; findServersForUri(documentUri: URI): DiagramServer[]; acceptAction({ clientId, action }: ActionMessage): Promise; removeClient(clientId: string): void; } //# sourceMappingURL=diagram-server-manager.d.ts.map