/** * Persistent `sourcekit-lsp` subprocess client. * * One client per project root. Talks LSP over JSON-RPC stdio using * `vscode-jsonrpc` for framing. Lifecycle: * * spawn -> initialize -> initialized -> [lots of requests] -> shutdown -> exit * * Used by the Swift source-bridging tools (`getSymbolDefinition`, * `findSymbolReferences`, etc.). The pool (`./pool.ts`) keeps one client * alive per project root and shuts it down after an idle window so we * don't hold onto resources or stall builds. */ export interface SourceKitClientOptions { projectRoot: string; /** Override the binary path. Defaults to `xcrun sourcekit-lsp`. */ command?: string; args?: string[]; /** Initialization timeout, ms. Default 30s. */ initTimeoutMs?: number; } export interface InitializedClient { projectRoot: string; /** Send an arbitrary LSP request by method name. */ sendRequest(method: string, params?: unknown): Promise; /** Send a notification (no response). */ sendNotification(method: string, params?: unknown): void; /** Track a document as open with the server. Idempotent per uri. */ didOpen(filePath: string, languageId?: string): void; /** Stop the server gracefully. Once called, the client cannot be reused. */ dispose(): Promise; } /** * Spawn `sourcekit-lsp`, drive the LSP handshake, and return a client * that exposes typed request/notification helpers. */ export declare function createSourceKitClient(opts: SourceKitClientOptions): Promise;