export { truncate } from "@oh-my-pi/pi-utils"; import type { CodeAction, Command, Diagnostic, DiagnosticSeverity, DocumentSymbol, Location, SymbolInformation, SymbolKind, TextEdit, WorkspaceEdit } from "./types"; export { detectLanguageId } from "../utils/lang-from-path"; /** * Convert a file path to a file:// URI. * Handles Windows drive letters correctly. */ export declare function fileToUri(filePath: string): string; /** * Convert a file:// URI to a file path. * Handles Windows drive letters correctly. */ export declare function uriToFile(uri: string): string; /** * 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[]; /** * 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; /** * Reformat pre-formatted diagnostic messages into grep-style directory/file groups. * Input: ["path:line:col [sev] msg", ...] * Output: "# dir/\n## file.ts\n line:col [sev] msg" * * Messages that don't match the expected format are appended ungrouped at the end. */ export declare function formatGroupedDiagnosticMessages(messages: string[]): string; /** * Format diagnostics grouped by severity. */ export declare function formatDiagnosticsSummary(diagnostics: Diagnostic[]): string; /** * 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; 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;