export { truncate } from "@oh-my-pi/pi-utils"; import type { CodeAction, Command, Diagnostic, DiagnosticSeverity, DocumentSymbol, Location, SymbolInformation, SymbolKind, TextEdit, WorkspaceEdit } from "./types.js"; export { detectLanguageId } from "@oh-my-pi/pi-tui/lang-from-path"; /** Read a file's text, refusing FIFOs, devices and sockets, whose reads can block forever or never end. */ export declare function readTextFromDisk(filePath: string): Promise; /** * Convert a file path to a file:// URI. * Uses the URL machinery so special characters (`%`, `#`, `?`, spaces) are * percent-encoded; plain concatenation produced URIs that broke round-trips. * Handles Windows drive letters correctly. */ export declare function fileToUri(filePath: string): string; /** * Convert a file:// URI to a file path. * Tolerates both percent-encoded URIs and lax servers that send raw paths. * Handles Windows drive letters correctly. */ export declare function uriToFile(uri: string): string; /** Map that treats equivalent file URI spellings as the same key. */ export declare class EquivalentUriMap extends Map { #private; delete(uri: string): boolean; get(uri: string): Value | undefined; has(uri: string): boolean; set(uri: string, value: Value): this; } /** * Convert diagnostic severity number to string name. */ export declare function severityToString(severity?: DiagnosticSeverity): string; /** * Sort diagnostics by severity, then by location and message. */ export declare function sortDiagnostics(diagnostics: Diagnostic[]): Diagnostic[]; /** * Merge two diagnostic lists, preserving order and deduplicating by range, source and message. */ export declare function mergeDiagnosticLists(primary: Diagnostic[], secondary: Diagnostic[]): Diagnostic[]; /** * Get icon for diagnostic severity. */ export declare function severityToIcon(severity?: DiagnosticSeverity): string; /** * Format a diagnostic as a human-readable string. */ export declare function formatDiagnostic(diagnostic: Diagnostic, filePath: string): string; /** * Format diagnostics grouped by severity. */ export declare function formatDiagnosticsSummary(diagnostics: Diagnostic[]): string; export declare function summarizeDiagnosticMessages(messages: string[]): { summary: string; errored: boolean; }; /** * Format a location as file:line:col relative to cwd. */ export declare function formatLocation(location: Location, cwd: string): string; /** * Format a position as line:col. */ export declare function formatPosition(line: number, col: number): string; /** * Format a workspace edit as a summary of changes. */ export declare function formatWorkspaceEdit(edit: WorkspaceEdit, cwd: string): string[]; /** * Format a text edit as a preview. */ export declare function formatTextEdit(edit: TextEdit, maxLength?: number): string; /** * Get icon for symbol kind. */ export declare function symbolKindToIcon(kind: SymbolKind): string; /** * Get name for symbol kind. */ export declare function symbolKindToName(kind: SymbolKind): string; /** * Format a document symbol with optional hierarchy. */ export declare function formatDocumentSymbol(symbol: DocumentSymbol, indent?: number): string[]; /** * Format a symbol information (flat format). */ export declare function formatSymbolInformation(symbol: SymbolInformation, cwd: string): string; export declare function filterWorkspaceSymbols(symbols: SymbolInformation[], query: string): SymbolInformation[]; export declare function dedupeWorkspaceSymbols(symbols: SymbolInformation[]): SymbolInformation[]; export declare function formatCodeAction(action: CodeAction | Command, index: number): string; /** * Appends the `extra` code actions that do not already appear, identically, in `base`. * `code_actions` merges its unfiltered and `source`-kind requests with this; servers that * ignore `context.only` answer both with the same actions. Same-titled actions that differ * in any field (edit, command, data) stay distinct, as do repeats within one response. */ export declare function mergeCodeActions(base: (CodeAction | Command)[] | null, extra: (CodeAction | Command)[] | null): (CodeAction | Command)[]; export interface CodeActionApplyDependencies { resolveCodeAction?: (action: CodeAction) => Promise; applyWorkspaceEdit: (edit: WorkspaceEdit) => Promise; executeCommand: (command: Command) => Promise; } export interface AppliedCodeActionResult { title: string; edits: string[]; executedCommands: string[]; } export declare function applyCodeAction(action: CodeAction | Command, dependencies: CodeActionApplyDependencies): Promise; export declare function hasGlobPattern(value: string): boolean; export declare function collectGlobMatches(pattern: string, cwd: string, maxMatches: number): Promise<{ matches: string[]; truncated: boolean; }>; export declare function resolveDiagnosticTargets(file: string, cwd: string, maxMatches: number): Promise<{ matches: string[]; truncated: boolean; }>; /** * Extract plain text from hover contents. */ export declare function extractHoverText(contents: string | { kind: string; value: string; } | { language: string; value: string; } | unknown[]): string; export declare function resolveSymbolColumn(filePath: string, line: number, symbolSpec?: string): Promise; export declare function readLocationContext(filePath: string, line: number, contextLines?: number): Promise;