import { LspTransport } from './transport.js'; /** * LSP protocol types */ export interface Location { uri: string; range: { start: { line: number; character: number; }; end: { line: number; character: number; }; }; } export interface Diagnostic { range: { start: { line: number; character: number; }; end: { line: number; character: number; }; }; severity?: number; code?: string | number; source?: string; message: string; } export interface Hover { contents: string | { kind: string; value: string; }; range?: { start: { line: number; character: number; }; end: { line: number; character: number; }; }; } export interface WorkspaceEdit { changes?: Record>; documentChanges?: any[]; } /** * Detect LSP language ID from file path. */ export declare function detectLanguage(filePath: string): string | null; /** * Convert file path to LSP URI (file:///...). */ export declare function pathToUri(filePath: string): string; /** * Convert LSP URI to file path. */ export declare function uriToPath(uri: string): string; /** * LSP Client — communicates with an LSP server via JSON-RPC 2.0. * * Supports: * - initialize/initialized handshake * - textDocument/didOpen, didClose, didChange * - textDocument/definition, references, hover, rename * - textDocument/publishDiagnostics notifications */ export declare class LspClient { readonly transport: LspTransport; serverCapabilities: Record | null; initialized: boolean; private fileVersions; private fileDiagnostics; private workspaceRoot; constructor(transport: LspTransport); /** * Initialize the LSP session with the server. */ initialize(workspaceRoot: string): Promise; /** * Open a file in the LSP server. */ openFile(filePath: string, content: string): void; /** * Close a file in the LSP server. */ closeFile(filePath: string): void; /** * Navigate to the definition of a symbol. */ gotoDefinition(filePath: string, line: number, character: number): Promise; /** * Find all references to a symbol. */ findReferences(filePath: string, line: number, character: number): Promise; /** * Get hover information for a symbol. */ hover(filePath: string, line: number, character: number): Promise; /** * Rename a symbol across the workspace. */ rename(filePath: string, line: number, character: number, newName: string): Promise; /** * Get diagnostics for a file (collected from publishDiagnostics notifications). */ getDiagnostics(filePath: string): Diagnostic[]; /** * Clear diagnostics for a file. */ clearDiagnostics(filePath: string): void; /** * Shutdown the LSP session gracefully. */ close(): Promise; }