import type { Statement } from "../ast.ts"; import type { CompilerExtension, CompilerFormattingOpaqueSourceScan } from "../extension.ts"; import { type MarkupEmbedding, type MarkupLayout } from "./markup.ts"; import { type FormatOptions } from "./options.ts"; export declare function formatLexicalSource(text: string, indentWidth: number, options: FormatOptions): string; export interface CompactSuiteCandidate { readonly ownerStart: number; readonly body: readonly Statement[]; } export interface CompactSuiteEdit { readonly start: number; readonly end: number; readonly text: string; } /** * Canonicalizes the one-statement executable suites the parser has already * proved. A short simple body shares its header line (`if ready: run()`); once * that complete line would exceed the formatter's print width, the same suite * is expanded after the colon. Structural bodies and nested block statements * never participate, and the whitespace-only gap requirement keeps comments * attached exactly where the author wrote them. */ export declare function formatCompactSuites(source: string, indentWidth: number, extensions: readonly CompilerExtension[]): string; export declare function collectCompactSuiteCandidates(statement: Statement, output: CompactSuiteCandidate[]): void; export declare function compactSuiteEdit(source: string, candidate: CompactSuiteCandidate, indentWidth: number): CompactSuiteEdit | null; export declare function protectMultilineStrings(source: string, opaqueSourceScanners: readonly ((source: string, start: number) => CompilerFormattingOpaqueSourceScan | null)[]): { readonly text: string; readonly restore: (formatted: string) => string; }; export declare function scanFormattingOpaqueSource(source: string, start: number, extensionScanners: readonly ((source: string, start: number) => CompilerFormattingOpaqueSourceScan | null)[]): CompilerFormattingOpaqueSourceScan | null; export declare function reindentBlockComment(value: string, originalIndent: string, formattedIndent: string): string; export declare function reindentLayoutLiteral(value: string, originalIndent: string, formattedIndent: string): string; export declare function isExpressionContinuationLine(content: string): boolean; /** * A tag whose `>` or `/>` the line ended before reaching. The author may wrap * an open tag over as many lines as its attributes need, so the terminator — * not the tag name — is what says whether a child level opened: a void element * that closed on its own line is self-closing whatever it was written with, * while one whose `>` is still ahead has not closed anything yet. */ export interface PendingMarkupTag { readonly name: string; readonly closing: boolean; /** The last significant character was `/`, so the next `>` closes the tag. */ readonly slash: boolean; } /** How much of an embedding the lines read so far have left open. */ export interface EmbeddedScan { readonly depth: number; readonly pending: PendingMarkupTag | null; } export declare const closedEmbeddedScan: EmbeddedScan; /** A line inside an embedding, or inside an open tag, is copied, not formatted. */ export declare function isEmbeddedLine(scan: EmbeddedScan): boolean; export declare function nextEmbeddedScan(source: string, current: EmbeddedScan, embedding: NonNullable["angleBracketEmbedding"] | null): EmbeddedScan; export declare function embeddedStart(source: string): number; /** * Formats a line inside markup the author spread across lines. The line's own * layout is the author's; each balanced element on it still takes its canonical * shape, and everything else — code inside holes, text, unbalanced tag * fragments — is copied exactly. */ export declare function formatEmbeddedContent(source: string, embedding: MarkupEmbedding, layout: MarkupLayout, column: number, depth?: number): string; //# sourceMappingURL=lines.d.ts.map