export interface ArgumentDescriptor { name?: string; } export interface FunctionDescriptor { name: string; description?: string; arguments?: ArgumentDescriptor[]; /** switching to literals */ type?: 'function' | 'token'; /** this is a named range or named expression. meaning a user/non-system name. */ named?: boolean; /** scope refers to sheet IDs. names may be scoped. */ scope?: number; } export interface AutocompleteMatchData { text: string; cursor: number; } export interface AutocompleteExecResult { completions?: FunctionDescriptor[]; token?: string; position?: number; tooltip?: string; arguments?: string; description?: string; function_position?: number; } export interface TooltipParserResult { function: string | undefined; argument: number; position: number; } export declare class AutocompleteMatcher { private function_names; private argument_separator; /** * making this public (and scrubbing the type). we need it public so we * can check collisions. I'm not sure why it was originally private... * * that's backwards. this should be private, and anyone checking * collisions should ask. also updating to modern type. * * OK so now a map. all names should be lower-cased for consistency (they * can maintain canonical names inside the object). */ private function_map; RemoveFunctions(functions: FunctionDescriptor | FunctionDescriptor[]): void; AddFunctions(functions: FunctionDescriptor | FunctionDescriptor[]): void; SetFunctions(functions: FunctionDescriptor[]): void; /** * returns the canonical version of the name, if it exists. * @param name * @returns */ NormalizeIdentifier(name: string): string | undefined; /** * accessor for entries. we're not stopping you from modifying * in place, for now, but don't do that. */ Get(name: string): FunctionDescriptor | undefined; Exec(data: AutocompleteMatchData): AutocompleteExecResult; /** * baby parser for generating tooltips. we want the name of the * current function, and the index of the current argument. * * not handled: escaped quotes (not even sure what the syntax for that is) */ ParseTooltip(expression: string): TooltipParserResult; /** * we maintain a sorted list of names. this needs to get updated * when the list changes. */ private UpdateNameList; }