import type * as ts from 'typescript/lib/tsserverlibrary'; /** * a-calc 字符串上下文信息 */ export interface AcalcStringContext { in_string: boolean; string_content: string; offset_in_string: number; /** 第二个参数的 AST 节点(用于提取变量) */ second_arg?: ts.Expression; /** 函数名 */ func_name?: string; /** 是否在纯格式化区域(fmt 第二参数、链式调用第二括号) */ is_format_only?: boolean; } /** * 检测位置是否在 calc/fmt 等函数的字符串参数内 */ export declare function is_in_acalc_string(ts_module: typeof ts, source_file: ts.SourceFile, position: number, type_checker?: ts.TypeChecker, logger?: { info: (msg: string) => void; }): AcalcStringContext; /** * 获取光标前的文本,用于判断触发条件 */ export declare function get_text_before_cursor(content: string, offset: number): string; /** * 补全触发类型 */ export type TriggerType = { type: 'preset_name'; prefix: string; } | { type: 'preset_value'; preset: string; prefix: string; } | { type: 'shortcut'; prefix: string; } | { type: 'format_syntax'; } | { type: 'variable'; prefix: string; } | { type: 'format_variable'; prefix: string; } | null; /** * 检测补全触发类型 * @param text_before 光标前的文本 * @param is_format_only 是否在纯格式化区域(fmt 第二参数、链式调用第二括号) */ export declare function detect_trigger(text_before: string, is_format_only?: boolean): TriggerType;