sfmc-language-lsp 0.1.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.
- package/dist/cjs/codeActions/ampscript.d.ts +4 -0
- package/dist/cjs/codeActions/ampscript.d.ts.map +1 -0
- package/dist/cjs/codeActions/ampscript.js +110 -0
- package/dist/cjs/codeActions/ampscript.js.map +1 -0
- package/dist/cjs/completions/ampscript.d.ts +9 -0
- package/dist/cjs/completions/ampscript.d.ts.map +1 -0
- package/dist/cjs/completions/ampscript.js +112 -0
- package/dist/cjs/completions/ampscript.js.map +1 -0
- package/dist/cjs/completions/ssjs.d.ts +7 -0
- package/dist/cjs/completions/ssjs.d.ts.map +1 -0
- package/dist/cjs/completions/ssjs.js +103 -0
- package/dist/cjs/completions/ssjs.js.map +1 -0
- package/dist/cjs/data/ampscript.d.ts +44 -0
- package/dist/cjs/data/ampscript.d.ts.map +1 -0
- package/dist/cjs/data/ampscript.js +2800 -0
- package/dist/cjs/data/ampscript.js.map +1 -0
- package/dist/cjs/data/ssjs.d.ts +55 -0
- package/dist/cjs/data/ssjs.d.ts.map +1 -0
- package/dist/cjs/data/ssjs.js +93 -0
- package/dist/cjs/data/ssjs.js.map +1 -0
- package/dist/cjs/definitions/ssjs.d.ts +13 -0
- package/dist/cjs/definitions/ssjs.d.ts.map +1 -0
- package/dist/cjs/definitions/ssjs.js +65 -0
- package/dist/cjs/definitions/ssjs.js.map +1 -0
- package/dist/cjs/hover/ampscript.d.ts +4 -0
- package/dist/cjs/hover/ampscript.d.ts.map +1 -0
- package/dist/cjs/hover/ampscript.js +46 -0
- package/dist/cjs/hover/ampscript.js.map +1 -0
- package/dist/cjs/hover/ssjs.d.ts +5 -0
- package/dist/cjs/hover/ssjs.d.ts.map +1 -0
- package/dist/cjs/hover/ssjs.js +161 -0
- package/dist/cjs/hover/ssjs.js.map +1 -0
- package/dist/cjs/index.d.ts +63 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +154 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/signature/ampscript.d.ts +7 -0
- package/dist/cjs/signature/ampscript.d.ts.map +1 -0
- package/dist/cjs/signature/ampscript.js +24 -0
- package/dist/cjs/signature/ampscript.js.map +1 -0
- package/dist/cjs/signature/ssjs.d.ts +8 -0
- package/dist/cjs/signature/ssjs.d.ts.map +1 -0
- package/dist/cjs/signature/ssjs.js +75 -0
- package/dist/cjs/signature/ssjs.js.map +1 -0
- package/dist/cjs/types.d.ts +25 -0
- package/dist/cjs/types.d.ts.map +1 -0
- package/dist/cjs/types.js +21 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/utils/comments.d.ts +9 -0
- package/dist/cjs/utils/comments.d.ts.map +1 -0
- package/dist/cjs/utils/comments.js +72 -0
- package/dist/cjs/utils/comments.js.map +1 -0
- package/dist/cjs/utils/markdown.d.ts +30 -0
- package/dist/cjs/utils/markdown.d.ts.map +1 -0
- package/dist/cjs/utils/markdown.js +147 -0
- package/dist/cjs/utils/markdown.js.map +1 -0
- package/dist/cjs/utils/positions.d.ts +8 -0
- package/dist/cjs/utils/positions.d.ts.map +1 -0
- package/dist/cjs/utils/positions.js +31 -0
- package/dist/cjs/utils/positions.js.map +1 -0
- package/dist/cjs/utils/regions.d.ts +22 -0
- package/dist/cjs/utils/regions.d.ts.map +1 -0
- package/dist/cjs/utils/regions.js +126 -0
- package/dist/cjs/utils/regions.js.map +1 -0
- package/dist/cjs/utils/text.d.ts +41 -0
- package/dist/cjs/utils/text.d.ts.map +1 -0
- package/dist/cjs/utils/text.js +145 -0
- package/dist/cjs/utils/text.js.map +1 -0
- package/dist/cjs/validators/ampscript.d.ts +11 -0
- package/dist/cjs/validators/ampscript.d.ts.map +1 -0
- package/dist/cjs/validators/ampscript.js +449 -0
- package/dist/cjs/validators/ampscript.js.map +1 -0
- package/dist/cjs/validators/gtl.d.ts +7 -0
- package/dist/cjs/validators/gtl.d.ts.map +1 -0
- package/dist/cjs/validators/gtl.js +80 -0
- package/dist/cjs/validators/gtl.js.map +1 -0
- package/dist/cjs/validators/ssjs.d.ts +5 -0
- package/dist/cjs/validators/ssjs.d.ts.map +1 -0
- package/dist/cjs/validators/ssjs.js +122 -0
- package/dist/cjs/validators/ssjs.js.map +1 -0
- package/dist/esm/codeActions/ampscript.d.ts +4 -0
- package/dist/esm/codeActions/ampscript.d.ts.map +1 -0
- package/dist/esm/codeActions/ampscript.js +107 -0
- package/dist/esm/codeActions/ampscript.js.map +1 -0
- package/dist/esm/completions/ampscript.d.ts +9 -0
- package/dist/esm/completions/ampscript.d.ts.map +1 -0
- package/dist/esm/completions/ampscript.js +107 -0
- package/dist/esm/completions/ampscript.js.map +1 -0
- package/dist/esm/completions/ssjs.d.ts +7 -0
- package/dist/esm/completions/ssjs.d.ts.map +1 -0
- package/dist/esm/completions/ssjs.js +99 -0
- package/dist/esm/completions/ssjs.js.map +1 -0
- package/dist/esm/data/ampscript.d.ts +44 -0
- package/dist/esm/data/ampscript.d.ts.map +1 -0
- package/dist/esm/data/ampscript.js +2791 -0
- package/dist/esm/data/ampscript.js.map +1 -0
- package/dist/esm/data/ssjs.d.ts +55 -0
- package/dist/esm/data/ssjs.d.ts.map +1 -0
- package/dist/esm/data/ssjs.js +90 -0
- package/dist/esm/data/ssjs.js.map +1 -0
- package/dist/esm/definitions/ssjs.d.ts +13 -0
- package/dist/esm/definitions/ssjs.d.ts.map +1 -0
- package/dist/esm/definitions/ssjs.js +61 -0
- package/dist/esm/definitions/ssjs.js.map +1 -0
- package/dist/esm/hover/ampscript.d.ts +4 -0
- package/dist/esm/hover/ampscript.d.ts.map +1 -0
- package/dist/esm/hover/ampscript.js +43 -0
- package/dist/esm/hover/ampscript.js.map +1 -0
- package/dist/esm/hover/ssjs.d.ts +5 -0
- package/dist/esm/hover/ssjs.d.ts.map +1 -0
- package/dist/esm/hover/ssjs.js +158 -0
- package/dist/esm/hover/ssjs.js.map +1 -0
- package/dist/esm/index.d.ts +63 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +145 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/signature/ampscript.d.ts +7 -0
- package/dist/esm/signature/ampscript.d.ts.map +1 -0
- package/dist/esm/signature/ampscript.js +21 -0
- package/dist/esm/signature/ampscript.js.map +1 -0
- package/dist/esm/signature/ssjs.d.ts +8 -0
- package/dist/esm/signature/ssjs.d.ts.map +1 -0
- package/dist/esm/signature/ssjs.js +72 -0
- package/dist/esm/signature/ssjs.js.map +1 -0
- package/dist/esm/types.d.ts +25 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +13 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/utils/comments.d.ts +9 -0
- package/dist/esm/utils/comments.d.ts.map +1 -0
- package/dist/esm/utils/comments.js +68 -0
- package/dist/esm/utils/comments.js.map +1 -0
- package/dist/esm/utils/markdown.d.ts +30 -0
- package/dist/esm/utils/markdown.d.ts.map +1 -0
- package/dist/esm/utils/markdown.js +139 -0
- package/dist/esm/utils/markdown.js.map +1 -0
- package/dist/esm/utils/positions.d.ts +8 -0
- package/dist/esm/utils/positions.d.ts.map +1 -0
- package/dist/esm/utils/positions.js +26 -0
- package/dist/esm/utils/positions.js.map +1 -0
- package/dist/esm/utils/regions.d.ts +22 -0
- package/dist/esm/utils/regions.d.ts.map +1 -0
- package/dist/esm/utils/regions.js +121 -0
- package/dist/esm/utils/regions.js.map +1 -0
- package/dist/esm/utils/text.d.ts +41 -0
- package/dist/esm/utils/text.d.ts.map +1 -0
- package/dist/esm/utils/text.js +137 -0
- package/dist/esm/utils/text.js.map +1 -0
- package/dist/esm/validators/ampscript.d.ts +11 -0
- package/dist/esm/validators/ampscript.d.ts.map +1 -0
- package/dist/esm/validators/ampscript.js +445 -0
- package/dist/esm/validators/ampscript.js.map +1 -0
- package/dist/esm/validators/gtl.d.ts +7 -0
- package/dist/esm/validators/gtl.d.ts.map +1 -0
- package/dist/esm/validators/gtl.js +77 -0
- package/dist/esm/validators/gtl.js.map +1 -0
- package/dist/esm/validators/ssjs.d.ts +5 -0
- package/dist/esm/validators/ssjs.d.ts.map +1 -0
- package/dist/esm/validators/ssjs.js +119 -0
- package/dist/esm/validators/ssjs.js.map +1 -0
- package/dist/types/codeActions/ampscript.d.ts +4 -0
- package/dist/types/codeActions/ampscript.d.ts.map +1 -0
- package/dist/types/completions/ampscript.d.ts +9 -0
- package/dist/types/completions/ampscript.d.ts.map +1 -0
- package/dist/types/completions/ssjs.d.ts +7 -0
- package/dist/types/completions/ssjs.d.ts.map +1 -0
- package/dist/types/data/ampscript.d.ts +44 -0
- package/dist/types/data/ampscript.d.ts.map +1 -0
- package/dist/types/data/ssjs.d.ts +55 -0
- package/dist/types/data/ssjs.d.ts.map +1 -0
- package/dist/types/definitions/ssjs.d.ts +13 -0
- package/dist/types/definitions/ssjs.d.ts.map +1 -0
- package/dist/types/hover/ampscript.d.ts +4 -0
- package/dist/types/hover/ampscript.d.ts.map +1 -0
- package/dist/types/hover/ssjs.d.ts +5 -0
- package/dist/types/hover/ssjs.d.ts.map +1 -0
- package/dist/types/index.d.ts +63 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/signature/ampscript.d.ts +7 -0
- package/dist/types/signature/ampscript.d.ts.map +1 -0
- package/dist/types/signature/ssjs.d.ts +8 -0
- package/dist/types/signature/ssjs.d.ts.map +1 -0
- package/dist/types/types.d.ts +25 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/utils/comments.d.ts +9 -0
- package/dist/types/utils/comments.d.ts.map +1 -0
- package/dist/types/utils/markdown.d.ts +30 -0
- package/dist/types/utils/markdown.d.ts.map +1 -0
- package/dist/types/utils/positions.d.ts +8 -0
- package/dist/types/utils/positions.d.ts.map +1 -0
- package/dist/types/utils/regions.d.ts +22 -0
- package/dist/types/utils/regions.d.ts.map +1 -0
- package/dist/types/utils/text.d.ts +41 -0
- package/dist/types/utils/text.d.ts.map +1 -0
- package/dist/types/validators/ampscript.d.ts +11 -0
- package/dist/types/validators/ampscript.d.ts.map +1 -0
- package/dist/types/validators/gtl.d.ts +7 -0
- package/dist/types/validators/gtl.d.ts.map +1 -0
- package/dist/types/validators/ssjs.d.ts +5 -0
- package/dist/types/validators/ssjs.d.ts.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { DiagnosticSeverity } from '../types.js';
|
|
2
|
+
import { DEFAULT_SETTINGS } from '../types.js';
|
|
3
|
+
import { buildCommentRanges, isInCommentRange } from '../utils/comments.js';
|
|
4
|
+
import { extractFunctionArguments, inferLiteralType } from '../utils/text.js';
|
|
5
|
+
import { offsetToPosition } from '../utils/positions.js';
|
|
6
|
+
import { platformMethods, platformFunctions, ssjsGlobals, platformVariableMethods, platformResponseMethods, platformRequestMethods, platformClientBrowserMethods, platformRecipientMethods, wsproxyMethods, httpMethods, } from '../data/ssjs.js';
|
|
7
|
+
/** Validate an SSJS document and return LSP Diagnostics. */
|
|
8
|
+
export function validateSsjs(text, settings = DEFAULT_SETTINGS) {
|
|
9
|
+
const diagnostics = [];
|
|
10
|
+
let problems = 0;
|
|
11
|
+
const max = settings.maxNumberOfProblems;
|
|
12
|
+
const platformLoadPattern = /Platform\s*\.\s*Load\s*\(\s*["']core["']/i;
|
|
13
|
+
const hasPlatformLoad = platformLoadPattern.test(text);
|
|
14
|
+
// 1. Core library usage without Platform.Load
|
|
15
|
+
const coreObjectPattern = /\b(DataExtension|Subscriber|Email|TriggeredSend|List|ContentArea|Folder|QueryDefinition|Send|Template|DeliveryProfile|SenderProfile|SendClassification|FilterDefinition|Account|AccountUser|Portfolio|BounceEvent|ClickEvent|ForwardedEmailEvent|ForwardedEmailOptInEvent|NotSentEvent|OpenEvent|SentEvent|SurveyEvent|UnsubEvent)\s*\.\s*(Init|Retrieve)\s*\(/g;
|
|
16
|
+
let coreMatch;
|
|
17
|
+
while ((coreMatch = coreObjectPattern.exec(text)) !== null && problems < max) {
|
|
18
|
+
if (!hasPlatformLoad) {
|
|
19
|
+
problems++;
|
|
20
|
+
diagnostics.push({
|
|
21
|
+
severity: DiagnosticSeverity.Error,
|
|
22
|
+
range: {
|
|
23
|
+
start: offsetToPosition(text, coreMatch.index),
|
|
24
|
+
end: offsetToPosition(text, coreMatch.index + coreMatch[0].length - 1),
|
|
25
|
+
},
|
|
26
|
+
message: `Platform.Load("core", "1.1.5") must be called before using ${coreMatch[1]}.Init(). Without it, this call will fail at runtime.`,
|
|
27
|
+
source: 'ssjs',
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
// 2. Wrong Platform.Load version
|
|
32
|
+
const platformLoadVersionPattern = /Platform\s*\.\s*Load\s*\(\s*["']core["']\s*,\s*["']([^"']*)["']\s*\)/gi;
|
|
33
|
+
let versionMatch;
|
|
34
|
+
while ((versionMatch = platformLoadVersionPattern.exec(text)) !== null && problems < max) {
|
|
35
|
+
const actualVersion = versionMatch[1];
|
|
36
|
+
if (actualVersion !== '1.1.5') {
|
|
37
|
+
problems++;
|
|
38
|
+
const versionStart = versionMatch.index + versionMatch[0].lastIndexOf(actualVersion);
|
|
39
|
+
diagnostics.push({
|
|
40
|
+
severity: DiagnosticSeverity.Warning,
|
|
41
|
+
range: {
|
|
42
|
+
start: offsetToPosition(text, versionStart - 1),
|
|
43
|
+
end: offsetToPosition(text, versionStart + actualVersion.length + 1),
|
|
44
|
+
},
|
|
45
|
+
message: `Platform.Load("Core", "${actualVersion}") should use version "1.1.5" to get the latest bug-fixes.`,
|
|
46
|
+
source: 'ssjs',
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// 3. ES6+ patterns not supported in SFMC SSJS
|
|
51
|
+
const es6Patterns = [
|
|
52
|
+
{ pattern: /\b(let|const)\s+/g, message: "'let'/'const' declarations are not supported in SFMC SSJS. Use 'var' instead." },
|
|
53
|
+
{ pattern: /=>\s*[{(]/g, message: 'Arrow functions are not supported in SFMC SSJS. Use a regular function expression.' },
|
|
54
|
+
{ pattern: /`[^`]*`/g, message: 'Template literals are not supported in SFMC SSJS. Use string concatenation.' },
|
|
55
|
+
{ pattern: /\bclass\s+\w+/g, message: 'Class declarations are not supported in SFMC SSJS. Use constructor functions.' },
|
|
56
|
+
{ pattern: /\basync\s+function/g, message: 'Async functions are not supported in SFMC SSJS.' },
|
|
57
|
+
{ pattern: /\bawait\s+/g, message: 'Await expressions are not supported in SFMC SSJS.' },
|
|
58
|
+
];
|
|
59
|
+
const commentRanges = buildCommentRanges(text);
|
|
60
|
+
for (const { pattern, message } of es6Patterns) {
|
|
61
|
+
let match;
|
|
62
|
+
while ((match = pattern.exec(text)) !== null && problems < max) {
|
|
63
|
+
if (isInCommentRange(match.index, commentRanges))
|
|
64
|
+
continue;
|
|
65
|
+
problems++;
|
|
66
|
+
diagnostics.push({
|
|
67
|
+
severity: DiagnosticSeverity.Warning,
|
|
68
|
+
range: {
|
|
69
|
+
start: offsetToPosition(text, match.index),
|
|
70
|
+
end: offsetToPosition(text, match.index + match[0].length),
|
|
71
|
+
},
|
|
72
|
+
message,
|
|
73
|
+
source: 'ssjs',
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// 4. Type-check literal arguments for known SSJS function calls
|
|
78
|
+
const ssjsFunctionLookup = new Map();
|
|
79
|
+
for (const fn of [
|
|
80
|
+
...platformMethods, ...platformFunctions, ...ssjsGlobals,
|
|
81
|
+
...platformVariableMethods, ...platformResponseMethods, ...platformRequestMethods,
|
|
82
|
+
...platformClientBrowserMethods, ...platformRecipientMethods,
|
|
83
|
+
...wsproxyMethods, ...httpMethods,
|
|
84
|
+
]) {
|
|
85
|
+
ssjsFunctionLookup.set(fn.name.toLowerCase(), fn);
|
|
86
|
+
}
|
|
87
|
+
const ssjsCallPattern = /(?:\w+\.)*(\w+)\s*\(/g;
|
|
88
|
+
let ssjsCallMatch;
|
|
89
|
+
while ((ssjsCallMatch = ssjsCallPattern.exec(text)) !== null && problems < max) {
|
|
90
|
+
const methodName = ssjsCallMatch[1];
|
|
91
|
+
const fn = ssjsFunctionLookup.get(methodName.toLowerCase());
|
|
92
|
+
if (!fn?.params || fn.params.length === 0)
|
|
93
|
+
continue;
|
|
94
|
+
const openParenPos = ssjsCallMatch.index + ssjsCallMatch[0].length - 1;
|
|
95
|
+
const argSpans = extractFunctionArguments(text, openParenPos);
|
|
96
|
+
if (!argSpans)
|
|
97
|
+
continue;
|
|
98
|
+
for (let ai = 0; ai < argSpans.length && problems < max; ai++) {
|
|
99
|
+
const param = fn.params[ai];
|
|
100
|
+
if (!param?.type)
|
|
101
|
+
continue;
|
|
102
|
+
const inferredType = inferLiteralType(argSpans[ai].value);
|
|
103
|
+
if (inferredType && inferredType !== param.type) {
|
|
104
|
+
problems++;
|
|
105
|
+
diagnostics.push({
|
|
106
|
+
severity: DiagnosticSeverity.Warning,
|
|
107
|
+
range: {
|
|
108
|
+
start: offsetToPosition(text, argSpans[ai].start),
|
|
109
|
+
end: offsetToPosition(text, argSpans[ai].end),
|
|
110
|
+
},
|
|
111
|
+
message: `Argument '${param.name}' of '${methodName}' expects a ${param.type} but received a ${inferredType}.`,
|
|
112
|
+
source: 'ssjs',
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return diagnostics;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=ssjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssjs.js","sourceRoot":"","sources":["../../../src/validators/ssjs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,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BAChD;oBACD,OAAO,EAAE,aAAa,KAAK,CAAC,IAAI,SAAS,UAAU,eAAe,KAAK,CAAC,IAAI,mBAAmB,YAAY,GAAG;oBAC9G,MAAM,EAAE,MAAM;iBACjB,CAAC,CAAC;YACP,CAAC;QACL,CAAC;IACL,CAAC;IAED,OAAO,WAAW,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CodeAction, Diagnostic } from '../types.js';
|
|
2
|
+
/** Return quick-fix code actions for the given diagnostics. */
|
|
3
|
+
export declare function getAmpscriptCodeActions(text: string, uri: string, diagnostics: Diagnostic[]): CodeAction[];
|
|
4
|
+
//# sourceMappingURL=ampscript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ampscript.d.ts","sourceRoot":"","sources":["../../../src/codeActions/ampscript.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAS,MAAM,aAAa,CAAC;AAWjE,+DAA+D;AAC/D,wBAAgB,uBAAuB,CACnC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,UAAU,EAAE,GAC1B,UAAU,EAAE,CAqGd"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CompletionItem, Position } from '../types.js';
|
|
2
|
+
export declare const functionCompletionItems: CompletionItem[];
|
|
3
|
+
export declare const keywordCompletionItems: CompletionItem[];
|
|
4
|
+
export declare const personalizationCompletionItems: CompletionItem[];
|
|
5
|
+
/** Return AMPscript completions for the given document text and cursor position. */
|
|
6
|
+
export declare function getAmpscriptCompletions(text: string, position: Position): CompletionItem[];
|
|
7
|
+
/** Resolve documentation for an AMPscript completion item (lazy-loaded). */
|
|
8
|
+
export declare function resolveAmpscriptCompletion(item: CompletionItem): CompletionItem;
|
|
9
|
+
//# sourceMappingURL=ampscript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ampscript.d.ts","sourceRoot":"","sources":["../../../src/completions/ampscript.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAW5D,eAAO,MAAM,uBAAuB,EAAE,cAAc,EAOjD,CAAC;AAEJ,eAAO,MAAM,sBAAsB,EAAE,cAAc,EAOhD,CAAC;AAEJ,eAAO,MAAM,8BAA8B,EAAE,cAAc,EAO1D,CAAC;AA6BF,oFAAoF;AACpF,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,cAAc,EAAE,CAkB1F;AAED,4EAA4E;AAC5E,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,cAAc,GAAG,cAAc,CAmC/E"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CompletionItem } from '../types.js';
|
|
2
|
+
import type { LocalSsjsFunction } from '../utils/markdown.js';
|
|
3
|
+
/** The full static SSJS catalog (built once). */
|
|
4
|
+
export declare const ssjsCompletionItems: CompletionItem[];
|
|
5
|
+
/** Build completion items for file-local SSJS function declarations. */
|
|
6
|
+
export declare function buildLocalFunctionCompletionItems(localFunctions: LocalSsjsFunction[]): CompletionItem[];
|
|
7
|
+
//# sourceMappingURL=ssjs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssjs.d.ts","sourceRoot":"","sources":["../../../src/completions/ssjs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAkB9D,iDAAiD;AACjD,eAAO,MAAM,mBAAmB,EAAE,cAAc,EAAuB,CAAC;AAiHxE,wEAAwE;AACxE,wBAAgB,iCAAiC,CAAC,cAAc,EAAE,iBAAiB,EAAE,GAAG,cAAc,EAAE,CAmBvG"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AMPscript function definitions for auto-completion and hover/intellisense.
|
|
3
|
+
*
|
|
4
|
+
* Canonical function names, keywords, and personalization strings are sourced
|
|
5
|
+
* from the shared ampscript-data package. Rich descriptions, parameter docs,
|
|
6
|
+
* and examples in this file are original content for this extension.
|
|
7
|
+
*/
|
|
8
|
+
export { FUNCTIONS as canonicalFunctions, FUNCTION_CANONICAL_MAP, AMPSCRIPT_KEYWORDS as canonicalKeywordNames, PERSONALIZATION_STRINGS as canonicalPersonalizationStrings, functionNames, isEmailExcluded, } from 'ampscript-data';
|
|
9
|
+
export interface AmpscriptFunctionParam {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
optional?: boolean;
|
|
13
|
+
type?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface AmpscriptFunction {
|
|
16
|
+
name: string;
|
|
17
|
+
syntax: string;
|
|
18
|
+
description: string;
|
|
19
|
+
category: string;
|
|
20
|
+
params: AmpscriptFunctionParam[];
|
|
21
|
+
returnType: string;
|
|
22
|
+
example: string;
|
|
23
|
+
}
|
|
24
|
+
export declare const ampscriptFunctions: AmpscriptFunction[];
|
|
25
|
+
/**
|
|
26
|
+
* AMPscript keywords for auto-completion.
|
|
27
|
+
*/
|
|
28
|
+
export declare const ampscriptKeywords: {
|
|
29
|
+
name: string;
|
|
30
|
+
description: string;
|
|
31
|
+
snippet: string;
|
|
32
|
+
}[];
|
|
33
|
+
/**
|
|
34
|
+
* Common system personalization strings.
|
|
35
|
+
*/
|
|
36
|
+
export declare const personalizationStrings: {
|
|
37
|
+
name: string;
|
|
38
|
+
description: string;
|
|
39
|
+
}[];
|
|
40
|
+
/**
|
|
41
|
+
* Build a lookup map for fast case-insensitive function retrieval.
|
|
42
|
+
*/
|
|
43
|
+
export declare const functionLookup: Map<string, AmpscriptFunction>;
|
|
44
|
+
//# sourceMappingURL=ampscript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ampscript.d.ts","sourceRoot":"","sources":["../../../src/data/ampscript.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACH,SAAS,IAAI,kBAAkB,EAC/B,sBAAsB,EACtB,kBAAkB,IAAI,qBAAqB,EAC3C,uBAAuB,IAAI,+BAA+B,EAC1D,aAAa,EACb,eAAe,GAClB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,sBAAsB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,sBAAsB,EAAE,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,kBAAkB,EAAE,iBAAiB,EAwrFjD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;GAsC7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;GAiIlC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,gCAAuC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSJS language data for the language server.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports SSJS function/object metadata from ssjs-data (the single
|
|
5
|
+
* source of truth) into formats suitable for LSP completions, hover,
|
|
6
|
+
* and diagnostics. No hand-maintained copies — updates to ssjs-data
|
|
7
|
+
* propagate automatically.
|
|
8
|
+
*/
|
|
9
|
+
export interface SsjsFunctionParam {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
type?: string;
|
|
13
|
+
optional?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface SsjsFunction {
|
|
16
|
+
name: string;
|
|
17
|
+
minArgs: number;
|
|
18
|
+
maxArgs: number;
|
|
19
|
+
description: string;
|
|
20
|
+
prefix?: string;
|
|
21
|
+
params?: SsjsFunctionParam[];
|
|
22
|
+
returnType?: string;
|
|
23
|
+
syntax?: string;
|
|
24
|
+
example?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface EcmascriptBuiltin {
|
|
27
|
+
name: string;
|
|
28
|
+
owner: string;
|
|
29
|
+
description: string;
|
|
30
|
+
params?: SsjsFunctionParam[];
|
|
31
|
+
returnType?: string;
|
|
32
|
+
syntax?: string;
|
|
33
|
+
example?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface SsjsObject {
|
|
36
|
+
name: string;
|
|
37
|
+
methods: string[];
|
|
38
|
+
description: string;
|
|
39
|
+
}
|
|
40
|
+
export declare const platformMethods: SsjsFunction[];
|
|
41
|
+
export declare const platformFunctions: SsjsFunction[];
|
|
42
|
+
export declare const platformFunctionLookup: Map<string, SsjsFunction>;
|
|
43
|
+
export declare const ssjsGlobals: SsjsFunction[];
|
|
44
|
+
export declare const platformVariableMethods: SsjsFunction[];
|
|
45
|
+
export declare const platformResponseMethods: SsjsFunction[];
|
|
46
|
+
export declare const platformRequestMethods: SsjsFunction[];
|
|
47
|
+
export declare const coreLibraryObjects: SsjsObject[];
|
|
48
|
+
export declare const wsproxyMethods: SsjsFunction[];
|
|
49
|
+
export declare const httpMethods: SsjsFunction[];
|
|
50
|
+
export declare const platformClientBrowserMethods: SsjsFunction[];
|
|
51
|
+
export declare const platformRecipientMethods: SsjsFunction[];
|
|
52
|
+
export declare const scriptUtilConstructors: SsjsFunction[];
|
|
53
|
+
export declare const scriptUtilRequestMethods: SsjsFunction[];
|
|
54
|
+
export declare const ecmascriptBuiltins: EcmascriptBuiltin[];
|
|
55
|
+
//# sourceMappingURL=ssjs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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CAAC;AAEJ,eAAO,MAAM,uBAAuB,EAAE,YAAY,EAG/C,CAAC;AAEJ,eAAO,MAAM,sBAAsB,EAAE,YAAY,EAG9C,CAAC;AAIJ,eAAO,MAAM,kBAAkB,EAAE,UAAU,EAIxC,CAAC;AAIJ,eAAO,MAAM,cAAc,EAAE,YAAY,EAGtC,CAAC;AAIJ,eAAO,MAAM,WAAW,EAAE,YAAY,EAGnC,CAAC;AAIJ,eAAO,MAAM,4BAA4B,EAAE,YAAY,EAKtD,CAAC;AAIF,eAAO,MAAM,wBAAwB,EAAE,YAAY,EAGhD,CAAC;AAIJ,eAAO,MAAM,sBAAsB,EAAE,YAAY,EAG9C,CAAC;AAIJ,eAAO,MAAM,wBAAwB,EAAE,YAAY,EAGhD,CAAC;AAIJ,eAAO,MAAM,kBAAkB,EAAE,iBAAiB,EAQ/C,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Location } from '../types.js';
|
|
2
|
+
import type { LocalSsjsFunction } from '../utils/markdown.js';
|
|
3
|
+
/**
|
|
4
|
+
* Parse all `function name(...)` declarations from SSJS document text,
|
|
5
|
+
* extracting preceding JSDoc blocks for documentation and parameter info.
|
|
6
|
+
*/
|
|
7
|
+
export declare function extractLocalSsjsFunctions(text: string): LocalSsjsFunction[];
|
|
8
|
+
/**
|
|
9
|
+
* Return an LSP Location for a file-local SSJS function declaration,
|
|
10
|
+
* or null if the name is not found.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getSsjsDefinition(text: string, uri: string, name: string): Location | null;
|
|
13
|
+
//# sourceMappingURL=ssjs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssjs.d.ts","sourceRoot":"","sources":["../../../src/definitions/ssjs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAG9D;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,EAAE,CA8C3E;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAY1F"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Hover, Position } from '../types.js';
|
|
2
|
+
/** Return hover documentation for an AMPscript document at the given line/position. */
|
|
3
|
+
export declare function getAmpscriptHover(line: string, position: Position): Hover | null;
|
|
4
|
+
//# sourceMappingURL=ampscript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ampscript.d.ts","sourceRoot":"","sources":["../../../src/hover/ampscript.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAKnD,uFAAuF;AACvF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,KAAK,GAAG,IAAI,CAwChF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Hover, Position } from '../types.js';
|
|
2
|
+
import type { LocalSsjsFunction } from '../utils/markdown.js';
|
|
3
|
+
/** Return hover documentation for an SSJS document at the given line/position. */
|
|
4
|
+
export declare function getSsjsHover(line: string, position: Position, localFunctions: LocalSsjsFunction[]): Hover | null;
|
|
5
|
+
//# sourceMappingURL=ssjs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssjs.d.ts","sourceRoot":"","sources":["../../../src/hover/ssjs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AA0B9D,kFAAkF;AAClF,wBAAgB,YAAY,CACxB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,iBAAiB,EAAE,GACpC,KAAK,GAAG,IAAI,CAwId"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sfmc-language-lsp — SFMC Language Service
|
|
3
|
+
*
|
|
4
|
+
* Protocol-agnostic, browser-compatible language intelligence for
|
|
5
|
+
* AMPscript, SSJS, and GTL. Used by the VS Code extension server and
|
|
6
|
+
* the mcp-server-sfmc MCP server.
|
|
7
|
+
*/
|
|
8
|
+
import type { Diagnostic, CompletionItem, Hover, SignatureHelp, Location, CodeAction, Position } from './types.js';
|
|
9
|
+
import type { SfmcSettings } from './types.js';
|
|
10
|
+
import type { SsjsFunction } from './data/ssjs.js';
|
|
11
|
+
export type { DocumentContext, SfmcSettings } from './types.js';
|
|
12
|
+
export { DEFAULT_SETTINGS } from './types.js';
|
|
13
|
+
export type { AmpscriptFunction, AmpscriptFunctionParam } from './data/ampscript.js';
|
|
14
|
+
export type { SsjsFunction, SsjsFunctionParam, EcmascriptBuiltin, SsjsObject } from './data/ssjs.js';
|
|
15
|
+
export type { LocalSsjsFunction } from './utils/markdown.js';
|
|
16
|
+
/** Import DocumentContext type locally for use in this file */
|
|
17
|
+
import type { DocumentContext } from './types.js';
|
|
18
|
+
/**
|
|
19
|
+
* The main entry point for SFMC language intelligence.
|
|
20
|
+
* Instantiate once; all methods are stateless and re-entrant.
|
|
21
|
+
*/
|
|
22
|
+
export declare class SfmcLanguageService {
|
|
23
|
+
/** Validate an AMPscript or SSJS document. Returns LSP Diagnostics. */
|
|
24
|
+
validate(doc: DocumentContext, settings?: SfmcSettings): Diagnostic[];
|
|
25
|
+
/** Return completion items at the given cursor position. */
|
|
26
|
+
getCompletions(doc: DocumentContext, position: Position): CompletionItem[];
|
|
27
|
+
/** Resolve documentation for a completion item (lazy-loaded). */
|
|
28
|
+
resolveCompletion(item: CompletionItem): CompletionItem;
|
|
29
|
+
/** Return hover documentation at the given line/position. */
|
|
30
|
+
getHover(doc: DocumentContext, line: string, position: Position): Hover | null;
|
|
31
|
+
/** Return signature help at the given cursor position. */
|
|
32
|
+
getSignatureHelp(doc: DocumentContext, textUpToCursor: string): SignatureHelp | null;
|
|
33
|
+
/** Return the definition location for the word at the given position. Only SSJS is supported. */
|
|
34
|
+
getDefinition(doc: DocumentContext, word: string): Location | null;
|
|
35
|
+
/** Return quick-fix code actions for the given diagnostics. */
|
|
36
|
+
getCodeActions(doc: DocumentContext, diagnostics: Diagnostic[]): CodeAction[];
|
|
37
|
+
/** Look up an AMPscript function by name. Case-insensitive. */
|
|
38
|
+
lookupAmpscriptFunction(name: string): import("./data/ampscript.js").AmpscriptFunction | null;
|
|
39
|
+
/** Look up an SSJS function or method by name. Case-insensitive. Searches all catalogs. */
|
|
40
|
+
lookupSsjsFunction(name: string): SsjsFunction | null;
|
|
41
|
+
/** Return all AMPscript functions in the catalog. */
|
|
42
|
+
getAllAmpscriptFunctions(): import("./data/ampscript.js").AmpscriptFunction[];
|
|
43
|
+
/** Return all SSJS functions and methods in the catalog. */
|
|
44
|
+
getAllSsjsFunctions(): SsjsFunction[];
|
|
45
|
+
/** Return all AMPscript keyword names. */
|
|
46
|
+
getAmpscriptKeywords(): string[];
|
|
47
|
+
/** Return the ES6+ syntax features that are unsupported in SFMC SSJS. */
|
|
48
|
+
getUnsupportedSsjsSyntax(): Array<{
|
|
49
|
+
pattern: string;
|
|
50
|
+
message: string;
|
|
51
|
+
}>;
|
|
52
|
+
/** Return the pre-built SSJS completion item catalog. */
|
|
53
|
+
getSsjsCompletionCatalog(): CompletionItem[];
|
|
54
|
+
/** Return the pre-built AMPscript function completion items. */
|
|
55
|
+
getAmpscriptFunctionCompletionItems(): CompletionItem[];
|
|
56
|
+
}
|
|
57
|
+
/** Shared singleton instance for callers that don't need separate instances. */
|
|
58
|
+
export declare const sfmcLanguageService: SfmcLanguageService;
|
|
59
|
+
export { validateAmpscript } from './validators/ampscript.js';
|
|
60
|
+
export { validateSsjs } from './validators/ssjs.js';
|
|
61
|
+
export { validateGtlBlocks } from './validators/gtl.js';
|
|
62
|
+
export { extractLocalSsjsFunctions } from './definitions/ssjs.js';
|
|
63
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,MAAM,qBAAqB,CAAC;AACrF,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACrG,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,+DAA+D;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;;GAGG;AACH,qBAAa,mBAAmB;IAG5B,uEAAuE;IACvE,QAAQ,CAAC,GAAG,EAAE,eAAe,EAAE,QAAQ,GAAE,YAA+B,GAAG,UAAU,EAAE;IASvF,4DAA4D;IAC5D,cAAc,CAAC,GAAG,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,GAAG,cAAc,EAAE;IAS1E,iEAAiE;IACjE,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,cAAc;IAMvD,6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'../types.js';
|
|
2
|
+
/** Return AMPscript signature help for the given function context. */
|
|
3
|
+
export declare function getAmpscriptSignatureHelp(context: {
|
|
4
|
+
functionName: string;
|
|
5
|
+
paramIndex: number;
|
|
6
|
+
}): SignatureHelp | null;
|
|
7
|
+
//# sourceMappingURL=ampscript.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SignatureHelp } from '../types.js';
|
|
2
|
+
import type { LocalSsjsFunction } from '../utils/markdown.js';
|
|
3
|
+
/** Return SSJS signature help for the given function context. */
|
|
4
|
+
export declare function getSsjsSignatureHelp(context: {
|
|
5
|
+
functionName: string;
|
|
6
|
+
paramIndex: number;
|
|
7
|
+
}, localFunctions: LocalSsjsFunction[]): SignatureHelp | null;
|
|
8
|
+
//# sourceMappingURL=ssjs.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Protocol-agnostic types for sfmc-language-lsp.
|
|
3
|
+
*
|
|
4
|
+
* We re-use the standard LSP type definitions from vscode-languageserver-types.
|
|
5
|
+
* These are plain TypeScript interfaces/enums with no runtime VS Code dependency,
|
|
6
|
+
* so they work equally in Node (LSP server, MCP server) and browser (Chrome extension).
|
|
7
|
+
*/
|
|
8
|
+
export type { Position, Range, Diagnostic, CompletionItem, Hover, SignatureHelp, SignatureInformation, ParameterInformation, CodeAction, TextEdit, Location, WorkspaceEdit, } from 'vscode-languageserver-types';
|
|
9
|
+
export { DiagnosticSeverity, CompletionItemKind, InsertTextFormat, MarkupKind, CodeActionKind, } from 'vscode-languageserver-types';
|
|
10
|
+
/** Input context for all language service operations. */
|
|
11
|
+
export interface DocumentContext {
|
|
12
|
+
/** Full document text. */
|
|
13
|
+
text: string;
|
|
14
|
+
/** Language identifier: 'ampscript' or 'ssjs'. */
|
|
15
|
+
languageId: 'ampscript' | 'ssjs';
|
|
16
|
+
/** Optional document URI (used for code action edit maps). */
|
|
17
|
+
uri?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Service-level settings. */
|
|
20
|
+
export interface SfmcSettings {
|
|
21
|
+
/** Maximum number of diagnostics to emit per document. Default: 100. */
|
|
22
|
+
maxNumberOfProblems: number;
|
|
23
|
+
}
|
|
24
|
+
export declare const DEFAULT_SETTINGS: SfmcSettings;
|
|
25
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,EACR,QAAQ,EACR,KAAK,EACL,UAAU,EACV,cAAc,EACd,KAAK,EACL,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,aAAa,GAChB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EACH,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,cAAc,GACjB,MAAM,6BAA6B,CAAC;AAErC,yDAAyD;AACzD,MAAM,WAAW,eAAe;IAC5B,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,UAAU,EAAE,WAAW,GAAG,MAAM,CAAC;IACjC,8DAA8D;IAC9D,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,8BAA8B;AAC9B,MAAM,WAAW,YAAY;IACzB,wEAAwE;IACxE,mBAAmB,EAAE,MAAM,CAAC;CAC/B;AAED,eAAO,MAAM,gBAAgB,EAAE,YAE9B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Comment-range scanning for SSJS/JS source text.
|
|
3
|
+
* String literals are skipped so their content is never misidentified as a comment opener.
|
|
4
|
+
*/
|
|
5
|
+
/** Returns [start, end) character ranges of every comment in the source. */
|
|
6
|
+
export declare function buildCommentRanges(source: string): Array<[number, number]>;
|
|
7
|
+
/** Returns true when `index` falls within any of the given comment ranges. */
|
|
8
|
+
export declare function isInCommentRange(index: number, ranges: Array<[number, number]>): boolean;
|
|
9
|
+
//# sourceMappingURL=comments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../../src/utils/comments.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,4EAA4E;AAC5E,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CA+C1E;AAED,8EAA8E;AAC9E,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,OAAO,CAMxF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markdown documentation builders for AMPscript functions, SSJS functions,
|
|
3
|
+
* ECMAScript built-ins, and file-local SSJS function declarations.
|
|
4
|
+
*/
|
|
5
|
+
import type { AmpscriptFunction } from '../data/ampscript.js';
|
|
6
|
+
import type { SsjsFunction, EcmascriptBuiltin } from '../data/ssjs.js';
|
|
7
|
+
export interface LocalSsjsFunction {
|
|
8
|
+
name: string;
|
|
9
|
+
params: string[];
|
|
10
|
+
description: string;
|
|
11
|
+
paramDocs: Map<string, {
|
|
12
|
+
type: string;
|
|
13
|
+
description: string;
|
|
14
|
+
}>;
|
|
15
|
+
returnType: string;
|
|
16
|
+
startOffset: number;
|
|
17
|
+
}
|
|
18
|
+
/** Build typed-signature Markdown for an AMPscript function. */
|
|
19
|
+
export declare function buildFunctionMarkdown(fn: AmpscriptFunction): string;
|
|
20
|
+
/** Build typed-signature Markdown for an SSJS function or method. */
|
|
21
|
+
export declare function buildSsjsFunctionMarkdown(fn: SsjsFunction): string;
|
|
22
|
+
/** Build Markdown for an ECMAScript built-in method. */
|
|
23
|
+
export declare function buildEcmascriptBuiltinMarkdown(builtin: EcmascriptBuiltin): string;
|
|
24
|
+
/** Build Markdown documentation for a file-local SSJS function declaration. */
|
|
25
|
+
export declare function buildLocalFunctionMarkdown(fn: LocalSsjsFunction): string;
|
|
26
|
+
/** Build a snippet string for an AMPscript function with parameter placeholders. */
|
|
27
|
+
export declare function buildFunctionSnippet(fn: AmpscriptFunction): string;
|
|
28
|
+
/** Build a snippet string for an SSJS function with parameter placeholders. */
|
|
29
|
+
export declare function buildSsjsFunctionSnippet(fn: SsjsFunction): string;
|
|
30
|
+
//# sourceMappingURL=markdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../src/utils/markdown.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEvE,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9D,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,gEAAgE;AAChE,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,iBAAiB,GAAG,MAAM,CA8BnE;AAED,qEAAqE;AACrE,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,YAAY,GAAG,MAAM,CAqClE;AAED,wDAAwD;AACxD,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CA+BjF;AAED,+EAA+E;AAC/E,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,iBAAiB,GAAG,MAAM,CAuBxE;AAED,oFAAoF;AACpF,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,iBAAiB,GAAG,MAAM,CAMlE;AAED,+EAA+E;AAC/E,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,YAAY,GAAG,MAAM,CAOjE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Position, Range } from '../types.js';
|
|
2
|
+
/** Convert a character offset in `text` to an LSP Position. */
|
|
3
|
+
export declare function offsetToPosition(text: string, offset: number): Position;
|
|
4
|
+
/** Convert an LSP Position in `text` to a character offset. */
|
|
5
|
+
export declare function positionToOffset(text: string, position: Position): number;
|
|
6
|
+
/** Extract the text covered by a Range. */
|
|
7
|
+
export declare function getTextInRange(text: string, range: Range): string;
|
|
8
|
+
//# sourceMappingURL=positions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"positions.d.ts","sourceRoot":"","sources":["../../../src/utils/positions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEnD,+DAA+D;AAC/D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,CAQvE;AAED,+DAA+D;AAC/D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAOzE;AAED,2CAA2C;AAC3C,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,CAIjE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for detecting AMPscript and GTL region boundaries within a document.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Returns true when the given character offset falls inside an AMPscript
|
|
6
|
+
* region: a %%[...]%% block, a %%=...=%% inline expression, or a
|
|
7
|
+
* <script language="ampscript"> ... </script> tag body.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isInsideAmpscript(text: string, offset: number): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Returns true when the given character offset falls inside a GTL {{...}} expression.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isInsideGtl(text: string, offset: number): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Returns a sanitized copy of the document where only the code inside
|
|
16
|
+
* AMPscript regions is preserved (strings blanked, comments blanked).
|
|
17
|
+
* Everything outside AMPscript regions is replaced with spaces.
|
|
18
|
+
* This lets validators run regex safely without accidentally matching
|
|
19
|
+
* HTML content outside AMPscript blocks.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getSanitizedAmpscriptText(text: string): string;
|
|
22
|
+
//# sourceMappingURL=regions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regions.d.ts","sourceRoot":"","sources":["../../../src/utils/regions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAgCvE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAKjE;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAwB9D"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* General text-parsing utilities used across validators, completions, and hover providers.
|
|
3
|
+
*/
|
|
4
|
+
/** Returns all start offsets of `search` within `text`. */
|
|
5
|
+
export declare function findAllOccurrences(text: string, search: string): number[];
|
|
6
|
+
/**
|
|
7
|
+
* Counts the number of top-level arguments in a function call starting at `openParenPos`.
|
|
8
|
+
* Runs on sanitized text so commas inside strings/comments don't produce false positives.
|
|
9
|
+
*
|
|
10
|
+
* Returns 0 for empty `()`, `commas + 1` otherwise, or -1 if no closing paren is found.
|
|
11
|
+
*/
|
|
12
|
+
export declare function countFunctionArguments(text: string, openParenPos: number): number;
|
|
13
|
+
export interface ArgumentSpan {
|
|
14
|
+
value: string;
|
|
15
|
+
start: number;
|
|
16
|
+
end: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Extracts each top-level argument's text and absolute position from a function call.
|
|
20
|
+
* Returns null when the argument list is not properly closed.
|
|
21
|
+
*/
|
|
22
|
+
export declare function extractFunctionArguments(text: string, openParenPos: number): ArgumentSpan[] | null;
|
|
23
|
+
/**
|
|
24
|
+
* Infers the literal type of a trimmed argument string.
|
|
25
|
+
* Returns null for variables, expressions, or nested calls.
|
|
26
|
+
*/
|
|
27
|
+
export declare function inferLiteralType(arg: string): 'string' | 'number' | 'boolean' | null;
|
|
28
|
+
/** Returns the word boundaries around a character position in a line. */
|
|
29
|
+
export declare function getWordRangeAtPosition(line: string, character: number): {
|
|
30
|
+
start: number;
|
|
31
|
+
end: number;
|
|
32
|
+
} | null;
|
|
33
|
+
/**
|
|
34
|
+
* Walk backward from the cursor to find the enclosing function call name
|
|
35
|
+
* and the current parameter index (0-based comma count).
|
|
36
|
+
*/
|
|
37
|
+
export declare function findFunctionContext(textUpToCursor: string): {
|
|
38
|
+
functionName: string;
|
|
39
|
+
paramIndex: number;
|
|
40
|
+
} | null;
|
|
41
|
+
//# sourceMappingURL=text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/utils/text.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,2DAA2D;AAC3D,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAQzE;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAsBjF;AAED,MAAM,WAAW,YAAY;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,YAAY,EAAE,GAAG,IAAI,CA+BlG;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,IAAI,CAKpF;AAED,yEAAyE;AACzE,wBAAgB,sBAAsB,CAClC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAClB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAWvC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAC/B,cAAc,EAAE,MAAM,GACvB;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAuBrD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Diagnostic } from '../types.js';
|
|
2
|
+
import type { SfmcSettings } from '../types.js';
|
|
3
|
+
export declare const DIAG_CODE_HTML_WRAPPED_COMMENT = "ampscript/html-wrapped-comment";
|
|
4
|
+
export declare const DIAG_CODE_HTML_COMMENT = "ampscript/html-comment";
|
|
5
|
+
export declare const DIAG_CODE_JS_LINE_COMMENT = "ampscript/js-line-comment";
|
|
6
|
+
export declare const DIAG_CODE_NESTED_SCRIPT_TAG = "ampscript/nested-script-tag";
|
|
7
|
+
export declare const DIAG_CODE_NESTED_DELIMITER_IN_SCRIPT = "ampscript/nested-delimiter-in-script";
|
|
8
|
+
export declare const DIAG_CODE_NESTED_DELIMITER = "ampscript/nested-delimiter";
|
|
9
|
+
/** Validate an AMPscript document and return LSP Diagnostics. */
|
|
10
|
+
export declare function validateAmpscript(text: string, settings?: SfmcSettings): Diagnostic[];
|
|
11
|
+
//# sourceMappingURL=ampscript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ampscript.d.ts","sourceRoot":"","sources":["../../../src/validators/ampscript.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAiBhD,eAAO,MAAM,8BAA8B,mCAAmC,CAAC;AAC/E,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAC/D,eAAO,MAAM,yBAAyB,8BAA8B,CAAC;AACrE,eAAO,MAAM,2BAA2B,gCAAgC,CAAC;AACzE,eAAO,MAAM,oCAAoC,yCAAyC,CAAC;AAC3F,eAAO,MAAM,0BAA0B,+BAA+B,CAAC;AAkCvE,iEAAiE;AACjE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,YAA+B,GAAG,UAAU,EAAE,CAqZvG"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Diagnostic } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Validate GTL block balance ({{#each}}/{{/each}}, {{#if}}/{{/if}}, etc.)
|
|
4
|
+
* and push any diagnostics into the provided array.
|
|
5
|
+
*/
|
|
6
|
+
export declare function validateGtlBlocks(text: string, diagnostics: Diagnostic[], remainingBudget: number): void;
|
|
7
|
+
//# sourceMappingURL=gtl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gtl.d.ts","sourceRoot":"","sources":["../../../src/validators/gtl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAkB9C;;;GAGG;AACH,wBAAgB,iBAAiB,CAC7B,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,UAAU,EAAE,EACzB,eAAe,EAAE,MAAM,GACxB,IAAI,CA+DN"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Diagnostic } from '../types.js';
|
|
2
|
+
import type { SfmcSettings } from '../types.js';
|
|
3
|
+
/** Validate an SSJS document and return LSP Diagnostics. */
|
|
4
|
+
export declare function validateSsjs(text: string, settings?: SfmcSettings): Diagnostic[];
|
|
5
|
+
//# sourceMappingURL=ssjs.d.ts.map
|