sfmc-language-lsp 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/README.md +25 -0
  2. package/dist/cjs/codeActions/{ampscript.js → ampscript.cjs} +20 -5
  3. package/dist/cjs/codeActions/ampscript.d.ts +7 -1
  4. package/dist/cjs/codeActions/ampscript.d.ts.map +1 -1
  5. package/dist/cjs/codeActions/ampscript.js.map +1 -1
  6. package/dist/cjs/completions/{ampscript.js → ampscript.cjs} +23 -9
  7. package/dist/cjs/completions/ampscript.d.ts +11 -2
  8. package/dist/cjs/completions/ampscript.d.ts.map +1 -1
  9. package/dist/cjs/completions/ampscript.js.map +1 -1
  10. package/dist/cjs/completions/ssjs.cjs +305 -0
  11. package/dist/cjs/completions/ssjs.d.ts +5 -1
  12. package/dist/cjs/completions/ssjs.d.ts.map +1 -1
  13. package/dist/cjs/completions/ssjs.js.map +1 -1
  14. package/dist/cjs/data/{ampscript.js → ampscript.cjs} +6 -1
  15. package/dist/cjs/data/ampscript.d.ts.map +1 -1
  16. package/dist/cjs/data/ampscript.js.map +1 -1
  17. package/dist/cjs/data/{ssjs.js → ssjs.cjs} +14 -4
  18. package/dist/cjs/data/ssjs.d.ts +7 -1
  19. package/dist/cjs/data/ssjs.d.ts.map +1 -1
  20. package/dist/cjs/data/ssjs.js.map +1 -1
  21. package/dist/cjs/definitions/{ssjs.js → ssjs.cjs} +16 -3
  22. package/dist/cjs/definitions/ssjs.d.ts +6 -0
  23. package/dist/cjs/definitions/ssjs.d.ts.map +1 -1
  24. package/dist/cjs/definitions/ssjs.js.map +1 -1
  25. package/dist/cjs/hover/{ampscript.js → ampscript.cjs} +18 -7
  26. package/dist/cjs/hover/ampscript.d.ts +6 -1
  27. package/dist/cjs/hover/ampscript.d.ts.map +1 -1
  28. package/dist/cjs/hover/ampscript.js.map +1 -1
  29. package/dist/cjs/hover/ssjs.cjs +323 -0
  30. package/dist/cjs/hover/ssjs.d.ts +7 -1
  31. package/dist/cjs/hover/ssjs.d.ts.map +1 -1
  32. package/dist/cjs/hover/ssjs.js.map +1 -1
  33. package/dist/cjs/{index.js → index.cjs} +135 -46
  34. package/dist/cjs/index.d.ts +77 -16
  35. package/dist/cjs/index.d.ts.map +1 -1
  36. package/dist/cjs/index.js.map +1 -1
  37. package/dist/cjs/signature/{ampscript.js → ampscript.cjs} +12 -4
  38. package/dist/cjs/signature/ampscript.d.ts +7 -1
  39. package/dist/cjs/signature/ampscript.d.ts.map +1 -1
  40. package/dist/cjs/signature/ampscript.js.map +1 -1
  41. package/dist/cjs/signature/{ssjs.js → ssjs.cjs} +42 -19
  42. package/dist/cjs/signature/ssjs.d.ts +8 -1
  43. package/dist/cjs/signature/ssjs.d.ts.map +1 -1
  44. package/dist/cjs/signature/ssjs.js.map +1 -1
  45. package/dist/cjs/utils/{comments.js → comments.cjs} +11 -2
  46. package/dist/cjs/utils/comments.d.ts +11 -2
  47. package/dist/cjs/utils/comments.d.ts.map +1 -1
  48. package/dist/cjs/utils/comments.js.map +1 -1
  49. package/dist/cjs/utils/{markdown.js → markdown.cjs} +32 -7
  50. package/dist/cjs/utils/markdown.d.ts +30 -6
  51. package/dist/cjs/utils/markdown.d.ts.map +1 -1
  52. package/dist/cjs/utils/markdown.js.map +1 -1
  53. package/dist/cjs/utils/{positions.js → positions.cjs} +19 -4
  54. package/dist/cjs/utils/positions.d.ts +18 -3
  55. package/dist/cjs/utils/positions.d.ts.map +1 -1
  56. package/dist/cjs/utils/positions.js.map +1 -1
  57. package/dist/cjs/utils/{regions.js → regions.cjs} +8 -0
  58. package/dist/cjs/utils/regions.d.ts +8 -0
  59. package/dist/cjs/utils/regions.d.ts.map +1 -1
  60. package/dist/cjs/utils/regions.js.map +1 -1
  61. package/dist/cjs/utils/{text.js → text.cjs} +22 -2
  62. package/dist/cjs/utils/text.d.ts +22 -2
  63. package/dist/cjs/utils/text.d.ts.map +1 -1
  64. package/dist/cjs/utils/text.js.map +1 -1
  65. package/dist/cjs/validators/{ampscript.js → ampscript.cjs} +112 -31
  66. package/dist/cjs/validators/ampscript.d.ts +6 -1
  67. package/dist/cjs/validators/ampscript.d.ts.map +1 -1
  68. package/dist/cjs/validators/ampscript.js.map +1 -1
  69. package/dist/cjs/validators/{gtl.js → gtl.cjs} +5 -2
  70. package/dist/cjs/validators/gtl.d.ts +3 -0
  71. package/dist/cjs/validators/gtl.d.ts.map +1 -1
  72. package/dist/cjs/validators/gtl.js.map +1 -1
  73. package/dist/cjs/validators/{ssjs.js → ssjs.cjs} +70 -16
  74. package/dist/cjs/validators/ssjs.d.ts +6 -1
  75. package/dist/cjs/validators/ssjs.d.ts.map +1 -1
  76. package/dist/cjs/validators/ssjs.js.map +1 -1
  77. package/dist/esm/codeActions/ampscript.d.ts +7 -1
  78. package/dist/esm/codeActions/ampscript.d.ts.map +1 -1
  79. package/dist/esm/codeActions/ampscript.js +17 -2
  80. package/dist/esm/codeActions/ampscript.js.map +1 -1
  81. package/dist/esm/completions/ampscript.d.ts +11 -2
  82. package/dist/esm/completions/ampscript.d.ts.map +1 -1
  83. package/dist/esm/completions/ampscript.js +18 -4
  84. package/dist/esm/completions/ampscript.js.map +1 -1
  85. package/dist/esm/completions/ssjs.d.ts +5 -1
  86. package/dist/esm/completions/ssjs.d.ts.map +1 -1
  87. package/dist/esm/completions/ssjs.js +223 -21
  88. package/dist/esm/completions/ssjs.js.map +1 -1
  89. package/dist/esm/data/ampscript.d.ts.map +1 -1
  90. package/dist/esm/data/ampscript.js +6 -1
  91. package/dist/esm/data/ampscript.js.map +1 -1
  92. package/dist/esm/data/ssjs.d.ts +7 -1
  93. package/dist/esm/data/ssjs.d.ts.map +1 -1
  94. package/dist/esm/data/ssjs.js +14 -4
  95. package/dist/esm/data/ssjs.js.map +1 -1
  96. package/dist/esm/definitions/ssjs.d.ts +6 -0
  97. package/dist/esm/definitions/ssjs.d.ts.map +1 -1
  98. package/dist/esm/definitions/ssjs.js +15 -2
  99. package/dist/esm/definitions/ssjs.js.map +1 -1
  100. package/dist/esm/hover/ampscript.d.ts +6 -1
  101. package/dist/esm/hover/ampscript.d.ts.map +1 -1
  102. package/dist/esm/hover/ampscript.js +14 -3
  103. package/dist/esm/hover/ampscript.js.map +1 -1
  104. package/dist/esm/hover/ssjs.d.ts +7 -1
  105. package/dist/esm/hover/ssjs.d.ts.map +1 -1
  106. package/dist/esm/hover/ssjs.js +199 -37
  107. package/dist/esm/hover/ssjs.js.map +1 -1
  108. package/dist/esm/index.d.ts +77 -16
  109. package/dist/esm/index.d.ts.map +1 -1
  110. package/dist/esm/index.js +118 -29
  111. package/dist/esm/index.js.map +1 -1
  112. package/dist/esm/signature/ampscript.d.ts +7 -1
  113. package/dist/esm/signature/ampscript.d.ts.map +1 -1
  114. package/dist/esm/signature/ampscript.js +11 -3
  115. package/dist/esm/signature/ampscript.js.map +1 -1
  116. package/dist/esm/signature/ssjs.d.ts +8 -1
  117. package/dist/esm/signature/ssjs.d.ts.map +1 -1
  118. package/dist/esm/signature/ssjs.js +42 -19
  119. package/dist/esm/signature/ssjs.js.map +1 -1
  120. package/dist/esm/utils/comments.d.ts +11 -2
  121. package/dist/esm/utils/comments.d.ts.map +1 -1
  122. package/dist/esm/utils/comments.js +11 -2
  123. package/dist/esm/utils/comments.js.map +1 -1
  124. package/dist/esm/utils/markdown.d.ts +30 -6
  125. package/dist/esm/utils/markdown.d.ts.map +1 -1
  126. package/dist/esm/utils/markdown.js +32 -7
  127. package/dist/esm/utils/markdown.js.map +1 -1
  128. package/dist/esm/utils/positions.d.ts +18 -3
  129. package/dist/esm/utils/positions.d.ts.map +1 -1
  130. package/dist/esm/utils/positions.js +19 -4
  131. package/dist/esm/utils/positions.js.map +1 -1
  132. package/dist/esm/utils/regions.d.ts +8 -0
  133. package/dist/esm/utils/regions.d.ts.map +1 -1
  134. package/dist/esm/utils/regions.js +8 -0
  135. package/dist/esm/utils/regions.js.map +1 -1
  136. package/dist/esm/utils/text.d.ts +22 -2
  137. package/dist/esm/utils/text.d.ts.map +1 -1
  138. package/dist/esm/utils/text.js +22 -2
  139. package/dist/esm/utils/text.js.map +1 -1
  140. package/dist/esm/validators/ampscript.d.ts +6 -1
  141. package/dist/esm/validators/ampscript.d.ts.map +1 -1
  142. package/dist/esm/validators/ampscript.js +106 -25
  143. package/dist/esm/validators/ampscript.js.map +1 -1
  144. package/dist/esm/validators/gtl.d.ts +3 -0
  145. package/dist/esm/validators/gtl.d.ts.map +1 -1
  146. package/dist/esm/validators/gtl.js +3 -0
  147. package/dist/esm/validators/gtl.js.map +1 -1
  148. package/dist/esm/validators/ssjs.d.ts +6 -1
  149. package/dist/esm/validators/ssjs.d.ts.map +1 -1
  150. package/dist/esm/validators/ssjs.js +65 -11
  151. package/dist/esm/validators/ssjs.js.map +1 -1
  152. package/dist/types/codeActions/ampscript.d.ts +7 -1
  153. package/dist/types/codeActions/ampscript.d.ts.map +1 -1
  154. package/dist/types/completions/ampscript.d.ts +11 -2
  155. package/dist/types/completions/ampscript.d.ts.map +1 -1
  156. package/dist/types/completions/ssjs.d.ts +5 -1
  157. package/dist/types/completions/ssjs.d.ts.map +1 -1
  158. package/dist/types/data/ampscript.d.ts.map +1 -1
  159. package/dist/types/data/ssjs.d.ts +7 -1
  160. package/dist/types/data/ssjs.d.ts.map +1 -1
  161. package/dist/types/definitions/ssjs.d.ts +6 -0
  162. package/dist/types/definitions/ssjs.d.ts.map +1 -1
  163. package/dist/types/hover/ampscript.d.ts +6 -1
  164. package/dist/types/hover/ampscript.d.ts.map +1 -1
  165. package/dist/types/hover/ssjs.d.ts +7 -1
  166. package/dist/types/hover/ssjs.d.ts.map +1 -1
  167. package/dist/types/index.d.ts +77 -16
  168. package/dist/types/index.d.ts.map +1 -1
  169. package/dist/types/signature/ampscript.d.ts +7 -1
  170. package/dist/types/signature/ampscript.d.ts.map +1 -1
  171. package/dist/types/signature/ssjs.d.ts +8 -1
  172. package/dist/types/signature/ssjs.d.ts.map +1 -1
  173. package/dist/types/utils/comments.d.ts +11 -2
  174. package/dist/types/utils/comments.d.ts.map +1 -1
  175. package/dist/types/utils/markdown.d.ts +30 -6
  176. package/dist/types/utils/markdown.d.ts.map +1 -1
  177. package/dist/types/utils/positions.d.ts +18 -3
  178. package/dist/types/utils/positions.d.ts.map +1 -1
  179. package/dist/types/utils/regions.d.ts +8 -0
  180. package/dist/types/utils/regions.d.ts.map +1 -1
  181. package/dist/types/utils/text.d.ts +22 -2
  182. package/dist/types/utils/text.d.ts.map +1 -1
  183. package/dist/types/validators/ampscript.d.ts +6 -1
  184. package/dist/types/validators/ampscript.d.ts.map +1 -1
  185. package/dist/types/validators/gtl.d.ts +3 -0
  186. package/dist/types/validators/gtl.d.ts.map +1 -1
  187. package/dist/types/validators/ssjs.d.ts +6 -1
  188. package/dist/types/validators/ssjs.d.ts.map +1 -1
  189. package/package.json +28 -9
  190. package/dist/cjs/completions/ssjs.js +0 -103
  191. package/dist/cjs/hover/ssjs.js +0 -161
  192. /package/dist/cjs/{types.js → types.cjs} +0 -0
