import type { Diagnostic, Project, SourceFile, ts } from './ts-morph.ts'; import type { Highlighter } from './create-highlighter.ts'; import { type Languages } from './get-language.ts'; import { type HighlighterInitializationOptions } from './highlighter-options.ts'; interface SymbolMetadata { start: number; end: number; isDeprecated: boolean; } interface TypeScriptMetadata { sourceFile: SourceFile | undefined; diagnostics: Diagnostic[]; symbolMetadata: SymbolMetadata[]; } type MetadataCollector = (project: Project, filePath: string | undefined, jsxOnly: boolean, allowErrors?: string | boolean, showErrors?: boolean) => Promise; type Color = string; type ThemeTokenColor = { name?: string; scope: string | string[]; settings: { background?: Color; foreground?: Color; fontStyle?: 'italic' | 'bold' | 'underline'; }; }; export type Theme = { name: string; type: 'light' | 'dark' | 'hc'; colors: { [element: string]: Color; }; tokenColors: ThemeTokenColor[]; }; export type TokenDiagnostic = { code: number; message: string; }; export type Token = { value: string; start: number; end: number; hasTextStyles: boolean; isBaseColor: boolean; isDeprecated: boolean; isSymbol: boolean; isWhiteSpace: boolean; diagnostics?: TokenDiagnostic[]; quickInfo?: { displayText: string; documentationText: string; }; style: { color?: string; fontStyle?: string; fontWeight?: string; textDecoration?: string; } | { [property: `--${string}`]: string; }; }; export type Tokens = Token[]; export type TokenizedLines = Tokens[]; export interface GetTokensOptions { project: Project; value: string; language?: Languages; filePath?: string; allowErrors?: boolean | string; showErrors?: boolean; highlighter: Highlighter | null; sourcePath?: string | false; theme: HighlighterInitializationOptions['theme']; metadataCollector?: MetadataCollector; /** * When true, only eagerly populate quick info for an initial symbol budget so * the caller can resolve remaining hover data on demand. */ deferQuickInfoUntilHover?: boolean; } export declare function createPlainTextTokenizedLines(value: string): TokenizedLines; /** Converts a string of code to an array of highlighted tokens. */ export declare function getTokens({ project, value, language, filePath, allowErrors, showErrors, highlighter, theme: themeConfig, metadataCollector, deferQuickInfoUntilHover, }: GetTokensOptions): Promise; /** Collects typescript metadata for a given source file. */ export declare function collectTypeScriptMetadata(project: Project, filePath: string | undefined, jsxOnly: boolean, allowErrors?: string | boolean, showErrors?: boolean): Promise; /** Retrieves diagnostics from a source file. */ export declare function getDiagnostics(sourceFile: SourceFile | undefined, allowErrors?: string | boolean, showErrors?: boolean): Diagnostic[]; export declare function resolveQuickInfoLookupBudget(options: { valueLength: number; symbolCount: number; }): number; export {};