/** * LSP Module — Language Server Protocol integration. * * High-level facade for managing LSP clients: * - Auto-spawns appropriate language server for each file type * - Caches broken servers to avoid repeated spawn attempts * - Provides touchFile() → diagnostics() flow for edit tools * - Single instance shared across all swarm agents (concurrent-safe) * * Usage: * const lsp = new LSPManager(rootDir); * await lsp.touchFile("src/index.ts", true); // true = wait for diagnostics * const diags = lsp.getDiagnostics("src/index.ts"); * * Swarm-aware: Multiple agents can call touchFile() concurrently. * File versions are tracked per-file, not per-agent. */ import type { LSPServerConfig, LSPDiagnostic, LSPClientInfo, LSPLocation, LSPDocumentSymbol, LSPHover, LSPCompletionItem } from "./types.js"; export { LSPClient } from "./client.js"; export { BUILTIN_SERVERS, TYPESCRIPT_SERVER, PYRIGHT_SERVER, GOPLS_SERVER, RUST_ANALYZER_SERVER, findServersForExtension, getLanguageId, LANGUAGE_MAP, } from "./servers.js"; export type { LSPServerConfig, LSPDiagnostic, LSPClientState, LSPClientInfo, LSPPosition, LSPRange, DiagnosticSeverity, InitializeResult, ServerCapabilities, PublishDiagnosticsParams, LSPLocation, LSPDocumentSymbol, LSPHover, LSPCompletionItem, TextDocumentPositionParams, } from "./types.js"; export { DiagnosticSeverity as DiagSeverity } from "./types.js"; export declare class LSPManager { private readonly rootDir; private readonly clients; private readonly broken; private readonly spawning; private customServers; private disabled; constructor(rootDir: string); /** * Add custom server configurations (from config file). */ addServers(servers: LSPServerConfig[]): void; /** * Disable LSP entirely (e.g., from config: `lsp: false`). */ disable(): void; /** * Touch a file — notify appropriate LSP servers and optionally * wait for diagnostics. * * Lazily spawns servers on first call for each file type. * Skips broken servers silently. */ touchFile(filePath: string, waitForDiagnostics?: boolean): Promise; /** * Get diagnostics for a specific file across all active servers. */ getDiagnostics(filePath: string): LSPDiagnostic[]; /** * Get error-level diagnostics for a file, formatted for tool output. * * Returns a string suitable for appending to edit_file results, * or empty string if no errors. */ getErrorDiagnosticsText(filePath: string): string; /** * Get definition locations across all servers for the file type. */ getDefinition(filePath: string, line: number, character: number): Promise; /** * Get reference locations across all servers for the file type. */ getReferences(filePath: string, line: number, character: number): Promise; /** * Get document symbols across all servers for the file type. */ getDocumentSymbols(filePath: string): Promise; /** * Get hover information — returns the first non-null result from any server. */ getHover(filePath: string, line: number, character: number): Promise; /** * Get completions — returns the first non-empty result from any server. */ getCompletions(filePath: string, line: number, character: number): Promise; /** * Get info about all active clients. */ getClientInfos(): LSPClientInfo[]; /** * Check if a server is marked as broken. */ isBroken(serverId: string): boolean; /** * Dispose all clients and clear state. */ disposeAll(): void; private getClientsForFile; private spawnClient; } /** * Format a diagnostic for human-readable output. */ export declare function formatDiagnostic(d: LSPDiagnostic): string; //# sourceMappingURL=index.d.ts.map