/** * sfmc-language-lsp — SFMC Language Service * * Protocol-agnostic, browser-compatible language intelligence for * AMPscript, SSJS, and GTL. Used by the VS Code extension server and * the mcp-server-sfmc MCP server. */ import type { Diagnostic, CompletionItem, Hover, SignatureHelp, Location, CodeAction, Position } from './types.js'; import type { SfmcSettings } from './types.js'; import type { AmpscriptCallSite } from './validators/ampscript.js'; import type { SsjsFunction } from './data/ssjs.js'; import type { HandlebarsHelper, HandlebarsBinding, HandlebarsUnsupportedConstruct } from './data/handlebars.js'; export type { DocumentContext, SfmcSettings } from './types.js'; export { DEFAULT_SETTINGS } from './types.js'; export type { AmpscriptFunction, AmpscriptFunctionParam } from './data/ampscript.js'; export { isMcnSupported, getMcnApiVersion, getMcnNotes } from './data/ampscript.js'; export type { AmpscriptCallSite } from './validators/ampscript.js'; export type { SsjsFunction, SsjsFunctionParam, EcmascriptBuiltin, SsjsObject, } from './data/ssjs.js'; export type { LocalSsjsFunction } from './utils/markdown.js'; export type { HandlebarsHelper, HandlebarsBinding, HandlebarsUnsupportedConstruct, HandlebarsDataParam, } from './data/handlebars.js'; /** Import DocumentContext type locally for use in this file */ import type { DocumentContext } from './types.js'; /** * The main entry point for SFMC language intelligence. * Instantiate once; all methods are stateless and re-entrant. */ export declare class SfmcLanguageService { /** * Validate an AMPscript or SSJS document. Returns LSP Diagnostics. * @param doc - Document context with text and language ID. * @param settings - Validation settings. * @returns Array of LSP Diagnostic objects. */ validate(doc: DocumentContext, settings?: SfmcSettings): Diagnostic[]; /** * Return completion items at the given cursor position. * @param doc - Document context with text and language ID. * @param position - Cursor position. * @param settings - Service settings (gates MCN Handlebars completions). * @returns Array of LSP CompletionItem objects. */ getCompletions(doc: DocumentContext, position: Position, settings?: SfmcSettings): CompletionItem[]; /** * Resolve documentation for a completion item (lazy-loaded). * @param item - Completion item to resolve. * @returns The resolved completion item with documentation attached. */ resolveCompletion(item: CompletionItem): CompletionItem; /** * Return hover documentation at the given line/position. * @param doc - Document context with text and language ID. * @param line - The current document line text. * @param position - The cursor position. * @param settings - Service settings (gates MCN Handlebars hover). * @returns Hover object with Markdown documentation, or null. */ getHover(doc: DocumentContext, line: string, position: Position, settings?: SfmcSettings): Hover | null; /** * Return signature help at the given cursor position. * @param doc - Document context with text and language ID. * @param textUpToCursor - The document text from the start up to the cursor. * @param settings - Service settings (gates MCN Handlebars signature help). * @returns SignatureHelp object, or null if outside a function call. */ getSignatureHelp(doc: DocumentContext, textUpToCursor: string, settings?: SfmcSettings): SignatureHelp | null; /** * Return the definition location for the word at the given position. Only SSJS is supported. * @param doc - Document context with text and language ID. * @param word - Identifier name to locate. * @returns LSP Location of the definition, or null. */ getDefinition(doc: DocumentContext, word: string): Location | null; /** * Return quick-fix code actions for the given diagnostics. * @param doc - Document context with text and language ID. * @param diagnostics - Diagnostics to generate actions for. * @param settings - Service settings (gates MCN Handlebars code actions). * @returns Array of code actions. */ getCodeActions(doc: DocumentContext, diagnostics: Diagnostic[], settings?: SfmcSettings): CodeAction[]; /** * Look up an AMPscript function by name. Case-insensitive. * @param name - Function name to look up. * @returns The AMPscript function descriptor, or null if not found. */ lookupAmpscriptFunction(name: string): import("ampscript-data").AmpscriptDataFunction | null; /** * Return all AMPscript functions from the catalog. * @returns Array of all AMPscript function descriptors. */ listAmpscriptFunctions(): import("ampscript-data").AmpscriptDataFunction[]; /** * Look up an SSJS function or method by name. Case-insensitive. Searches all catalogs. * @param name - Function or method name to look up. * @returns The SSJS function descriptor, or null if not found. */ lookupSsjsFunction(name: string): SsjsFunction | null; /** * Return all AMPscript functions in the catalog. * @returns Array of all AMPscript function descriptors. */ getAllAmpscriptFunctions(): import("ampscript-data").AmpscriptDataFunction[]; /** * Return all SSJS functions and methods in the catalog. * @returns Array of all SSJS function descriptors across all namespaces. */ getAllSsjsFunctions(): SsjsFunction[]; /** * Return all AMPscript keyword names. * @returns Array of keyword name strings. */ getAmpscriptKeywords(): string[]; /** * Return the ES6+ syntax features that are unsupported in SFMC SSJS. * @returns Array of unsupported syntax pattern descriptors. */ getUnsupportedSsjsSyntax(): Array<{ pattern: string; message: string; }>; /** * Return the pre-built SSJS completion item catalog. * @returns Array of pre-built SSJS completion items. */ getSsjsCompletionCatalog(): CompletionItem[]; /** * Return the pre-built AMPscript function completion items. * @returns Array of pre-built AMPscript function completion items. */ getAmpscriptFunctionCompletionItems(): CompletionItem[]; /** * Look up an MCN Handlebars helper by name. Case-insensitive. * @param name - Helper name to look up (camelCase invoke form). * @returns The Handlebars helper descriptor, or null if not found. */ lookupHandlebarsHelper(name: string): HandlebarsHelper | null; /** * Return all MCN Handlebars helpers from the catalog. * @returns Array of all Handlebars helper descriptors. */ listHandlebarsHelpers(): HandlebarsHelper[]; /** * Return all built-in `{!$...}` data bindings from the catalog. * @returns Array of all Handlebars binding descriptors. */ listHandlebarsBindings(): HandlebarsBinding[]; /** * Return all unsupported Handlebars constructs (partials, decorators, and * built-in helpers absent from MCN's locked-down engine). * @returns Array of unsupported-construct descriptors. */ listHandlebarsUnsupportedConstructs(): HandlebarsUnsupportedConstruct[]; /** * Return the pre-built MCN Handlebars helper completion items. * @returns Array of pre-built Handlebars helper completion items. */ getHandlebarsCompletionCatalog(): CompletionItem[]; /** * Extract every AMPscript function call site from the given code. * Only calls to known AMPscript catalog functions are returned; unknown * identifiers and control-flow keywords are ignored. * @param code - Full document text (may include HTML with embedded AMPscript). * @returns Array of call sites in document order, each with name, line, and col. */ extractAmpscriptFunctionCalls(code: string): AmpscriptCallSite[]; } /** Shared singleton instance for callers that don't need separate instances. */ export declare const sfmcLanguageService: SfmcLanguageService; export { validateAmpscript, extractAmpscriptFunctionCalls } from './validators/ampscript.js'; export { validateSsjs } from './validators/ssjs.js'; export { validateGtlBlocks } from './validators/gtl.js'; export { extractLocalSsjsFunctions } from './definitions/ssjs.js'; //# sourceMappingURL=index.d.ts.map