import type { InterpreterModule } from "@hylimo/core"; import type { CompletionItem, CompletionParams, Connection, DocumentFormattingParams, InitializeResult, TextDocumentChangeEvent } from "vscode-languageserver"; import { TextDocuments, TextEdit } from "vscode-languageserver"; import type { TextDocumentContentChangeEvent } from "vscode-languageserver-textdocument"; import { TextDocument } from "vscode-languageserver-textdocument"; import { Diagram } from "./diagram/diagram.js"; import { Formatter } from "./format/formatter.js"; import { DiagramServerManager } from "./diagramServerManager.js"; import type { OpenDiagramMessage, DynamicLanguageServerConfig, DiagramRequestMessage, DiagramResponseMessage } from "@hylimo/diagram-protocol"; import type { SharedDiagramUtils } from "./sharedDiagramUtils.js"; import type { DiagramImplementationManager } from "./diagram/diagramImplementationManager.js"; /** * Config for creating a new language server */ export interface LanguageServerConfig { /** * The default config to use */ defaultConfig: DynamicLanguageServerConfig; /** * The connection to use */ connection: Connection; /** * Additional modules for running the interpreter */ additionalInterpreterModules: InterpreterModule[]; /** * The maximum amount of execution steps a single execution can use */ maxExecutionSteps: number; } /** * Default language server */ export declare class LanguageServer { readonly config: LanguageServerConfig; /** * The connection to use */ protected readonly connection: Connection; /** * Used to sync textdocuments */ protected readonly textDocuments: TextDocuments; /** * Formatter to use for formatting requests */ protected readonly formatter: Formatter; /** * Lookup of all known diagrams */ protected readonly diagrams: Map; /** * Manages diagram servers */ protected readonly diagramServerManager: DiagramServerManager; /** * Shared utils for diagrams */ protected readonly diagramUtils: SharedDiagramUtils; /** * Manages layouted diagrams. * Can be either a local or remote implementation */ protected layoutedDiagramManager: DiagramImplementationManager; /** * Creates a new language server * * @param config configures the language server */ constructor(config: LanguageServerConfig); /** * Listens on the connection * must be called */ listen(): void; /** * Called on initialize * * @returns the init result including capabilities */ protected onInitialize(): InitializeResult; /** * Callback for textDocuments.onDidOpen * * @param e the provided event */ protected onDidOpenTextDocument(e: TextDocumentChangeEvent): void; /** * Callback for textDocuments.onDidClose * * @param e the provided event */ protected onDidCloseTextDocument(e: TextDocumentChangeEvent): void; /** * Updates a TextDocument by modifying its content * * @param document the document to update * @param changes the changes to apply to the document * @param version the new version of the document * @returns the updated document */ protected updateTextDocument(document: TextDocument, changes: TextDocumentContentChangeEvent[], version: number): TextDocument; /** * Callback for textDocuments.onDidClose * * @param e the provided event */ protected onDidChangeContentTextDocument(e: TextDocumentChangeEvent): Promise; /** * Callback for onDocumentFormatting * * @param params defines the document and additional options * @returns edits which define how to update the document */ protected onDocumentFormatting(params: DocumentFormattingParams): Promise; /** * Callback for onCompletion * * @param params defines the document and position * @returns the completion items */ protected onCompletion(params: CompletionParams): Promise; /** * Registers a diagram client * * @param params defines the id of the client and the diagram to open */ protected onOpenDiagram(params: OpenDiagramMessage): void; /** * Handles a diagram request * * @param params defines the diagram to request * @returns the requested diagram */ protected onRequestDiagram(params: DiagramRequestMessage): DiagramResponseMessage; /** * Sets this language server to use a secondary language server * * @param id the id of the secondary language server */ protected onSetSecondaryLanguageServer(id: number): void; /** * Updates the config of this language server * * @param params the new config */ protected onUpdateConfig(params: DynamicLanguageServerConfig): void; } //# sourceMappingURL=languageServer.d.ts.map