@@ -8,21 +8,21 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.extractLocalSsjsFunctions = exports.validateGtlBlocks = exports.validateSsjs = exports.validateAmpscript = exports.sfmcLanguageService = exports.SfmcLanguageService = exports.DEFAULT_SETTINGS = void 0;
11
- const types_js_1 = require("./types.js");
12
- const ampscript_js_1 = require("./validators/ampscript.js");
13
- const ssjs_js_1 = require("./validators/ssjs.js");
14
- const ampscript_js_2 = require("./completions/ampscript.js");
15
- const ssjs_js_2 = require("./completions/ssjs.js");
16
- const ampscript_js_3 = require("./hover/ampscript.js");
17
- const ssjs_js_3 = require("./hover/ssjs.js");
18
- const ampscript_js_4 = require("./signature/ampscript.js");
19
- const ssjs_js_4 = require("./signature/ssjs.js");
20
- const ssjs_js_5 = require("./definitions/ssjs.js");
21
- const ampscript_js_5 = require("./codeActions/ampscript.js");
22
- const ampscript_js_6 = require("./data/ampscript.js");
23
- const ssjs_js_6 = require("./data/ssjs.js");
24
- const text_js_1 = require("./utils/text.js");
25
- var types_js_2 = require("./types.js");
11
+ const types_js_1 = require("./types.cjs");
12
+ const ampscript_js_1 = require("./validators/ampscript.cjs");
13
+ const ssjs_js_1 = require("./validators/ssjs.cjs");
14
+ const ampscript_js_2 = require("./completions/ampscript.cjs");
15
+ const ssjs_js_2 = require("./completions/ssjs.cjs");
16
+ const ampscript_js_3 = require("./hover/ampscript.cjs");
17
+ const ssjs_js_3 = require("./hover/ssjs.cjs");
18
+ const ampscript_js_4 = require("./signature/ampscript.cjs");
19
+ const ssjs_js_4 = require("./signature/ssjs.cjs");
20
+ const ssjs_js_5 = require("./definitions/ssjs.cjs");
21
+ const ampscript_js_5 = require("./codeActions/ampscript.cjs");
22
+ const ampscript_js_6 = require("./data/ampscript.cjs");
23
+ const ssjs_js_6 = require("./data/ssjs.cjs");
24
+ const text_js_1 = require("./utils/text.cjs");
25
+ var types_js_2 = require("./types.cjs");
26
26
  Object.defineProperty(exports, "DEFAULT_SETTINGS", { enumerable: true, get: function () { return types_js_2.DEFAULT_SETTINGS; } });
