import type { SemanticTokens } from "vscode-languageserver/node.js"; import type { DocumentState } from "./documentState.js"; /** * The wire legend. Indices sent on the wire are positions in these * arrays, so the ORDER is part of the protocol contract — an already-open * editor holds the legend it was given at initialize time and will * re-color every token if these are reordered. Both the capability * announcement and the encoder read these same arrays so no index is * ever hand-written. `semanticTokens.test.ts` pins the order. */ export declare const TOKEN_TYPES: readonly ["function"]; export declare const TOKEN_MODIFIERS: readonly ["defaultLibrary"]; export type TokenType = (typeof TOKEN_TYPES)[number]; export declare const SEMANTIC_TOKENS_LEGEND: { tokenTypes: "function"[]; tokenModifiers: "defaultLibrary"[]; }; /** * `currentText` is the buffer as it is RIGHT NOW, which may differ from * the text `state` was built from. Omit it and the check falls back to * `state.info.sourceText` — older, but still the text these positions * were computed against. Only a state assembled with no source text at * all skips the check. * * Cost is O(identifiers x scopes): makeScopeFinder builds its definition * map once, but the finder it returns still scans the scope list per * call. Linear in identifiers alone would need the scopes sorted by * range and a binary search. Measured at 0.3-0.7 ms on real stdlib files * and 5.4 ms on a generated 1200-line file, so this is a note for the * next reader rather than a todo. */ export declare function getSemanticTokens(state: DocumentState, currentText?: string): SemanticTokens;