/** * LSP Client — Language Server Protocol client over stdio. * * Manages a single language server connection: * - Spawn process with Content-Length framed JSON-RPC * - Initialize handshake (capabilities, rootUri) * - Track open files with version numbers * - Receive and cache diagnostics per file * - touchFile() → open/change → await diagnostics * * Swarm-aware: A single LSPClient instance is shared across all agents. * Concurrent touchFile() calls are safe — file versions are tracked atomically. * * Zero-dependency: uses only node:child_process and node:path. */ import type { LSPServerConfig, LSPClientState, LSPClientInfo, LSPDiagnostic, LSPLocation, LSPDocumentSymbol, LSPHover, LSPCompletionItem } from "./types.js"; export declare class LSPClient { private readonly config; private readonly rootDir; private process; private state; private serverInfo?; private nextId; private pending; private buffer; private fileVersions; private diagnosticsCache; private diagnosticsWaiters; private _startPromise; private _onStdoutData; constructor(config: LSPServerConfig, rootDir: string); /** * Start the language server and complete the initialize handshake. */ start(): Promise; private _doStart; /** * Stop the language server. */ stop(): void; /** * Notify the server about a file change and optionally wait for diagnostics. * * If the file hasn't been opened yet, sends didOpen. Otherwise sends didChange. * Reads the file content from disk. */ touchFile(filePath: string, waitForDiagnostics?: boolean): Promise; /** * Get cached diagnostics for a file. */ getDiagnostics(filePath: string): LSPDiagnostic[]; /** * Get all cached diagnostics keyed by file path. */ getAllDiagnostics(): Map; /** * Get definition locations for a symbol at the given position. */ getDefinition(filePath: string, line: number, character: number): Promise; /** * Get reference locations for a symbol at the given position. */ getReferences(filePath: string, line: number, character: number): Promise; /** * Get document symbols for the given file. */ getDocumentSymbols(filePath: string): Promise; /** * Get hover information for a symbol at the given position. */ getHover(filePath: string, line: number, character: number): Promise; /** * Get completion items at the given position. */ getCompletions(filePath: string, line: number, character: number): Promise; getState(): LSPClientState; getInfo(): LSPClientInfo; getServerId(): string; private waitForDiagnostics; private notifyDiagnosticsWaiters; private removeWaiter; private clearAllWaiters; private sendRequest; private sendNotification; private writeMessage; private static readonly MAX_BUFFER_SIZE; private processBuffer; private handleMessage; private handleNotification; /** * Ensure a file is open on the server. If not already tracked, * call touchFile to send didOpen. */ private ensureFileOpen; private uriToPath; private handleProcessExit; private rejectAllPending; } //# sourceMappingURL=client.d.ts.map