import type { SourceFile, Span, Token } from '../core/index.js'; /** The call the cursor is inside, as far as the brackets say. */ export interface CallSite { /** The callee as written, with its namespace: `ema`, `draw.box`. */ readonly name: string; readonly nameSpan: Span; /** Which argument the cursor is in, counting from zero. */ readonly argument: number; /** The label written for this argument, when it was written as `name = ...`. */ readonly label: string | undefined; /** Every label already written in this call, so a completion can drop them. */ readonly labels: readonly string[]; /** The bracket that opened it, which is what a host anchors a tooltip to. */ readonly open: Span; } /** What the cursor is on, and what it is inside. */ export interface Site { /** The word being typed, when the cursor is in or at the end of one. */ readonly word: string; /** Where it sits, so a host replaces the word rather than inserting into it. */ readonly replace: Span; /** The namespace the word follows, when it was written as `draw.` */ readonly namespace: string | undefined; /** Whether the cursor sits after a dot, where only members may be written. */ readonly afterDot: boolean; readonly call: CallSite | undefined; } /** * Everything the two functions need to know about a position. * * The word is the token the offset is inside or immediately after, which is * what a writer half way through typing a name has. A cursor sitting on a space * has no word and an empty replacement span at the cursor, so a host inserts * there rather than overwriting whatever is to the left. */ export declare function siteAt(file: SourceFile, tokens: readonly Token[], offset: number): Site; /** * The token an offset is inside, for a hover, which is not the same question. * * A completion is about what is being typed, so the token that ends at the * cursor is the word. A hover is about what is under the pointer, so the token * that contains the offset is the answer and one that merely ends there is not: * pointing at the space after `ema` is not pointing at `ema`. */ export declare function tokenOn(tokens: readonly Token[], offset: number): Token | undefined; //# sourceMappingURL=site.d.ts.map