import type { TextDocumentContentChangeEvent } from "vscode-languageserver-textdocument"; import { TextDocument } from "vscode-languageserver-textdocument"; import type { SharedDiagramUtils } from "../sharedDiagramUtils.js"; import { type CompletionItem, type Position, type TextDocumentEdit } from "vscode-languageserver"; import type { NavigateToSourceAction, UpdateEditorConfigAction, ToolboxEditPredictionRequestAction } from "@hylimo/diagram-protocol"; import { TransactionalAction, ToolboxEditPredictionResponseAction } from "@hylimo/diagram-protocol"; import { BaseLayoutedDiagram } from "@hylimo/diagram-common"; import type { DiagramImplementationManager } from "./diagramImplementationManager.js"; /** * Holds the state for a specific diagram */ export declare class Diagram { readonly document: TextDocument; private readonly utils; private readonly implementationManager; /** * The current diagram */ currentDiagram?: BaseLayoutedDiagram; /** * Update counter to ensure older updates do not overwrite newer ones */ private updateCounter; /** * The last applied update */ private currentUpdate; /** * Handles TransactionActions */ private transactionManager; /** * The implementation to which all requests are delegated */ private implementation?; /** * Creates a new diagram * * @param document the document on which it is based * @param utils shared diagram utils * @param implementationManager the layouted diagram manager provided to the LayoutedDiagram */ constructor(document: TextDocument, utils: SharedDiagramUtils, implementationManager: DiagramImplementationManager); /** * Called when the content of the associated document changes */ onDidChangeContent(): Promise; /** * Called to update the diagram based on a config change */ onDidChangeConfig(): Promise; /** * Updates the current transaction based on changes to the document. * Should update indices to correspond to the new file. * * @param changes changes applied to the document */ updateCurrentTransaction(changes: TextDocumentContentChangeEvent[]): void; /** * Updates the Diagram based on an updated document or config change * * @returns diagnostic entries containing errors, undefined if update is outdated (newer update has already been applied) */ private updateDiagram; /** * Handles a transactional action * * @param action the action to handle */ handleTransactionalAction(action: TransactionalAction): Promise; /** * Handles a navigate to source action * * @param action the action to handle */ handleNavigateToSourceAction(action: NavigateToSourceAction): Promise; /** * Handles a editor config update action * Forwards the config to the language client * * @param action the action to handle */ handleUpdateEditorConfigAction(action: UpdateEditorConfigAction): Promise; /** * Handles a toolbox edit prediction request action * * @param action the action to handle * @returns the response action */ handleToolboxEditPredictionRequestAction(action: ToolboxEditPredictionRequestAction): Promise; /** * Applies an edit to the document * * @param edit the edit to apply */ applyEdit(edit: TextDocumentEdit): Promise; /** * Generates completion items for the given position. * * @param position the position to generate the completion items for * @returns the generated completion items */ generateCompletionItems(position: Position): Promise; } //# sourceMappingURL=diagram.d.ts.map