27
27
  /**
28
28
  * The main entry point for SFMC language intelligence.
@@ -30,7 +30,12 @@ Object.defineProperty(exports, "DEFAULT_SETTINGS", { enumerable: true, get: func
30
30
  */
31
31
  class SfmcLanguageService {
32
32
  // ── Validation ────────────────────────────────────────────────────────────
33
- /** Validate an AMPscript or SSJS document. Returns LSP Diagnostics. */
33
+ /**
34
+ * Validate an AMPscript or SSJS document. Returns LSP Diagnostics.
35
+ * @param doc - Document context with text and language ID.
36
+ * @param settings - Validation settings.
37
+ * @returns Array of LSP Diagnostic objects.
38
+ */
34
39
  validate(doc, settings = types_js_1.DEFAULT_SETTINGS) {
35
40
  if (doc.languageId === 'ssjs') {
36
41
  return (0, ssjs_js_1.validateSsjs)(doc.text, settings);
@@ -38,7 +43,12 @@ class SfmcLanguageService {
38
43
  return (0, ampscript_js_1.validateAmpscript)(doc.text, settings);
39
44
  }
40
45
  // ── Completions ───────────────────────────────────────────────────────────
41
- /** Return completion items at the given cursor position. */
46
+ /**
47
+ * Return completion items at the given cursor position.
48
+ * @param doc - Document context with text and language ID.
49
+ * @param position - Cursor position.
50
+ * @returns Array of LSP CompletionItem objects.
51
+ */
42
52
  getCompletions(doc, position) {
43
53
  if (doc.languageId === 'ssjs') {
44
54
  const localFns = (0, ssjs_js_5.extractLocalSsjsFunctions)(doc.text);
@@ -47,12 +57,22 @@ class SfmcLanguageService {
47
57
  }
48
58
  return (0, ampscript_js_2.getAmpscriptCompletions)(doc.text, position);
49
59
  }
50
- /** Resolve documentation for a completion item (lazy-loaded). */
60
+ /**
61
+ * Resolve documentation for a completion item (lazy-loaded).
62
+ * @param item - Completion item to resolve.
63
+ * @returns The resolved completion item with documentation attached.
64
+ */
51
65
  resolveCompletion(item) {
52
66
  return (0, ampscript_js_2.resolveAmpscriptCompletion)(item);
53
67
  }
54
68
  // ── Hover ─────────────────────────────────────────────────────────────────
55
- /** Return hover documentation at the given line/position. */
69
+ /**
70
+ * Return hover documentation at the given line/position.
71
+ * @param doc - Document context with text and language ID.
72
+ * @param line - The current document line text.
73
+ * @param position - The cursor position.
74
+ * @returns Hover object with Markdown documentation, or null.
75
+ */
56
76
  getHover(doc, line, position) {
57
77
  if (doc.languageId === 'ssjs') {
58
78
  const localFns = (0, ssjs_js_5.extractLocalSsjsFunctions)(doc.text);
@@ -61,7 +81,12 @@ class SfmcLanguageService {
61
81
  return (0, ampscript_js_3.getAmpscriptHover)(line, position);
62
82
  }
63
83
  // ── Signature Help ────────────────────────────────────────────────────────
64
- /** Return signature help at the given cursor position. */
84
+ /**
85
+ * Return signature help at the given cursor position.
86
+ * @param doc - Document context with text and language ID.
87
+ * @param textUpToCursor - The document text from the start up to the cursor.
88
+ * @returns SignatureHelp object, or null if outside a function call.
89
+ */
65
90
  getSignatureHelp(doc, textUpToCursor) {
66
91
  const context = (0, text_js_1.findFunctionContext)(textUpToCursor);
67
92
  if (!context)
@@ -73,68 +98,132 @@ class SfmcLanguageService {
73
98
  return (0, ampscript_js_4.getAmpscriptSignatureHelp)(context);
74
99
  }
75
100
  // ── Go to Definition ──────────────────────────────────────────────────────
76
- /** Return the definition location for the word at the given position. Only SSJS is supported. */
101
+ /**
102
+ * Return the definition location for the word at the given position. Only SSJS is supported.
103
+ * @param doc - Document context with text and language ID.
104
+ * @param word - Identifier name to locate.
105
+ * @returns LSP Location of the definition, or null.
106
+ */
77
107
  getDefinition(doc, word) {
78
108
  if (doc.languageId !== 'ssjs')
79
109
  return null;
80
110
  return (0, ssjs_js_5.getSsjsDefinition)(doc.text, doc.uri ?? '', word);
81
111
  }
82
112
  // ── Code Actions ──────────────────────────────────────────────────────────
83
- /** Return quick-fix code actions for the given diagnostics. */
113
+ /**
114
+ * Return quick-fix code actions for the given diagnostics.
115
+ * @param doc - Document context with text and language ID.
116
+ * @param diagnostics - Diagnostics to generate actions for.
117
+ * @returns Array of code actions.
118
+ */
84
119
  getCodeActions(doc, diagnostics) {
85
120
  if (doc.languageId === 'ssjs')
86
121
  return [];
87
122
  return (0, ampscript_js_5.getAmpscriptCodeActions)(doc.text, doc.uri ?? '', diagnostics);
88
123
  }
89
124
  // ── Catalog / Lookup (for MCP tools and resources) ────────────────────────
90
- /** Look up an AMPscript function by name. Case-insensitive. */
125
+ /**
126
+ * Look up an AMPscript function by name. Case-insensitive.
127
+ * @param name - Function name to look up.
128
+ * @returns The AMPscript function descriptor, or null if not found.
129
+ */
91
130
  lookupAmpscriptFunction(name) {
92
131
  return ampscript_js_6.functionLookup.get(name.toLowerCase()) ?? null;
93
132
  }
94
- /** Look up an SSJS function or method by name. Case-insensitive. Searches all catalogs. */
133
+ /**
134
+ * Look up an SSJS function or method by name. Case-insensitive. Searches all catalogs.
135
+ * @param name - Function or method name to look up.
136
+ * @returns The SSJS function descriptor, or null if not found.
137
+ */
95
138
  lookupSsjsFunction(name) {
96
139
  const lower = name.toLowerCase();
97
140
  const allFns = [
98
- ...ssjs_js_6.platformMethods, ...ssjs_js_6.platformFunctions, ...ssjs_js_6.ssjsGlobals,
99
- ...ssjs_js_6.platformVariableMethods, ...ssjs_js_6.platformResponseMethods, ...ssjs_js_6.platformRequestMethods,
100
- ...ssjs_js_6.platformClientBrowserMethods, ...ssjs_js_6.platformRecipientMethods,
101
- ...ssjs_js_6.wsproxyMethods, ...ssjs_js_6.httpMethods,
141
+ ...ssjs_js_6.platformMethods,
142
+ ...ssjs_js_6.platformFunctions,
143
+ ...ssjs_js_6.ssjsGlobals,
144
+ ...ssjs_js_6.platformVariableMethods,
145
+ ...ssjs_js_6.platformResponseMethods,
146
+ ...ssjs_js_6.platformRequestMethods,
147
+ ...ssjs_js_6.platformRecipientMethods,
148
+ ...ssjs_js_6.wsproxyMethods,
149
+ ...ssjs_js_6.httpMethods,
150
+ ...ssjs_js_6.httpHeaderMethods,
151
+ ...ssjs_js_6.dateTimeTimezoneMethods,
152
+ ...ssjs_js_6.errorUtilMethods,
102
153
  ];
103
154
  return allFns.find((f) => f.name.toLowerCase() === lower) ?? null;
104
155
  }
105
- /** Return all AMPscript functions in the catalog. */
156
+ /**
157
+ * Return all AMPscript functions in the catalog.
158
+ * @returns Array of all AMPscript function descriptors.
159
+ */
106
160
  getAllAmpscriptFunctions() {
107
161
  return ampscript_js_6.ampscriptFunctions;
108
162
  }
109
- /** Return all SSJS functions and methods in the catalog. */
163
+ /**
164
+ * Return all SSJS functions and methods in the catalog.
165
+ * @returns Array of all SSJS function descriptors across all namespaces.
166
+ */
110
167
  getAllSsjsFunctions() {
111
168
  return [
112
- ...ssjs_js_6.platformMethods, ...ssjs_js_6.platformFunctions, ...ssjs_js_6.ssjsGlobals,
113
- ...ssjs_js_6.platformVariableMethods, ...ssjs_js_6.platformResponseMethods, ...ssjs_js_6.platformRequestMethods,
114
- ...ssjs_js_6.platformClientBrowserMethods, ...ssjs_js_6.platformRecipientMethods,
115
- ...ssjs_js_6.wsproxyMethods, ...ssjs_js_6.httpMethods,
169
+ ...ssjs_js_6.platformMethods,
170
+ ...ssjs_js_6.platformFunctions,
171
+ ...ssjs_js_6.ssjsGlobals,
172
+ ...ssjs_js_6.platformVariableMethods,
173
+ ...ssjs_js_6.platformResponseMethods,
174
+ ...ssjs_js_6.platformRequestMethods,
175
+ ...ssjs_js_6.platformRecipientMethods,
176
+ ...ssjs_js_6.wsproxyMethods,
177
+ ...ssjs_js_6.httpMethods,
178
+ ...ssjs_js_6.httpHeaderMethods,
179
+ ...ssjs_js_6.dateTimeTimezoneMethods,
180
+ ...ssjs_js_6.errorUtilMethods,
116
181
  ];
117
182
  }
118
- /** Return all AMPscript keyword names. */
183
+ /**
184
+ * Return all AMPscript keyword names.
185
+ * @returns Array of keyword name strings.
186
+ */
119
187
  getAmpscriptKeywords() {
120
188
  return ampscript_js_6.ampscriptKeywords.map((kw) => kw.name);
121
189
  }
122
- /** Return the ES6+ syntax features that are unsupported in SFMC SSJS. */
190
+ /**
191
+ * Return the ES6+ syntax features that are unsupported in SFMC SSJS.
192
+ * @returns Array of unsupported syntax pattern descriptors.
193
+ */
123
194
  getUnsupportedSsjsSyntax() {
124
195
  return [
125
- { pattern: 'let/const', message: "'let'/'const' declarations are not supported in SFMC SSJS. Use 'var' instead." },
126
- { pattern: '=>', message: 'Arrow functions are not supported in SFMC SSJS. Use a regular function expression.' },
127
- { pattern: '`template literals`', message: 'Template literals are not supported in SFMC SSJS. Use string concatenation.' },
128
- { pattern: 'class', message: 'Class declarations are not supported in SFMC SSJS. Use constructor functions.' },
196
+ {
197
+ pattern: 'let/const',
198
+ message: "'let'/'const' declarations are not supported in SFMC SSJS. Use 'var' instead.",
199
+ },
200
+ {
201
+ pattern: '=>',
202
+ message: 'Arrow functions are not supported in SFMC SSJS. Use a regular function expression.',
203
+ },
204
+ {
205
+ pattern: '`template literals`',
206
+ message: 'Template literals are not supported in SFMC SSJS. Use string concatenation.',
207
+ },
208
+ {
209
+ pattern: 'class',
210
+ message: 'Class declarations are not supported in SFMC SSJS. Use constructor functions.',
211
+ },
129
212
  { pattern: 'async/await', message: 'Async/await is not supported in SFMC SSJS.' },
130
213
  ];
131
214
  }
132
215
  // ── Static completion catalog access ──────────────────────────────────────
133
- /** Return the pre-built SSJS completion item catalog. */
216
+ /**
217
+ * Return the pre-built SSJS completion item catalog.
218
+ * @returns Array of pre-built SSJS completion items.
219
+ */
134
220
  getSsjsCompletionCatalog() {
135
221
  return ssjs_js_2.ssjsCompletionItems;
136
222
  }
137
- /** Return the pre-built AMPscript function completion items. */
223
+ /**
224
+ * Return the pre-built AMPscript function completion items.
225
+ * @returns Array of pre-built AMPscript function completion items.
226
+ */
138
227
  getAmpscriptFunctionCompletionItems() {
139
228
  return ampscript_js_2.functionCompletionItems;
140
229
  }
@@ -143,12 +232,12 @@ exports.SfmcLanguageService = SfmcLanguageService;
143
232
  /** Shared singleton instance for callers that don't need separate instances. */
144
233
  exports.sfmcLanguageService = new SfmcLanguageService();
145
234
  // Re-export validators for direct use
146
- var ampscript_js_7 = require("./validators/ampscript.js");
235
+ var ampscript_js_7 = require("./validators/ampscript.cjs");
147
236
  Object.defineProperty(exports, "validateAmpscript", { enumerable: true, get: function () { return ampscript_js_7.validateAmpscript; } });
148
- var ssjs_js_7 = require("./validators/ssjs.js");
237
+ var ssjs_js_7 = require("./validators/ssjs.cjs");
149
238
  Object.defineProperty(exports, "validateSsjs", { enumerable: true, get: function () { return ssjs_js_7.validateSsjs; } });
150
- var gtl_js_1 = require("./validators/gtl.js");
239
+ var gtl_js_1 = require("./validators/gtl.cjs");
151
240
  Object.defineProperty(exports, "validateGtlBlocks", { enumerable: true, get: function () { return gtl_js_1.validateGtlBlocks; } });
152
- var ssjs_js_8 = require("./definitions/ssjs.js");
241
+ var ssjs_js_8 = require("./definitions/ssjs.cjs");
153
242
  Object.defineProperty(exports, "extractLocalSsjsFunctions", { enumerable: true, get: function () { return ssjs_js_8.extractLocalSsjsFunctions; } });
154
243
  //# sourceMappingURL=index.js.map
@@ -11,7 +11,7 @@ import type { SsjsFunction } from './data/ssjs.js';
11
11
  export type { DocumentContext, SfmcSettings } from './types.js';
12
12
  export { DEFAULT_SETTINGS } from './types.js';
13
13
  export type { AmpscriptFunction, AmpscriptFunctionParam } from './data/ampscript.js';
14
- export type { SsjsFunction, SsjsFunctionParam, EcmascriptBuiltin, SsjsObject } from './data/ssjs.js';
14
+ export type { SsjsFunction, SsjsFunctionParam, EcmascriptBuiltin, SsjsObject, } from './data/ssjs.js';
15
15
  export type { LocalSsjsFunction } from './utils/markdown.js';
16
16
  /** Import DocumentContext type locally for use in this file */
17
17
  import type { DocumentContext } from './types.js';
@@ -20,38 +20,99 @@ import type { DocumentContext } from './types.js';
20
20
  * Instantiate once; all methods are stateless and re-entrant.
21
21
  */
22
22
  export declare class SfmcLanguageService {
23
- /** Validate an AMPscript or SSJS document. Returns LSP Diagnostics. */
23
+ /**
24
+ * Validate an AMPscript or SSJS document. Returns LSP Diagnostics.
25
+ * @param doc - Document context with text and language ID.
26
+ * @param settings - Validation settings.
27
+ * @returns Array of LSP Diagnostic objects.
28
+ */
24
29
  validate(doc: DocumentContext, settings?: SfmcSettings): Diagnostic[];
25
- /** Return completion items at the given cursor position. */
30
+ /**
31
+ * Return completion items at the given cursor position.
32
+ * @param doc - Document context with text and language ID.
33
+ * @param position - Cursor position.
34
+ * @returns Array of LSP CompletionItem objects.
35
+ */
26
36
  getCompletions(doc: DocumentContext, position: Position): CompletionItem[];
27
- /** Resolve documentation for a completion item (lazy-loaded). */
37
+ /**
38
+ * Resolve documentation for a completion item (lazy-loaded).
39
+ * @param item - Completion item to resolve.
40
+ * @returns The resolved completion item with documentation attached.
41
+ */
28
42
  resolveCompletion(item: CompletionItem): CompletionItem;
29
- /** Return hover documentation at the given line/position. */
43
+ /**
44
+ * Return hover documentation at the given line/position.
45
+ * @param doc - Document context with text and language ID.
46
+ * @param line - The current document line text.
47
+ * @param position - The cursor position.
48
+ * @returns Hover object with Markdown documentation, or null.
49
+ */
30
50
  getHover(doc: DocumentContext, line: string, position: Position): Hover | null;
31
- /** Return signature help at the given cursor position. */
51
+ /**
52
+ * Return signature help at the given cursor position.
53
+ * @param doc - Document context with text and language ID.
54
+ * @param textUpToCursor - The document text from the start up to the cursor.
55
+ * @returns SignatureHelp object, or null if outside a function call.
56
+ */
32
57
  getSignatureHelp(doc: DocumentContext, textUpToCursor: string): SignatureHelp | null;
33
- /** Return the definition location for the word at the given position. Only SSJS is supported. */
58
+ /**
59
+ * Return the definition location for the word at the given position. Only SSJS is supported.
60
+ * @param doc - Document context with text and language ID.
61
+ * @param word - Identifier name to locate.
62
+ * @returns LSP Location of the definition, or null.
63
+ */
34
64
  getDefinition(doc: DocumentContext, word: string): Location | null;
35
- /** Return quick-fix code actions for the given diagnostics. */
65
+ /**
66
+ * Return quick-fix code actions for the given diagnostics.
67
+ * @param doc - Document context with text and language ID.
68
+ * @param diagnostics - Diagnostics to generate actions for.
69
+ * @returns Array of code actions.
70
+ */
36
71
  getCodeActions(doc: DocumentContext, diagnostics: Diagnostic[]): CodeAction[];
37
- /** Look up an AMPscript function by name. Case-insensitive. */
72
+ /**
73
+ * Look up an AMPscript function by name. Case-insensitive.
74
+ * @param name - Function name to look up.
75
+ * @returns The AMPscript function descriptor, or null if not found.
76
+ */
38
77
  lookupAmpscriptFunction(name: string): import("./data/ampscript.js").AmpscriptFunction | null;
39
- /** Look up an SSJS function or method by name. Case-insensitive. Searches all catalogs. */
78
+ /**
79
+ * Look up an SSJS function or method by name. Case-insensitive. Searches all catalogs.
80
+ * @param name - Function or method name to look up.
81
+ * @returns The SSJS function descriptor, or null if not found.
82
+ */
40
83
  lookupSsjsFunction(name: string): SsjsFunction | null;
41
- /** Return all AMPscript functions in the catalog. */
84
+ /**
85
+ * Return all AMPscript functions in the catalog.
86
+ * @returns Array of all AMPscript function descriptors.
87
+ */
42
88
  getAllAmpscriptFunctions(): import("./data/ampscript.js").AmpscriptFunction[];
43
- /** Return all SSJS functions and methods in the catalog. */
89
+ /**
90
+ * Return all SSJS functions and methods in the catalog.
91
+ * @returns Array of all SSJS function descriptors across all namespaces.
92
+ */
44
93
  getAllSsjsFunctions(): SsjsFunction[];
45
- /** Return all AMPscript keyword names. */
94
+ /**
95
+ * Return all AMPscript keyword names.
96
+ * @returns Array of keyword name strings.
97
+ */
46
98
  getAmpscriptKeywords(): string[];
47
- /** Return the ES6+ syntax features that are unsupported in SFMC SSJS. */
99
+ /**
100
+ * Return the ES6+ syntax features that are unsupported in SFMC SSJS.
101
+ * @returns Array of unsupported syntax pattern descriptors.
102
+ */
48
103
  getUnsupportedSsjsSyntax(): Array<{
49
104
  pattern: string;
50
105
  message: string;
51
106
  }>;
52
- /** Return the pre-built SSJS completion item catalog. */
107
+ /**
108
+ * Return the pre-built SSJS completion item catalog.
109
+ * @returns Array of pre-built SSJS completion items.
110
+ */
53
111
  getSsjsCompletionCatalog(): CompletionItem[];
54
- /** Return the pre-built AMPscript function completion items. */
112
+ /**
113
+ * Return the pre-built AMPscript function completion items.
114
+ * @returns Array of pre-built AMPscript function completion items.
115
+ */
55
116
  getAmpscriptFunctionCompletionItems(): CompletionItem[];
56
117
  }
57
118
  /** Shared singleton instance for callers that don't need separate instances. */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACnH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAgC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,M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AE,qBAAqB;gBAC9B,OAAO,EACH,6EAA6E;aACpF;YACD;gBACI,OAAO,EAAE,OAAO;gBAChB,OAAO,EACH,+EAA+E;aACtF;YACD,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,4CAA4C,EAAE;SACpF,CAAC;IACN,CAAC;IAED,6EAA6E;IAE7E;;;OAGG;IACH,wBAAwB;QACpB,OAAO,6BAAmB,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,mCAAmC;QAC/B,OAAO,sCAAuB,CAAC;IACnC,CAAC;CACJ;AA/ND,kDA+NC;AAED,gFAAgF;AACnE,QAAA,mBAAmB,GAAG,IAAI,mBAAmB,EAAE,CAAC;AAE7D,sCAAsC;AACtC,0DAA8D;AAArD,iHAAA,iBAAiB,OAAA;AAC1B,gDAAoD;AAA3C,uGAAA,YAAY,OAAA;AACrB,8CAAwD;AAA/C,2GAAA,iBAAiB,OAAA;AAC1B,iDAAkE;AAAzD,oHAAA,yBAAyB,OAAA"}
@@ -1,8 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAmpscriptSignatureHelp = getAmpscriptSignatureHelp;
4
- const ampscript_js_1 = require("../data/ampscript.js");
5
- /** Return AMPscript signature help for the given function context. */
4
+ const ampscript_js_1 = require("../data/ampscript.cjs");
5
+ /**
6
+ * Return AMPscript signature help for the given function context.
7
+ * @param context - Parsed function call context.
8
+ * @param context.functionName - Name of the function being called.
9
+ * @param context.paramIndex - Zero-based index of the active parameter.
10
+ * @returns SignatureHelp object, or null if the function is unknown.
11
+ */
6
12
  function getAmpscriptSignatureHelp(context) {
7
13
  const fn = ampscript_js_1.functionLookup.get(context.functionName.toLowerCase());
8
14
  if (!fn || !fn.params || fn.params.length === 0)
@@ -12,11 +18,13 @@ function getAmpscriptSignatureHelp(context) {
12
18
  documentation: `${p.description}${p.optional ? ' *(optional)*' : ''}`,
13
19
  }));
14
20
  return {
15
- signatures: [{
21
+ signatures: [
22
+ {
16
23
  label: fn.syntax,
17
24
  documentation: fn.description,
18
25
  parameters: parameterInfos,
19
- }],
26
+ },
27
+ ],
20
28
  activeSignature: 0,
21
29
  activeParameter: Math.min(context.paramIndex, fn.params.length - 1),
22
30
  };
@@ -1,5 +1,11 @@
1
1
  import type { SignatureHelp } from '../types.js';
2
- /** Return AMPscript signature help for the given function context. */
2
+ /**
3
+ * Return AMPscript signature help for the given function context.
4
+ * @param context - Parsed function call context.
5
+ * @param context.functionName - Name of the function being called.
6
+ * @param context.paramIndex - Zero-based index of the active parameter.
7
+ * @returns SignatureHelp object, or null if the function is unknown.
8
+ */
3
9
  export declare function getAmpscriptSignatureHelp(context: {
4
10
  functionName: string;
5
11
  paramIndex: number;
@@ -1 +1 @@
1
- {"version":3,"file":"ampscript.d.ts","sourceRoot":"","sources":["../../../src/signature/ampscript.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAwB,MAAM,aAAa,CAAC;AAGvE,sEAAsE;AACtE,wBAAgB,yBAAyB,CACrC,OAAO,EAAE;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACtD,aAAa,GAAG,IAAI,CAkBtB"}
1
+ {"version":3,"file":"ampscript.d.ts","sourceRoot":"","sources":["../../../src/signature/ampscript.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAwB,MAAM,aAAa,CAAC;AAGvE;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE;IAC/C,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACtB,GAAG,aAAa,GAAG,IAAI,CAoBvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"ampscript.js","sourceRoot":"","sources":["../../../src/signature/ampscript.ts"],"names":[],"mappings":";;AAIA,8DAoBC;AAvBD,uDAAsD;AAEtD,sEAAsE;AACtE,SAAgB,yBAAyB,CACrC,OAAqD;IAErD,MAA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AAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACjE,KAAK,EAAE,CAAC,CAAC,IAAI;QACb,aAAa,EAAE,GAAG,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE;KACxE,CAAC,CAAC,CAAC;IAEJ,OAAO;QACH,UAAU,EAAE;YACR;gBACI,KAAK,EAAE,EAAE,CAAC,MAAM;gBAChB,aAAa,EAAE,EAAE,CAAC,WAAW;gBAC7B,UAAU,EAAE,cAAc;aAC7B;SACJ;QACD,eAAe,EAAE,CAAC;QAClB,eAAe,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;KACtE,CAAC;AACN,CAAC"}
@@ -1,46 +1,63 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSsjsSignatureHelp = getSsjsSignatureHelp;
4
- const ssjs_js_1 = require("../data/ssjs.js");
4
+ const ssjs_js_1 = require("../data/ssjs.cjs");
5
5
  const ALL_SSJS_FUNCTIONS = [
6
- ...ssjs_js_1.platformMethods, ...ssjs_js_1.platformFunctions, ...ssjs_js_1.ssjsGlobals,
7
- ...ssjs_js_1.platformVariableMethods, ...ssjs_js_1.platformResponseMethods, ...ssjs_js_1.platformRequestMethods,
8
- ...ssjs_js_1.platformClientBrowserMethods, ...ssjs_js_1.platformRecipientMethods,
9
- ...ssjs_js_1.wsproxyMethods, ...ssjs_js_1.httpMethods,
6
+ ...ssjs_js_1.platformMethods,
7
+ ...ssjs_js_1.platformFunctions,
8
+ ...ssjs_js_1.ssjsGlobals,
9
+ ...ssjs_js_1.platformVariableMethods,
10
+ ...ssjs_js_1.platformResponseMethods,
11
+ ...ssjs_js_1.platformRequestMethods,
12
+ ...ssjs_js_1.platformRecipientMethods,
13
+ ...ssjs_js_1.wsproxyMethods,
14
+ ...ssjs_js_1.httpMethods,
15
+ ...ssjs_js_1.httpHeaderMethods,
16
+ ...ssjs_js_1.dateTimeTimezoneMethods,
17
+ ...ssjs_js_1.errorUtilMethods,
10
18
  ];
11
- /** Return SSJS signature help for the given function context. */
19
+ /**
20
+ * Return SSJS signature help for the given function context.
21
+ * @param context - Parsed function call context.
22
+ * @param context.functionName - Name of the function being called.
23
+ * @param context.paramIndex - Zero-based index of the active parameter.
24
+ * @param localFunctions - Local function declarations from the document.
25
+ * @returns SignatureHelp object, or null if the function is unknown.
26
+ */
12
27
  function getSsjsSignatureHelp(context, localFunctions) {
13
28
  const fn = ALL_SSJS_FUNCTIONS.find((f) => f.name.toLowerCase() === context.functionName.toLowerCase());
14
29
  if (fn) {
15
30
  const prefix = fn.prefix ? `${fn.prefix}.` : '';
16
31
  if (fn.params && fn.params.length > 0) {
17
32
  const parameterInfos = fn.params.map((p) => ({
18
- label: p.name,
33
+ label: `${p.name}${p.optional ? '?' : ''}: ${p.type ?? 'any'}`,
19
34
  documentation: `${p.description}${p.optional ? ' *(optional)*' : ''}`,
20
35
  }));
21
36
  const sigLabel = fn.syntax
22
37
  ? `${prefix}${fn.syntax}`
23
- : `${prefix}${fn.name}(${fn.params.map((p) => p.name).join(', ')})`;
38
+ : `${prefix}${fn.name}(${fn.params.map((p) => `${p.name}${p.optional ? '?' : ''}: ${p.type ?? 'any'}`).join(', ')})`;
24
39
  return {
25
- signatures: [{ label: sigLabel, documentation: fn.description, parameters: parameterInfos }],
40
+ signatures: [
41
+ { label: sigLabel, documentation: fn.description, parameters: parameterInfos },
42
+ ],
26
43
  activeSignature: 0,
27
44
  activeParameter: Math.min(context.paramIndex, parameterInfos.length - 1),
28
45
  };
29
46
  }
30
- const paramCount = fn.maxArgs === Infinity
31
- ? Math.max(fn.minArgs, context.paramIndex + 1)
32
- : fn.maxArgs;
47
+ const paramCount = fn.maxArgs === Infinity ? Math.max(fn.minArgs, context.paramIndex + 1) : fn.maxArgs;
33
48
  const paramLabels = [];
34
49
  for (let i = 0; i < paramCount; i++) {
35
50
  paramLabels.push(i < fn.minArgs ? `arg${i + 1}` : `arg${i + 1}?`);
36
51
  }
37
52
  const parameterInfos = paramLabels.map((label) => ({ label }));
38
53
  return {
39
- signatures: [{
54
+ signatures: [
55
+ {
40
56
  label: `${prefix}${fn.name}(${paramLabels.join(', ')})`,
41
57
  documentation: fn.description,
42
58
  parameters: parameterInfos,
43
- }],
59
+ },
60
+ ],
44
61
  activeSignature: 0,
45
62
  activeParameter: Math.min(context.paramIndex, parameterInfos.length - 1),
46
63
  };
@@ -53,19 +70,25 @@ function getSsjsSignatureHelp(context, localFunctions) {
53
70
  const typeStr = pd?.type ? ` \`${pd.type}\`` : '';
54
71
  return {
55
72
  label: p,
56
- documentation: pd ? `${typeStr}${pd.description ? ` — ${pd.description}` : ''}`.trim() : undefined,
73
+ documentation: pd
74
+ ? `${typeStr}${pd.description ? ` — ${pd.description}` : ''}`.trim()
75
+ : undefined,
57
76
  };
58
77
  });
59
- const paramList = localFn.params.map((p) => {
78
+ const paramList = localFn.params
79
+ .map((p) => {
60
80
  const pd = localFn.paramDocs.get(p);
61
81
  return pd?.type ? `${p}: ${pd.type}` : p;
62
- }).join(', ');
82
+ })
83
+ .join(', ');
63
84
  return {
64
- signatures: [{
85
+ signatures: [
86
+ {
65
87
  label: `${localFn.name}(${paramList})`,
66
88
  documentation: localFn.description || undefined,
67
89
  parameters: parameterInfos,
68
- }],
90
+ },
91
+ ],
69
92
  activeSignature: 0,
70
93
  activeParameter: Math.min(context.paramIndex, parameterInfos.length - 1),
71
94
  };
@@ -1,6 +1,13 @@
1
1
  import type { SignatureHelp } from '../types.js';
2
2
  import type { LocalSsjsFunction } from '../utils/markdown.js';
3
- /** Return SSJS signature help for the given function context. */
3
+ /**
4
+ * Return SSJS signature help for the given function context.
5
+ * @param context - Parsed function call context.
6
+ * @param context.functionName - Name of the function being called.
7
+ * @param context.paramIndex - Zero-based index of the active parameter.
8
+ * @param localFunctions - Local function declarations from the document.
9
+ * @returns SignatureHelp object, or null if the function is unknown.
10
+ */
4
11
  export declare function getSsjsSignatureHelp(context: {
5
12
  functionName: string;
6
13
  paramIndex: number;
@@ -1 +1 @@
1
- {"version":3,"file":"ssjs.d.ts","sourceRoot":"","sources":["../../../src/signature/ssjs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAwB,MAAM,aAAa,CAAC;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAsB9D,iEAAiE;AACjE,wBAAgB,oBAAoB,CAChC,OAAO,EAAE;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,EACrD,cAAc,EAAE,iBAAiB,EAAE,GACpC,aAAa,GAAG,IAAI,CA2EtB"}
1
+ {"version":3,"file":"ssjs.d.ts","sourceRoot":"","sources":["../../../src/signature/ssjs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAwB,MAAM,aAAa,CAAC;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAgC9D;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAChC,OAAO,EAAE;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,EACrD,cAAc,EAAE,iBAAiB,EAAE,GACpC,aAAa,GAAG,IAAI,CAoFtB"}