/** * A candidate slash token found in free text by `findRefTokens`. This is the * NORMATIVE, trimmed span used for resolution and highlighting. */ export interface RefToken { /** Character index of the leading `/`. */ start: number; /** Character index just past the last kept name character (post-trim). */ end: number; /** The surface token including `/`, trailing punctuation already trimmed. */ raw: string; /** Decoded canonical name (`:` → `/`); never empty (empty candidates are omitted). */ candidate: string; } /** * The in-progress token touching a caret position, as reported by * `findRefTokenAtCaret`. Its `[start, end)` range is the COMPLETE captured * replacement range (the maximal, UNTRIMMED `[A-Za-z0-9_:-]` run) — not the * trimmed `RefToken` span — so a completion accept can replace an * in-progress token like `/taste:` (no trailing name segment yet) or a token * the caret sits in the middle of (suffix-inclusive). The normative resolved * span for highlighting/guidance always remains `findRefTokens`' trimmed span; * this helper exists only to drive completion UX. */ export interface RefCaretToken { /** Character index of the leading `/`. */ start: number; /** Character index just past the last character of the maximal (untrimmed) run. */ end: number; /** The slash/name prefix from `start` through the caret (`text.slice(start, caret)`). */ surfacePrefix: string; } /** * Find every resolved-ref CANDIDATE in `text` per the §4.1 grammar. Does not * consult any inventory — callers resolve a token by testing * `token.candidate` against a `Set` of visible canonical names. */ export declare function findRefTokens(text: string): RefToken[]; /** * Render a canonical name back into its surface slash-token form: * `'dev' -> '/dev'`, `'taste/foo' -> '/taste:foo'`. */ export declare function formatRefToken(canonicalName: string): string; /** * Classify the in-progress token (if any) touching `caret` in `text`, for * completion UX. Reuses the same whitespace/name-char predicates as * `findRefTokens`, but reports the UNTRIMMED maximal run so an incomplete * prefix (`/taste:` with nothing typed after the colon yet) or a caret sitting * mid-token (with more valid characters after it) both produce a full, * suffix-inclusive replacement range. Returns `null` when the caret is not * touching a token-shaped run. */ export declare function findRefTokenAtCaret(text: string, caret: number): RefCaretToken | null;