/**
 * LSP Manager
 *
 * Per-workspace manager that owns LSP server clients.
 * NOT a singleton — each Workspace instance creates its own LSPManager.
 *
 * Resolves the project root per-file by walking up from the file's directory
 * using language-specific markers defined on each server (e.g. tsconfig.json
 * for TypeScript, go.mod for Go). Falls back to the default root when
 * walkup finds nothing.
 */
import type { SandboxProcessManager } from '../sandbox/process-manager/index.js';
import { LSPClient } from './client.js';
import type { LSPConfig, LSPDiagnostic } from './types.js';
export declare class LSPManager {
    private clients;
    private initPromises;
    private clientInitQueue;
    private clientLeaseAcquisitionQueue;
    private activeClientLeases;
    private clientLeaseWaiters;
    private shutdownPromise?;
    private shuttingDown;
    private fileLocks;
    private processManager;
    private _root;
    private config;
    private serverDefs;
    private customExtensions;
    private filesystem?;
    constructor(processManager: SandboxProcessManager, root: string, config?: LSPConfig, filesystem?: {
        exists(path: string): Promise<boolean>;
    });
    /** Default project root (fallback when per-file walkup finds nothing). */
    get root(): string;
    /**
     * Resolve the project root for a given file path using the server's markers.
     * Uses the workspace filesystem when available (supports remote filesystems),
     * falls back to sync walkUp (local disk) otherwise.
     */
    private resolveRoot;
    /** Mark a client as most recently used. */
    private touchClient;
    /** Shut down idle least recently used clients until another one can be opened. */
    private ensureClientCapacity;
    /** Acquire a client and lease it before another capped acquisition can evict it. */
    private acquireClientLease;
    /** Keep an acquired client alive while an operation is using it. */
    private withClientLease;
    private wakeClientLeaseWaiters;
    /** Wait for a lease release without allowing leaked leases to block new clients indefinitely. */
    private waitForClientLeaseRelease;
    /** Wait for active operations to release their clients, then force teardown after a bounded delay. */
    private waitForClientLeasesToDrain;
    /**
     * Acquire a per-file lock so that concurrent getDiagnostics calls for the
     * same file are serialized (preventing interleaved open/change/close) and
     * are served in the order they arrived. Different files run in parallel.
     */
    private acquireFileLock;
    /**
     * Initialize an LSP client for the given server definition and project root.
     * Handles timeout, deduplication of concurrent init calls, and caching.
     */
    private initClient;
    /**
     * Get or create an LSP client for a file path.
     * Resolves the project root per-file using the server's markers.
     * Returns null if no server is available.
     */
    private getClientInternal;
    /**
     * Get LSP client ready to query a file.
     * Opens the file in the client so queries can be made. Call `release` after
     * closing the file to allow the client to be evicted.
     * Returns null when no LSP client is available.
     */
    prepareQuery(filePath: string): Promise<{
        client: LSPClient;
        uri: string;
        languageId: string;
        serverName: string;
        release: () => void;
    } | null>;
    /**
     * Convenience method: open file, send content, wait for diagnostics, return normalized results.
     * Returns null when no LSP client is available; otherwise returns diagnostics
     * (or an empty array on runtime failures after client acquisition).
     * Uses a per-file lock to serialize concurrent calls for the same file.
     */
    getDiagnostics(filePath: string, content: string): Promise<LSPDiagnostic[] | null>;
    /**
     * Get diagnostics from ALL matching language servers for a file.
     * Deduplicates results by (line, character, message).
     * Individual server failures don't block other servers.
     */
    getDiagnosticsMulti(filePath: string, content: string): Promise<LSPDiagnostic[]>;
    /**
     * Collect diagnostics from a single client for a file.
     */
    private collectDiagnostics;
    /**
     * Shutdown all managed LSP clients.
     */
    shutdownAll(): Promise<void>;
}
//# sourceMappingURL=manager.d.ts.map