@cratis/screenplay-language 4.250.1 → 4.252.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/bundles/compiler/Parsing/InteractionAlternatives.js +1 -1
- package/dist/bundles/compiler/Parsing/InteractionAlternatives.js.map +1 -1
- package/dist/bundles/completion-planner.js +1 -1
- package/dist/bundles/completion-planner.js.map +1 -1
- package/dist/bundles/declarations.js +2 -0
- package/dist/bundles/declarations.js.map +1 -0
- package/dist/bundles/index.js +1 -1
- package/dist/bundles/index.js.map +1 -1
- package/dist/bundles/keyword-docs.js +1 -1
- package/dist/bundles/keyword-docs.js.map +1 -1
- package/dist/bundles/validation.js +2 -2
- package/dist/bundles/validation.js.map +1 -1
- package/dist/declarations.d.ts +19 -0
- package/dist/declarations.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/validation.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{dotNetWhitespace as t,pattern as n}from"../Text/patterns.js";import{locationOf as r}from"./SourceLine.js";import{firstWord as i}from"./LineText.js";import{interactionBody as a,interactionExecutions as o}from"./InteractionExecutions.js";import{parseCondition as s}from"./ConditionParser.js";import{validateCondition as c}from"./GuardedActionParser.js";import{LineReader as l}from"./LineReader.js";import{ParserContext as u}from"./ParserContext.js";const d=n(`^screen${t}+template(?:${t}|$)`);function interactionAncestry(e){let t=/* @__PURE__ */ new Map,n=[],a=!1;for(let o of e)if(o.content.startsWith("```"))a=!a;else if(!(a||o.content.length===0||o.content.startsWith(`//`))){for(;n.length>0&&n[n.length-1].indent>=o.indent;)n.pop();[`on`,`uses`].includes(i(o.content))&&t.set(o.number,n.map(e=>({keyword:d.test(e.content)?`screen template`:i(e.content),location:r(e)}))),n.push(o)}return t}const f=n(`^when${t}+([^\\n]+)${t}+execute${t}+([A-Za-z_]\\w*(?:\\.\\w+)*)$`),p=n(`^on${t}+([^\\n]+)$`),m=n(`^where${t}+([^\\n]+)$`),h=/* @__PURE__ */ new Set([`execute`,`navigate`,`open`,`close`,`refresh`,`set`,`notify`,`confirm`,`raise`]),g=n(`^behavior${t}+([A-Za-z_]\\w*)$`),_=n(`^uses${t}+([A-Za-z_]\\w*)$`),v=n(`^([A-Za-z_]\\w*)${t}+([^\\n]+)$`);function validateInteractionBodies(t,n){let l=g.exec(n[0]?.content??``);l!==null&&t.interactionBehaviors.push({name:l[1],location:r(n[0])});for(let l=0;l<n.length;l++){let u=n[l],d=_.exec(u.content);d!==null&&t.interactionUses.push({behavior:d[1],location:r(u),ancestors:t.interactionAncestors.get(u.number)??[],arguments:a(n,u).flatMap(e=>{let t=v.exec(e.content);return t===null?[]:[{name:t[1],value:t[2].trim()}]})});let g=p.exec(u.content);if(g===null||g[1].startsWith(`row-click `))continue;let y=[];for(let e=l+1;e<n.length&&n[e].indent>u.indent;e++)y.push(n[e]);let b=y.filter(e=>e.indent===y[0]?.indent),x=b.filter(e=>[`when`,`otherwise`].includes(i(e.content))),S=[`click`,`double click`,`select`].includes(g[1].trim()),C=b.filter(e=>m.test(e.content)),
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{dotNetWhitespace as t,pattern as n}from"../Text/patterns.js";import{locationOf as r}from"./SourceLine.js";import{firstWord as i}from"./LineText.js";import{interactionBody as a,interactionExecutions as o}from"./InteractionExecutions.js";import{parseCondition as s}from"./ConditionParser.js";import{validateCondition as c}from"./GuardedActionParser.js";import{LineReader as l}from"./LineReader.js";import{ParserContext as u}from"./ParserContext.js";const d=n(`^screen${t}+template(?:${t}|$)`);function interactionAncestry(e){let t=/* @__PURE__ */ new Map,n=[],a=!1;for(let o of e)if(o.content.startsWith("```"))a=!a;else if(!(a||o.content.length===0||o.content.startsWith(`//`))){for(;n.length>0&&n[n.length-1].indent>=o.indent;)n.pop();[`on`,`uses`].includes(i(o.content))&&t.set(o.number,n.map(e=>({keyword:d.test(e.content)?`screen template`:i(e.content),location:r(e)}))),n.push(o)}return t}const f=n(`^when${t}+([^\\n]+)${t}+execute${t}+([A-Za-z_]\\w*(?:\\.\\w+)*)$`),p=n(`^on${t}+([^\\n]+)$`),m=n(`^where${t}+([^\\n]+)$`),h=/* @__PURE__ */ new Set([`execute`,`navigate`,`open`,`close`,`refresh`,`set`,`notify`,`confirm`,`raise`]),g=n(`^behavior${t}+([A-Za-z_]\\w*)$`),_=n(`^uses${t}+([A-Za-z_]\\w*)$`),v=n(`^([A-Za-z_]\\w*)${t}+([^\\n]+)$`);function validateInteractionBodies(t,n){let l=g.exec(n[0]?.content??``);l!==null&&t.interactionBehaviors.push({name:l[1],location:r(n[0])});for(let l=0;l<n.length;l++){let u=n[l],d=_.exec(u.content);d!==null&&t.interactionUses.push({behavior:d[1],location:r(u),ancestors:t.interactionAncestors.get(u.number)??[],arguments:a(n,u).flatMap(e=>{let t=v.exec(e.content);return t===null?[]:[{name:t[1],value:t[2].trim()}]})});let g=p.exec(u.content);if(g===null||g[1].startsWith(`row-click `))continue;let y=[];for(let e=l+1;e<n.length&&n[e].indent>u.indent;e++)y.push(n[e]);let b=y.filter(e=>e.indent===y[0]?.indent),x=b.filter(e=>[`when`,`otherwise`].includes(i(e.content))),S=[`click`,`double click`,`select`,`change`].includes(g[1].trim()),C=[`click`,`double click`,`select`].includes(g[1].trim()),w=b.filter(e=>m.test(e.content)),T=[],E=[],D=!1;for(let n of x){let l=i(n.content)===`when`,u=l?f.exec(n.content):null;if(l){D&&t.error(e.MisplacedActionOtherwise,`A 'when' alternative must precede 'otherwise'`,r(n));let i=s(t,u?.[1]??n.content.slice(4).trim(),r(n),!0);if(i!==null){c(t,i);let e=o(u===null?a(y,n):[{...n,content:`execute ${u[2]}`},...a(y,n)]);T.push({condition:i,executions:e,location:r(n),message:`This 'when' alternative is shadowed by earlier alternatives in this interaction`})}u!==null&&t.error(e.InlineInteractionAlternative,`Interaction alternatives require an indented action list, not 'when <condition> execute <Command>'`,r(n))}else(D||n.content!==`otherwise`)&&t.error(e.MisplacedActionOtherwise,`An interaction permits one final block-form 'otherwise'`,r(n)),D=!0,E=o(a(y,n));let d=y[y.indexOf(n)+1];u===null&&(d===void 0||d.indent<=n.indent||!h.has(i(d.content)))&&t.error(e.InteractionAlternativeWithoutActions,`An interaction alternative requires a non-empty action list`,r(n))}if(x.length>0&&(S||t.error(e.UnsupportedInteractionAlternatives,`Interaction alternatives are only supported on click, double click, select and change`,r(u)),(w.length>0||b.some(e=>h.has(i(e.content))))&&t.error(e.MixedInteractionAlternatives,`Interaction alternatives cannot mix with plain actions or 'where'`,r(u)),x.some(e=>i(e.content)===`when`)||t.error(e.GuardedActionWithoutAlternatives,`A guarded interaction requires at least one 'when' alternative`,r(u))),C)for(let e of w)deprecateWhere(t,e);T.length>0&&t.guardedInteractions.push({location:r(u),ancestors:t.interactionAncestors.get(u.number)??[],alternatives:T,otherwise:E})}}function deprecateWhere(t,n){let i=new u(new l([]));i.sourceOptions=t.sourceOptions;let a=s(i,m.exec(n.content)[1].trim(),r(n),!0);a!==null&&c(i,a);let o=`Opaque 'where' on click, double click and select is deprecated; use block-form 'when' item conditions`;a!==null&&i.diagnostics.length===0?t.warning(e.LegacyInteractionWhere,o,r(n)):t.information(e.LegacyInteractionWhere,o,r(n))}export{interactionAncestry,validateInteractionBodies};
|
|
2
2
|
//# sourceMappingURL=InteractionAlternatives.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InteractionAlternatives.js","names":["screenTemplate","pattern","dotNetWhitespace","result","ancestors","fenced","line","lines","firstWord","ancestor","locationOf","inline","trigger","where","actions","behavior","uses","behaviorArgument","declaration","context","index","header","attachment","interactionBody","match","on","body","child","children","branches","supported","guards","alternatives","otherwise","sawOtherwise","branch","isWhen","DiagnosticCodes","condition","parseCondition","validateCondition","executions","interactionExecutions","nested","guard","probe","ParserContext","LineReader","message"],"sources":["../../../../../../Compiler/Parsing/InteractionAlternatives.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { GuardedInteractionAlternative } from './GuardedInteractionAlternative';\nimport { InteractionExecution } from './InteractionExecution';\nimport { interactionBody, interactionExecutions } from './InteractionExecutions';\nimport { dotNetWhitespace, pattern } from '../Text/patterns';\nimport { parseCondition } from './ConditionParser';\nimport { validateCondition } from './GuardedActionParser';\nimport { firstWord } from './LineText';\nimport { LineReader } from './LineReader';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\n// Authoring facts only: interaction bodies are still opaque in the serialized TS AST.\nexport interface InteractionAncestor {\n readonly keyword: string;\n readonly location: SourceLocation;\n}\n\nexport interface GuardedInteractionBinding {\n readonly location: SourceLocation;\n readonly ancestors: readonly InteractionAncestor[];\n readonly alternatives: readonly GuardedInteractionAlternative[];\n readonly otherwise: readonly InteractionExecution[];\n}\n\nconst screenTemplate = pattern(`^screen${dotNetWhitespace}+template(?:${dotNetWhitespace}|$)`);\n\n// Capture attachment ancestry before parsing consumes opaque bodies. Fenced code is not Screenplay.\nexport function interactionAncestry(lines: readonly SourceLine[]): ReadonlyMap<number, readonly InteractionAncestor[]> {\n const result = new Map<number, readonly InteractionAncestor[]>();\n const ancestors: SourceLine[] = [];\n let fenced = false;\n for (const line of lines) {\n if (line.content.startsWith('```')) {\n fenced = !fenced;\n continue;\n }\n if (fenced || line.content.length === 0 || line.content.startsWith('//')) continue;\n while (ancestors.length > 0 && ancestors[ancestors.length - 1].indent >= line.indent) ancestors.pop();\n if (['on', 'uses'].includes(firstWord(line.content))) result.set(line.number, ancestors.map(ancestor => ({ keyword: screenTemplate.test(ancestor.content) ? 'screen template' : firstWord(ancestor.content), location: locationOf(ancestor) })));\n ancestors.push(line);\n }\n return result;\n}\n\nconst inline = pattern(`^when${dotNetWhitespace}+([^\\\\n]+)${dotNetWhitespace}+execute${dotNetWhitespace}+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$`);\nconst trigger = pattern(`^on${dotNetWhitespace}+([^\\\\n]+)$`);\nconst where = pattern(`^where${dotNetWhitespace}+([^\\\\n]+)$`);\nconst actions = new Set(['execute', 'navigate', 'open', 'close', 'refresh', 'set', 'notify', 'confirm', 'raise']);\nconst behavior = pattern(`^behavior${dotNetWhitespace}+([A-Za-z_]\\\\w*)$`);\nconst uses = pattern(`^uses${dotNetWhitespace}+([A-Za-z_]\\\\w*)$`);\nconst behaviorArgument = pattern(`^([A-Za-z_]\\\\w*)${dotNetWhitespace}+([^\\\\n]+)$`);\n\n// Interaction bodies remain opaque in the TS AST. Check their structure instead of silently accepting\n// alternatives the C# compiler refuses. Input collection supplies only significant, non-fenced lines.\nexport function validateInteractionBodies(context: ParserContext, lines: readonly SourceLine[]): void {\n const declaration = behavior.exec(lines[0]?.content ?? '');\n if (declaration !== null) context.interactionBehaviors.push({ name: declaration[1], location: locationOf(lines[0]) });\n for (let index = 0; index < lines.length; index++) {\n const header = lines[index];\n const attachment = uses.exec(header.content);\n if (attachment !== null) context.interactionUses.push({\n behavior: attachment[1], location: locationOf(header), ancestors: context.interactionAncestors.get(header.number) ?? [],\n arguments: interactionBody(lines, header).flatMap(line => {\n const match = behaviorArgument.exec(line.content);\n return match === null ? [] : [{ name: match[1], value: match[2].trim() }];\n }),\n });\n const on = trigger.exec(header.content);\n if (on === null || on[1].startsWith('row-click ')) continue;\n const body: SourceLine[] = [];\n for (let child = index + 1; child < lines.length && lines[child].indent > header.indent; child++) body.push(lines[child]);\n const children = body.filter(line => line.indent === body[0]?.indent);\n const branches = children.filter(line => ['when', 'otherwise'].includes(firstWord(line.content)));\n const supported = ['click', 'double click', 'select'].includes(on[1].trim());\n const guards = children.filter(line => where.test(line.content));\n const alternatives: GuardedInteractionAlternative[] = [];\n let otherwise: readonly InteractionExecution[] = [];\n let sawOtherwise = false;\n for (const branch of branches) {\n const isWhen = firstWord(branch.content) === 'when';\n const match = isWhen ? inline.exec(branch.content) : null;\n if (isWhen) {\n if (sawOtherwise) context.error(DiagnosticCodes.MisplacedActionOtherwise, \"A 'when' alternative must precede 'otherwise'\", locationOf(branch));\n const condition = parseCondition(context, match?.[1] ?? branch.content.slice(4).trim(), locationOf(branch), true);\n if (condition !== null) {\n validateCondition(context, condition);\n const executions = match === null ? interactionExecutions(interactionBody(body, branch))\n : interactionExecutions([{ ...branch, content: `execute ${match[2]}` }, ...interactionBody(body, branch)]);\n alternatives.push({ condition, executions, location: locationOf(branch), message: \"This 'when' alternative is shadowed by earlier alternatives in this interaction\" });\n }\n if (match !== null) context.error(DiagnosticCodes.InlineInteractionAlternative, \"Interaction alternatives require an indented action list, not 'when <condition> execute <Command>'\", locationOf(branch));\n } else {\n if (sawOtherwise || branch.content !== 'otherwise') context.error(DiagnosticCodes.MisplacedActionOtherwise, \"An interaction permits one final block-form 'otherwise'\", locationOf(branch));\n sawOtherwise = true;\n otherwise = interactionExecutions(interactionBody(body, branch));\n }\n const position = body.indexOf(branch);\n const nested = body[position + 1];\n if (match === null && (nested === undefined || nested.indent <= branch.indent || !actions.has(firstWord(nested.content)))) {\n context.error(DiagnosticCodes.InteractionAlternativeWithoutActions, 'An interaction alternative requires a non-empty action list', locationOf(branch));\n }\n }\n if (branches.length > 0) {\n if (!supported) context.error(DiagnosticCodes.UnsupportedInteractionAlternatives, 'Interaction alternatives are only supported on click, double click and select', locationOf(header));\n if (guards.length > 0 || children.some(line => actions.has(firstWord(line.content)))) {\n context.error(DiagnosticCodes.MixedInteractionAlternatives, \"Interaction alternatives cannot mix with plain actions or 'where'\", locationOf(header));\n }\n if (!branches.some(line => firstWord(line.content) === 'when')) context.error(DiagnosticCodes.GuardedActionWithoutAlternatives, \"A guarded interaction requires at least one 'when' alternative\", locationOf(header));\n }\n if (supported) for (const guard of guards) deprecateWhere(context, guard);\n if (alternatives.length > 0) context.guardedInteractions.push({ location: locationOf(header), ancestors: context.interactionAncestors.get(header.number) ?? [], alternatives, otherwise });\n }\n}\n\nfunction deprecateWhere(context: ParserContext, line: SourceLine): void {\n const probe = new ParserContext(new LineReader([]));\n probe.sourceOptions = context.sourceOptions;\n const condition = parseCondition(probe, where.exec(line.content)![1].trim(), locationOf(line), true);\n if (condition !== null) validateCondition(probe, condition);\n const message = \"Opaque 'where' on click, double click and select is deprecated; use block-form 'when' item conditions\";\n if (condition !== null && probe.diagnostics.length === 0) context.warning(DiagnosticCodes.LegacyInteractionWhere, message, locationOf(line));\n else context.information(DiagnosticCodes.LegacyInteractionWhere, message, locationOf(line));\n}\n"],"mappings":"+jBA6BA,MAAMA,EAAiBC,EAAQ,UAAUC,EAAiB,cAAcA,EAAiB,IAAI,EAG7F,SAAgB,oBAAoB,EAAmF,CACnH,IAAMC,kBAAS,IAAI,IACbC,EAA0B,CAAC,EAC7BC,EAAS,GACb,IAAK,IAAMC,KAAQC,EACf,GAAID,EAAK,QAAQ,WAAW,KAAK,EAC7B,EAAS,CAACD,OAGd,GAAI,KAAUC,EAAK,QAAQ,SAAW,GAAKA,EAAK,QAAQ,WAAW,IAAI,GACvE,MAAOF,EAAU,OAAS,GAAKA,EAAUA,EAAU,OAAS,EAAE,CAAC,QAAUE,EAAK,QAAQF,EAAU,IAAI,EAChG,CAAC,KAAM,MAAM,CAAC,CAAC,SAASI,EAAUF,EAAK,OAAO,CAAC,GAAGH,EAAO,IAAIG,EAAK,OAAQF,EAAU,IAAI,IAAa,CAAE,QAASJ,EAAe,KAAKS,EAAS,OAAO,EAAI,kBAAoBD,EAAUC,EAAS,OAAO,EAAG,SAAUC,EAAWD,CAAQ,CAAE,EAAE,CAAC,EAC/OL,EAAU,KAAKE,CAAI,CAFiF,CAIxG,OAAOH,CACX,CAEA,MAAMQ,EAASV,EAAQ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AC9B,IAAMmB,EAAYC,EAAeM,EAAOhC,EAAM,KAAKP,EAAK,OAAO,CAAC,CAAE,EAAE,CAAC,KAAK,EAAGI,EAAWJ,CAAI,EAAG,EAAI,EAC/FgC,IAAc,MAAME,EAAkBK,EAAOP,CAAS,EAC1D,IAAMU,EAAU,wGACZV,IAAc,MAAQO,EAAM,YAAY,SAAW,EAAG1B,EAAQ,QAAQkB,EAAgB,uBAAwBW,EAAStC,EAAWJ,CAAI,CAAC,EACtIa,EAAQ,YAAYkB,EAAgB,uBAAwBW,EAAStC,EAAWJ,CAAI,CAAC,CAC9F"}
|
|
1
|
+
{"version":3,"file":"InteractionAlternatives.js","names":["screenTemplate","pattern","dotNetWhitespace","result","ancestors","fenced","line","lines","firstWord","ancestor","locationOf","inline","trigger","where","actions","behavior","uses","behaviorArgument","declaration","context","index","header","attachment","interactionBody","match","on","body","child","children","branches","supported","deprecatesWhere","guards","alternatives","otherwise","sawOtherwise","branch","isWhen","DiagnosticCodes","condition","parseCondition","validateCondition","executions","interactionExecutions","nested","guard","probe","ParserContext","LineReader","message"],"sources":["../../../../../../Compiler/Parsing/InteractionAlternatives.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { GuardedInteractionAlternative } from './GuardedInteractionAlternative';\nimport { InteractionExecution } from './InteractionExecution';\nimport { interactionBody, interactionExecutions } from './InteractionExecutions';\nimport { dotNetWhitespace, pattern } from '../Text/patterns';\nimport { parseCondition } from './ConditionParser';\nimport { validateCondition } from './GuardedActionParser';\nimport { firstWord } from './LineText';\nimport { LineReader } from './LineReader';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\n// Authoring facts only: interaction bodies are still opaque in the serialized TS AST.\nexport interface InteractionAncestor {\n readonly keyword: string;\n readonly location: SourceLocation;\n}\n\nexport interface GuardedInteractionBinding {\n readonly location: SourceLocation;\n readonly ancestors: readonly InteractionAncestor[];\n readonly alternatives: readonly GuardedInteractionAlternative[];\n readonly otherwise: readonly InteractionExecution[];\n}\n\nconst screenTemplate = pattern(`^screen${dotNetWhitespace}+template(?:${dotNetWhitespace}|$)`);\n\n// Capture attachment ancestry before parsing consumes opaque bodies. Fenced code is not Screenplay.\nexport function interactionAncestry(lines: readonly SourceLine[]): ReadonlyMap<number, readonly InteractionAncestor[]> {\n const result = new Map<number, readonly InteractionAncestor[]>();\n const ancestors: SourceLine[] = [];\n let fenced = false;\n for (const line of lines) {\n if (line.content.startsWith('```')) {\n fenced = !fenced;\n continue;\n }\n if (fenced || line.content.length === 0 || line.content.startsWith('//')) continue;\n while (ancestors.length > 0 && ancestors[ancestors.length - 1].indent >= line.indent) ancestors.pop();\n if (['on', 'uses'].includes(firstWord(line.content))) result.set(line.number, ancestors.map(ancestor => ({ keyword: screenTemplate.test(ancestor.content) ? 'screen template' : firstWord(ancestor.content), location: locationOf(ancestor) })));\n ancestors.push(line);\n }\n return result;\n}\n\nconst inline = pattern(`^when${dotNetWhitespace}+([^\\\\n]+)${dotNetWhitespace}+execute${dotNetWhitespace}+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$`);\nconst trigger = pattern(`^on${dotNetWhitespace}+([^\\\\n]+)$`);\nconst where = pattern(`^where${dotNetWhitespace}+([^\\\\n]+)$`);\nconst actions = new Set(['execute', 'navigate', 'open', 'close', 'refresh', 'set', 'notify', 'confirm', 'raise']);\nconst behavior = pattern(`^behavior${dotNetWhitespace}+([A-Za-z_]\\\\w*)$`);\nconst uses = pattern(`^uses${dotNetWhitespace}+([A-Za-z_]\\\\w*)$`);\nconst behaviorArgument = pattern(`^([A-Za-z_]\\\\w*)${dotNetWhitespace}+([^\\\\n]+)$`);\n\n// Interaction bodies remain opaque in the TS AST. Check their structure instead of silently accepting\n// alternatives the C# compiler refuses. Input collection supplies only significant, non-fenced lines.\nexport function validateInteractionBodies(context: ParserContext, lines: readonly SourceLine[]): void {\n const declaration = behavior.exec(lines[0]?.content ?? '');\n if (declaration !== null) context.interactionBehaviors.push({ name: declaration[1], location: locationOf(lines[0]) });\n for (let index = 0; index < lines.length; index++) {\n const header = lines[index];\n const attachment = uses.exec(header.content);\n if (attachment !== null) context.interactionUses.push({\n behavior: attachment[1], location: locationOf(header), ancestors: context.interactionAncestors.get(header.number) ?? [],\n arguments: interactionBody(lines, header).flatMap(line => {\n const match = behaviorArgument.exec(line.content);\n return match === null ? [] : [{ name: match[1], value: match[2].trim() }];\n }),\n });\n const on = trigger.exec(header.content);\n if (on === null || on[1].startsWith('row-click ')) continue;\n const body: SourceLine[] = [];\n for (let child = index + 1; child < lines.length && lines[child].indent > header.indent; child++) body.push(lines[child]);\n const children = body.filter(line => line.indent === body[0]?.indent);\n const branches = children.filter(line => ['when', 'otherwise'].includes(firstWord(line.content)));\n const supported = ['click', 'double click', 'select', 'change'].includes(on[1].trim());\n const deprecatesWhere = ['click', 'double click', 'select'].includes(on[1].trim());\n const guards = children.filter(line => where.test(line.content));\n const alternatives: GuardedInteractionAlternative[] = [];\n let otherwise: readonly InteractionExecution[] = [];\n let sawOtherwise = false;\n for (const branch of branches) {\n const isWhen = firstWord(branch.content) === 'when';\n const match = isWhen ? inline.exec(branch.content) : null;\n if (isWhen) {\n if (sawOtherwise) context.error(DiagnosticCodes.MisplacedActionOtherwise, \"A 'when' alternative must precede 'otherwise'\", locationOf(branch));\n const condition = parseCondition(context, match?.[1] ?? branch.content.slice(4).trim(), locationOf(branch), true);\n if (condition !== null) {\n validateCondition(context, condition);\n const executions = match === null ? interactionExecutions(interactionBody(body, branch))\n : interactionExecutions([{ ...branch, content: `execute ${match[2]}` }, ...interactionBody(body, branch)]);\n alternatives.push({ condition, executions, location: locationOf(branch), message: \"This 'when' alternative is shadowed by earlier alternatives in this interaction\" });\n }\n if (match !== null) context.error(DiagnosticCodes.InlineInteractionAlternative, \"Interaction alternatives require an indented action list, not 'when <condition> execute <Command>'\", locationOf(branch));\n } else {\n if (sawOtherwise || branch.content !== 'otherwise') context.error(DiagnosticCodes.MisplacedActionOtherwise, \"An interaction permits one final block-form 'otherwise'\", locationOf(branch));\n sawOtherwise = true;\n otherwise = interactionExecutions(interactionBody(body, branch));\n }\n const position = body.indexOf(branch);\n const nested = body[position + 1];\n if (match === null && (nested === undefined || nested.indent <= branch.indent || !actions.has(firstWord(nested.content)))) {\n context.error(DiagnosticCodes.InteractionAlternativeWithoutActions, 'An interaction alternative requires a non-empty action list', locationOf(branch));\n }\n }\n if (branches.length > 0) {\n if (!supported) context.error(DiagnosticCodes.UnsupportedInteractionAlternatives, 'Interaction alternatives are only supported on click, double click, select and change', locationOf(header));\n if (guards.length > 0 || children.some(line => actions.has(firstWord(line.content)))) {\n context.error(DiagnosticCodes.MixedInteractionAlternatives, \"Interaction alternatives cannot mix with plain actions or 'where'\", locationOf(header));\n }\n if (!branches.some(line => firstWord(line.content) === 'when')) context.error(DiagnosticCodes.GuardedActionWithoutAlternatives, \"A guarded interaction requires at least one 'when' alternative\", locationOf(header));\n }\n if (deprecatesWhere) for (const guard of guards) deprecateWhere(context, guard);\n if (alternatives.length > 0) context.guardedInteractions.push({ location: locationOf(header), ancestors: context.interactionAncestors.get(header.number) ?? [], alternatives, otherwise });\n }\n}\n\nfunction deprecateWhere(context: ParserContext, line: SourceLine): void {\n const probe = new ParserContext(new LineReader([]));\n probe.sourceOptions = context.sourceOptions;\n const condition = parseCondition(probe, where.exec(line.content)![1].trim(), locationOf(line), true);\n if (condition !== null) validateCondition(probe, condition);\n const message = \"Opaque 'where' on click, double click and select is deprecated; use block-form 'when' item conditions\";\n if (condition !== null && probe.diagnostics.length === 0) context.warning(DiagnosticCodes.LegacyInteractionWhere, message, locationOf(line));\n else context.information(DiagnosticCodes.LegacyInteractionWhere, message, locationOf(line));\n}\n"],"mappings":"+jBA6BA,MAAMA,EAAiBC,EAAQ,UAAUC,EAAiB,cAAc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ain as e,enclosingHeaders as t,fenceMap as n,indentOf as r,nearestEnclosingLine as i,withoutComment as a}from"./document-context.js";import{purposeItems as o}from"./purpose-items.js";import{authenticationItems as s,behaviorItems as c,contributeItems as l,featureScopeItems as u,formItems as d,layoutItems as f,moduleScopeItems as p,navigationItems as m,outcomeItems as h,personaItems as g,profileAppearanceItems as _,profileIdentityItems as v,profileRootTemplateItems as y,profileSampleDataItems as b,readModelItems as x,reducerItems as S,sampleDataItems as C,sampleShapeItems as w,seedItems as T,templateItems as E,themeItems as D,toolbarItems as O,uiProfileItems as k}from"./scope-items.js";import{actionArgumentItems as A,actionItems as j,actionSubjectItems as ee,actionSubjectValueItems as te,commandItems as M,commandRuleItems as ne,conceptItems as N,constraintItems as P,eventItems as F,guardedActionItems as re,handlerItems as I,identityItems as L,implementationItems as R,inlineEventItems as z,interactionActionItems as B,interactionChoiceItems as ie,invocationItems as V,namedRuleImplementationItems as ae,operationImplementationItems as H,operationItems as U,operationPhaseItems as W,optionalTypeItems as G,performerItems as K,policyItems as q,producesItems as J,queryItems as oe,reactionItems as se,reactionTriggerItems as ce,refusalItems as le,ruleItems as ue,screenItems as Y,sliceItemsFor as de,specificationItems as fe,specificationStepItems as pe,tableItems as me,topLevelItems as he,triggerItems as ge,typeItems as _e,validateItems as X}from"./completion-items.js";import{scanDocument as Z}from"./symbols.js";import{responseCompletions as ve}from"./response-completions.js";import{exampleCompletions as ye}from"./example-authoring.js";import{refusalContext as be}from"./refusal-context.js";import{generationCompletions as xe}from"./generation-completions.js";import{namedRuleContext as Q}from"./named-rule-context.js";import{continuationResponseCompletions as Se}from"./continuation-responses.js";import{dependencyTargetCompletions as Ce}from"./dependency-completions.js";import{structureCompletion as we}from"./structure-completions.js";import{getSubLanguage as Te}from"./sub-language-registry.js";import{readModelKeyCompletions as Ee}from"./read-model-key-completions.js";import{commandReadCompletions as De}from"./command-read-completions.js";const $={label:`stream`,insertText:"stream ${1:Source.Stream}",documentation:`Replace the whole command route for this event production. ESM v10.`},Oe=/(?:^|\s)rule\s+[A-Za-z_]\w*(?:\s+severity\s+(?:information|warning|error))?(?:\s+message\s+.*)?$/,declaredIn=(e,t)=>e.some(e=>RegExp(`^${t}\\b`).test(e));function topLevelEntries(e){return he.filter(t=>!(t.label===`domain`&&declaredIn(e,`domain`))&&!(t.label===`authentication`&&declaredIn(e,`authentication`))&&!(t.label===`identity`&&declaredIn(e,`identity`)))}const isTemplate=e=>/^(?:screen|dialog)\s+template\b/.test(e??``);function expansionEntry(e,t){let n=e.split(`
|
|
2
2
|
`).map((e,n)=>n===0?e:e.slice(Math.min(t,r(e)))).join(`
|
|
3
3
|
`);return{label:e.split(`
|
|
4
|
-
`)[0].trim(),insertText:n.replace(/[$}\\]/g,`\\$&`),documentation:`Expands the whole block from what the command and its events declare.`}}function completionEntriesFor(e,t={headers:[],document:[]}){let n=e[0];if(n===void 0||n===`domain`)return topLevelEntries(t.document);let r=Te(n);if(r)return r.completions??[];let i=t.headers[0];switch(n){case`purpose`:return o;case`module`:return p;case`feature`:return u;case`slice`:return de(i?.split(/\s+/)[1]);case`concept`:return/:\s*Enum\b/.test(i??``)?[...N.filter(e=>e.label!==`validate checksum`),{label:`enum member (numbered)`,insertText:"${1:value} = ${2:0}",documentation:`Every member must declare a unique int32 number. Keep published numbers unchanged; specifications name members, not numbers.`}]:N.filter(e=>e.label!==`validate checksum`||/:\s*String\b/.test(i??``));case`type`:return _e;case`command`:return M;case`public`:case`event`:return F;case`readmodel`:return x;case`reducer`:return S;case`form`:return d;case`contribute`:return l;case`behavior`:return c;case`persona`:return g;case`identity`:return e.includes(`ui`)?v:L;case`authentication`:return s;case`seed`:return T;case`theme`:return D;case`ui`:return k;case`root`:return e.includes(`ui`)?y:[];case`appearance`:return e.includes(`ui`)?_:[];case`sample`:return e.includes(`ui`)?b:C;case`shape`:return e[1]===`sample`?w:[];case`on`:case`success`:case`failure`:case`confirm`:return h;case`layout`:return f;case`navigation`:return m;case`toolbar`:return O;case`system`:return U.filter(e=>e.label===`description`);case`operation`:return U;case`execute`:case`compensate`:return W;case`produces`:return e.includes(`command`)?[...J,$]:J;case`handler`:return I;case`implementation`:return e[1]===`handler`?R:[`execute`,`compensate`].includes(e[1])?H:[];case`reads`:return[{label:`by parts`,insertText:"by\n ${1:part} = ${2:source}\n ${3:part} = ${4:source}",documentation:`Supply every composite read-model key part by name.`}];case`query`:return oe;case`performer`:return K;case`constraint`:return P;case`reaction`:return se;case`invokes`:return e.includes(`reaction`)?V:[];case`trigger`:return ge;case`when`:case`every`:case`at`:return e.includes(`reaction`)?ce:[];case`specification`:return fe;case`policy`:return q;case`validate`:return e.includes(`concept`)&&/:\s*String\b/.test(t.headers.find(e=>/^concept\s/.test(e))??``)?[...X,{label:`checksum`,insertText:"checksum ${1|luhn,mod11,mod97|}",documentation:`Exact trailing check digits over preceding ASCII digits. String concepts only; also validates inputs and stored values.`}]:X;case`action`:return j;case`table`:case`summary`:return me;case`screen`:return isTemplate(i)?E:Y;case`dialog`:return E;default:return isTemplate(t.headers.find(e=>isTemplate(e)))?E:e.includes(`screen`)||n===`section`?Y:e.includes(`produces`)?e.includes(`command`)?[...J,$]:J:[]}}function planCompletions(o,s,c,l=Z(o)){let u=n(o);if(u[s]||a(c).length<c.length)return{kind:`none`};if(/^\s*concept\s+[\p{L}\p{Mn}\p{Nd}\p{Pc}]+\s*:\s*\w+\s+(?:(?:pii|personal|secret)\s+)*\w*$/u.test(c))return{kind:`entries`,entries:[`pii`,`secret`].filter(e=>!RegExp(`\\b${e}\\b`).test(c)).map(e=>({label:e,insertText:e,documentation:e===`pii`?`personal data (GDPR Art. 4(1)); renders Chronicle [PII]`:`Operational secret; renders [Encrypted] + [NotAudited].`}))};let d=e(o,u,s,r(c)),f=d[0]===`concept`;if(d[0]===`generate`&&d[1]===`concept`&&/^generate\s+rule\s+/.test((i(o,u,s,r(c))??``).trim()))return{kind:`entries`,entries:[{label:`file`,insertText:"file ${1:Generator.cs}",documentation:`The sole ValueGeneration source. Receives the provider-bound GenerationContext (Now, Tenant); returns String.`},{label:`csharp`,insertText:"```csharp\n${1:return value;}\n```",documentation:`The sole ValueGeneration body. Reference execution requires fixtures; it never invokes this code.`}]};let p=f||d[0]===`validate`&&d[1]===`concept`?xe(o,s,c):null;if(p!==null)return{kind:`entries`,entries:p};if(f&&/^\s*(?:secret|sensitive|@sensitive)\s+scope\s+\w*$/.test(c))return{kind:`entries`,entries:[`subject`,`namespace`,`global`].map(e=>({label:e,insertText:e,documentation:`Explicit secret encryption scope.`}))};if(f&&/^\s*(?:pii|personal|@pii)\s+special\s+\w*$/.test(c))return{kind:`entries`,entries:[`racialOrEthnicOrigin`,`politicalOpinions`,`religiousOrPhilosophicalBeliefs`,`tradeUnionMembership`,`genetic`,`biometric`,`health`,`sexLifeOrSexualOrientation`].map(e=>({label:e,insertText:e,documentation:`GDPR Art. 9(1) special category.`}))};let m=Se(o,s,c,l);if(m!==null)return{kind:`entries`,entries:m};let h=ye(o,s,c)??ve(o,s,c,Z(o));if(h!==null)return{kind:`entries`,entries:h};let g=De(o,s,c,l);if(g!==null)return{kind:`entries`,entries:g};let _=Ee(o,s,c,l);if(_!==null)return{kind:`entries`,entries:_};let v=Ce(o,s,c,l);if(v!==null)return{kind:`entries`,entries:v};let y=c.match(/^\s*import\s+"([^"]*)$/);if(y)return{kind:`playFiles`,replaceLength:y[1].length};if(/["/]$/.test(c))return{kind:`none`};let b=be(o,s,r(o[s]??c));if(/\$refusal\.\w*$/.test(c))return{kind:`entries`,entries:b===void 0?[]:[`reason`,`message`,.../^on\s+refused\s+by\s+constraint(?:\s|$)/.test(b)?[`constraint`]:[]].map(e=>({label:e,insertText:e,documentation:`String refusal value in branch event mappings; executable from ESM v19. Constraint is available only in a by constraint branch.`}))};let x=c.match(/\$[\w.]*$/);if(x)return{kind:`contextVariables`,replaceLength:x[0].length};let S=o[s]??``,C=c.trim().length===0?c.length:r(S),w=e(o,u,s,C);if(w.includes(`screen`)){let e=/^\s*(?:action\s+(?:"(?:[^"\\]|\\.)*"|\$strings\.[\w.]+|[\w.]+)|item\s+\w+\s+action\s+[\w.]+)\s+/;if(e.test(c)){let t=c.replace(e,``);if(/^for\s+\w*$/.test(t))return{kind:`entries`,entries:te};if(/^(?:f|fo|for)?$/.test(t))return{kind:`entries`,entries:ee}}let t=C,n=!1;for(let e=s-1;e>=0;e--){if(u[e])continue;let i=a(o[e]);if(!(i.trim().length===0||r(i)>=t)){if(t=r(i),/^\s*action\s+(?:"|\$strings\.)/.test(i)){n=!0;break}if(/^\s*screen\b/.test(i))break}}if(n){if(/^\s*(?:when\b.*|otherwise)\s+execute\s+[\w.]*$/.test(c))return{kind:`commands`};if(w[0]===`action`)return{kind:`entries`,entries:re};if([`when`,`otherwise`].includes(w[0])){let e=i(o,u,s,C)??``;return{kind:`entries`,entries:/\bexecute\s+[\w.]+$/.test(e)?A:[]}}}}if([`on`,`when`,`otherwise`].includes(w[0])){let e=C;for(let t=s-1;t>=0;t--){if(u[t])continue;let n=a(o[t]);if(!(n.trim().length===0||r(n)>=e)){if(e=r(n),/^\s*on\s+(?:click|double click|select)\s*$/.test(n))return{kind:`entries`,entries:w[0]===`on`?ie:B};if(/^\s*(?:screen|behavior|specification|reaction)\b/.test(n))break}}}if(w[0]===`on`&&b!==void 0)return{kind:`entries`,entries:le};let T=Q(o,s,C);if(T===`implementation`)return{kind:`entries`,entries:ae};if(T===`rule`)return{kind:`entries`,entries:ne};let E=[`public`,`event`,`command`,`type`,`readmodel`,`trigger`,`when`,`every`,`at`].includes(w[0])||w[0]===`produces`&&/^produces\s+event\b/.test(i(o,u,s,C)??``),D=c.trimStart().split(/\s+/)[0],O=w[0]===`command`&&[`reads`,`authorize`,`produces`].includes(D)||w[0]===`event`&&D===`tag`||[`trigger`,`when`,`every`,`at`].includes(w[0])&&[`description`,`file`,`reads`,`produces`,`invokes`].includes(D),optionalPrefix=e=>e!==null&&`optional`.startsWith(e[1]),k=E&&!O&&optionalPrefix(c.match(/^\s*@?[a-z_]\w*\s+[\w.]+(?:\[\])?\s+(\w*)$/)),j=w[0]===`query`&&optionalPrefix(c.match(/^\s*(?:by|filter)\s+[a-z_]\w*\s+[\w.]+(?:\[\])?\s+(\w*)$/))||optionalPrefix(c.match(/^\s*query\s+[A-Za-z_]\w*\s*=>\s*(?:observable\s+)?[\w.]+(?:\[\])?\s+(\w*)$/)),M=(w[0]===`event`||w[0]===`produces`&&/^produces\s+event\b/.test(i(o,u,s,C)??``))&&!O?c.match(/^\s*@?[a-z_]\w*\s+([\w.]+)\s+(\w*)$/):null,N=l.concepts.find(e=>e.name===M?.[1]),P=N?.primitive??M?.[1],F=(P===`String`||P===`Uuid`||P===`Int`&&N!==void 0)&&!N?.attributes.some(e=>[`pii`,`personal`,`secret`,`sensitive`].includes(e.replace(/^@/,``))),I=M!==null&&F&&`subject`.startsWith(M[2]),L=w[0]===`readmodel`?c.match(/^\s*@?[a-z_]\w*\s+[\w.]+\s+(\w*)$/):null,R=[...L&&`key`.startsWith(L[1])?[{label:`key`,insertText:`key`,documentation:`Declares a required scalar read-model key part. Explicit keys replace inference. Supply every part by name when looking up one instance.`}]:[],...(k||j)&&!/=>\s*observable\s+$/.test(c)?G:[],...I?[{label:`subject`,insertText:`subject`,documentation:`One required scalar event data-subject identity; not pii or secret. Report-only lineage metadata (PLAY0270), no ESM or provider output yet.`}]:[]];if(R.length>0)return{kind:`entries`,entries:R};if(/\bauthorize\s+[\w\s]*$/.test(c)||w[0]===`authorize`)return{kind:`policies`};if(/\bwhen\s+\w*$/.test(c)&&w.includes(`reaction`))return{kind:`triggers`};if(/\bon\s+\w*$/.test(c)&&w.includes(`constraint`))return{kind:`events`};if(/\binvokes\s+\w*$/.test(c)&&w.includes(`reaction`))return{kind:`commands`};if(/\b(?:on|unique\s+event)\s+\w*$/.test(c)&&w[0]===`constraint`)return{kind:`events`};if(/\bproduces\s+\w*$/.test(c))return{kind:`producesTargets`};if(/\bnavigate\s+to\s+\w*$/.test(c))return{kind:`screens`};if(w[0]===`specification`){if(/^\s*when\s+query\s+[\w.]*$/.test(c))return{kind:`queries`};let e=c.match(/^\s*(given|when|then)\s+\w*$/);if(e)return{kind:`entries`,entries:pe[e[1]]}}if(/\b(?:via|then)\s+query\s+[\w.]*$/.test(c))return{kind:`queries`};if((w[0]===`event`||w[0]===`command`||w[0]===`type`)&&/^\s+[a-z_]\w*\s+[\w[\]?]*$/.test(c)||w[0]===`query`&&/^\s+(?:by|filter)\s+[a-z_]\w*\s+[\w[\]?]*$/.test(c))return{kind:`types`};let V=i(o,u,s,C);if(V&&/^produces\s+operation\b/.test(V))return{kind:`entries`,entries:U};if(V&&/^produces\s+event\b/.test(V))return/^\s+@?[a-z_]\w*\s+[\w[\]?]*$/.test(c)?{kind:`types`}:{kind:`entries`,entries:w.includes(`command`)?[...z,$]:z};if(V&&Oe.test(V))return{kind:`entries`,entries:ue};let H=t(o,u,s,C);if(w[0]===`for`&&w.includes(`seed`))return{kind:`events`};let W=completionEntriesFor(w,{headers:H,document:o}),K=w[0]===`command`?we(o,s,` `.repeat(C),``,l):null;return{kind:`entries`,entries:K?[expansionEntry(K.text,C),...W]:W}}export{completionEntriesFor,planCompletions};
|
|
4
|
+
`)[0].trim(),insertText:n.replace(/[$}\\]/g,`\\$&`),documentation:`Expands the whole block from what the command and its events declare.`}}function completionEntriesFor(e,t={headers:[],document:[]}){let n=e[0];if(n===void 0||n===`domain`)return topLevelEntries(t.document);let r=Te(n);if(r)return r.completions??[];let i=t.headers[0];switch(n){case`purpose`:return o;case`module`:return p;case`feature`:return u;case`slice`:return de(i?.split(/\s+/)[1]);case`concept`:return/:\s*Enum\b/.test(i??``)?[...N.filter(e=>e.label!==`validate checksum`),{label:`enum member (numbered)`,insertText:"${1:value} = ${2:0}",documentation:`Every member must declare a unique int32 number. Keep published numbers unchanged; specifications name members, not numbers.`}]:N.filter(e=>e.label!==`validate checksum`||/:\s*String\b/.test(i??``));case`type`:return _e;case`command`:return M;case`public`:case`event`:return F;case`readmodel`:return x;case`reducer`:return S;case`form`:return d;case`contribute`:return l;case`behavior`:return c;case`persona`:return g;case`identity`:return e.includes(`ui`)?v:L;case`authentication`:return s;case`seed`:return T;case`theme`:return D;case`ui`:return k;case`root`:return e.includes(`ui`)?y:[];case`appearance`:return e.includes(`ui`)?_:[];case`sample`:return e.includes(`ui`)?b:C;case`shape`:return e[1]===`sample`?w:[];case`on`:case`success`:case`failure`:case`confirm`:return h;case`layout`:return f;case`navigation`:return m;case`toolbar`:return O;case`system`:return U.filter(e=>e.label===`description`);case`operation`:return U;case`execute`:case`compensate`:return W;case`produces`:return e.includes(`command`)?[...J,$]:J;case`handler`:return I;case`implementation`:return e[1]===`handler`?R:[`execute`,`compensate`].includes(e[1])?H:[];case`reads`:return[{label:`by parts`,insertText:"by\n ${1:part} = ${2:source}\n ${3:part} = ${4:source}",documentation:`Supply every composite read-model key part by name.`}];case`query`:return oe;case`performer`:return K;case`constraint`:return P;case`reaction`:return se;case`invokes`:return e.includes(`reaction`)?V:[];case`trigger`:return ge;case`when`:case`every`:case`at`:return e.includes(`reaction`)?ce:[];case`specification`:return fe;case`policy`:return q;case`validate`:return e.includes(`concept`)&&/:\s*String\b/.test(t.headers.find(e=>/^concept\s/.test(e))??``)?[...X,{label:`checksum`,insertText:"checksum ${1|luhn,mod11,mod97|}",documentation:`Exact trailing check digits over preceding ASCII digits. String concepts only; also validates inputs and stored values.`}]:X;case`action`:return j;case`table`:case`summary`:return me;case`screen`:return isTemplate(i)?E:Y;case`dialog`:return E;default:return isTemplate(t.headers.find(e=>isTemplate(e)))?E:e.includes(`screen`)||n===`section`?Y:e.includes(`produces`)?e.includes(`command`)?[...J,$]:J:[]}}function planCompletions(o,s,c,l=Z(o)){let u=n(o);if(u[s]||a(c).length<c.length)return{kind:`none`};if(/^\s*concept\s+[\p{L}\p{Mn}\p{Nd}\p{Pc}]+\s*:\s*\w+\s+(?:(?:pii|personal|secret)\s+)*\w*$/u.test(c))return{kind:`entries`,entries:[`pii`,`secret`].filter(e=>!RegExp(`\\b${e}\\b`).test(c)).map(e=>({label:e,insertText:e,documentation:e===`pii`?`personal data (GDPR Art. 4(1)); renders Chronicle [PII]`:`Operational secret; renders [Encrypted] + [NotAudited].`}))};let d=e(o,u,s,r(c)),f=d[0]===`concept`;if(d[0]===`generate`&&d[1]===`concept`&&/^generate\s+rule\s+/.test((i(o,u,s,r(c))??``).trim()))return{kind:`entries`,entries:[{label:`file`,insertText:"file ${1:Generator.cs}",documentation:`The sole ValueGeneration source. Receives the provider-bound GenerationContext (Now, Tenant); returns String.`},{label:`csharp`,insertText:"```csharp\n${1:return value;}\n```",documentation:`The sole ValueGeneration body. Reference execution requires fixtures; it never invokes this code.`}]};let p=f||d[0]===`validate`&&d[1]===`concept`?xe(o,s,c):null;if(p!==null)return{kind:`entries`,entries:p};if(f&&/^\s*(?:secret|sensitive|@sensitive)\s+scope\s+\w*$/.test(c))return{kind:`entries`,entries:[`subject`,`namespace`,`global`].map(e=>({label:e,insertText:e,documentation:`Explicit secret encryption scope.`}))};if(f&&/^\s*(?:pii|personal|@pii)\s+special\s+\w*$/.test(c))return{kind:`entries`,entries:[`racialOrEthnicOrigin`,`politicalOpinions`,`religiousOrPhilosophicalBeliefs`,`tradeUnionMembership`,`genetic`,`biometric`,`health`,`sexLifeOrSexualOrientation`].map(e=>({label:e,insertText:e,documentation:`GDPR Art. 9(1) special category.`}))};let m=Se(o,s,c,l);if(m!==null)return{kind:`entries`,entries:m};let h=ye(o,s,c)??ve(o,s,c,Z(o));if(h!==null)return{kind:`entries`,entries:h};let g=De(o,s,c,l);if(g!==null)return{kind:`entries`,entries:g};let _=Ee(o,s,c,l);if(_!==null)return{kind:`entries`,entries:_};let v=Ce(o,s,c,l);if(v!==null)return{kind:`entries`,entries:v};let y=c.match(/^\s*import\s+"([^"]*)$/);if(y)return{kind:`playFiles`,replaceLength:y[1].length};if(/["/]$/.test(c))return{kind:`none`};let b=be(o,s,r(o[s]??c));if(/\$refusal\.\w*$/.test(c))return{kind:`entries`,entries:b===void 0?[]:[`reason`,`message`,.../^on\s+refused\s+by\s+constraint(?:\s|$)/.test(b)?[`constraint`]:[]].map(e=>({label:e,insertText:e,documentation:`String refusal value in branch event mappings; executable from ESM v19. Constraint is available only in a by constraint branch.`}))};let x=c.match(/\$[\w.]*$/);if(x)return{kind:`contextVariables`,replaceLength:x[0].length};let S=o[s]??``,C=c.trim().length===0?c.length:r(S),w=e(o,u,s,C);if(w.includes(`screen`)){let e=/^\s*(?:action\s+(?:"(?:[^"\\]|\\.)*"|\$strings\.[\w.]+|[\w.]+)|item\s+\w+\s+action\s+[\w.]+)\s+/;if(e.test(c)){let t=c.replace(e,``);if(/^for\s+\w*$/.test(t))return{kind:`entries`,entries:te};if(/^(?:f|fo|for)?$/.test(t))return{kind:`entries`,entries:ee}}let t=C,n=!1;for(let e=s-1;e>=0;e--){if(u[e])continue;let i=a(o[e]);if(!(i.trim().length===0||r(i)>=t)){if(t=r(i),/^\s*action\s+(?:"|\$strings\.)/.test(i)){n=!0;break}if(/^\s*screen\b/.test(i))break}}if(n){if(/^\s*(?:when\b.*|otherwise)\s+execute\s+[\w.]*$/.test(c))return{kind:`commands`};if(w[0]===`action`)return{kind:`entries`,entries:re};if([`when`,`otherwise`].includes(w[0])){let e=i(o,u,s,C)??``;return{kind:`entries`,entries:/\bexecute\s+[\w.]+$/.test(e)?A:[]}}}}if([`on`,`when`,`otherwise`].includes(w[0])){let e=C;for(let t=s-1;t>=0;t--){if(u[t])continue;let n=a(o[t]);if(!(n.trim().length===0||r(n)>=e)){if(e=r(n),/^\s*on\s+(?:click|double click|select|change)\s*$/.test(n))return{kind:`entries`,entries:w[0]===`on`?ie:B};if(/^\s*(?:screen|behavior|specification|reaction)\b/.test(n))break}}}if(w[0]===`on`&&b!==void 0)return{kind:`entries`,entries:le};let T=Q(o,s,C);if(T===`implementation`)return{kind:`entries`,entries:ae};if(T===`rule`)return{kind:`entries`,entries:ne};let E=[`public`,`event`,`command`,`type`,`readmodel`,`trigger`,`when`,`every`,`at`].includes(w[0])||w[0]===`produces`&&/^produces\s+event\b/.test(i(o,u,s,C)??``),D=c.trimStart().split(/\s+/)[0],O=w[0]===`command`&&[`reads`,`authorize`,`produces`].includes(D)||w[0]===`event`&&D===`tag`||[`trigger`,`when`,`every`,`at`].includes(w[0])&&[`description`,`file`,`reads`,`produces`,`invokes`].includes(D),optionalPrefix=e=>e!==null&&`optional`.startsWith(e[1]),k=E&&!O&&optionalPrefix(c.match(/^\s*@?[a-z_]\w*\s+[\w.]+(?:\[\])?\s+(\w*)$/)),j=w[0]===`query`&&optionalPrefix(c.match(/^\s*(?:by|filter)\s+[a-z_]\w*\s+[\w.]+(?:\[\])?\s+(\w*)$/))||optionalPrefix(c.match(/^\s*query\s+[A-Za-z_]\w*\s*=>\s*(?:observable\s+)?[\w.]+(?:\[\])?\s+(\w*)$/)),M=(w[0]===`event`||w[0]===`produces`&&/^produces\s+event\b/.test(i(o,u,s,C)??``))&&!O?c.match(/^\s*@?[a-z_]\w*\s+([\w.]+)\s+(\w*)$/):null,N=l.concepts.find(e=>e.name===M?.[1]),P=N?.primitive??M?.[1],F=(P===`String`||P===`Uuid`||P===`Int`&&N!==void 0)&&!N?.attributes.some(e=>[`pii`,`personal`,`secret`,`sensitive`].includes(e.replace(/^@/,``))),I=M!==null&&F&&`subject`.startsWith(M[2]),L=w[0]===`readmodel`?c.match(/^\s*@?[a-z_]\w*\s+[\w.]+\s+(\w*)$/):null,R=[...L&&`key`.startsWith(L[1])?[{label:`key`,insertText:`key`,documentation:`Declares a required scalar read-model key part. Explicit keys replace inference. Supply every part by name when looking up one instance.`}]:[],...(k||j)&&!/=>\s*observable\s+$/.test(c)?G:[],...I?[{label:`subject`,insertText:`subject`,documentation:`One required scalar event data-subject identity; not pii or secret. Report-only lineage metadata (PLAY0270), no ESM or provider output yet.`}]:[]];if(R.length>0)return{kind:`entries`,entries:R};if(/\bauthorize\s+[\w\s]*$/.test(c)||w[0]===`authorize`)return{kind:`policies`};if(/\bwhen\s+\w*$/.test(c)&&w.includes(`reaction`))return{kind:`triggers`};if(/\bon\s+\w*$/.test(c)&&w.includes(`constraint`))return{kind:`events`};if(/\binvokes\s+\w*$/.test(c)&&w.includes(`reaction`))return{kind:`commands`};if(/\b(?:on|unique\s+event)\s+\w*$/.test(c)&&w[0]===`constraint`)return{kind:`events`};if(/\bproduces\s+\w*$/.test(c))return{kind:`producesTargets`};if(/\bnavigate\s+to\s+\w*$/.test(c))return{kind:`screens`};if(w[0]===`specification`){if(/^\s*when\s+query\s+[\w.]*$/.test(c))return{kind:`queries`};let e=c.match(/^\s*(given|when|then)\s+\w*$/);if(e)return{kind:`entries`,entries:pe[e[1]]}}if(/\b(?:via|then)\s+query\s+[\w.]*$/.test(c))return{kind:`queries`};if((w[0]===`event`||w[0]===`command`||w[0]===`type`)&&/^\s+[a-z_]\w*\s+[\w[\]?]*$/.test(c)||w[0]===`query`&&/^\s+(?:by|filter)\s+[a-z_]\w*\s+[\w[\]?]*$/.test(c))return{kind:`types`};let V=i(o,u,s,C);if(V&&/^produces\s+operation\b/.test(V))return{kind:`entries`,entries:U};if(V&&/^produces\s+event\b/.test(V))return/^\s+@?[a-z_]\w*\s+[\w[\]?]*$/.test(c)?{kind:`types`}:{kind:`entries`,entries:w.includes(`command`)?[...z,$]:z};if(V&&Oe.test(V))return{kind:`entries`,entries:ue};let H=t(o,u,s,C);if(w[0]===`for`&&w.includes(`seed`))return{kind:`events`};let W=completionEntriesFor(w,{headers:H,document:o}),K=w[0]===`command`?we(o,s,` `.repeat(C),``,l):null;return{kind:`entries`,entries:K?[expansionEntry(K.text,C),...W]:W}}export{completionEntriesFor,planCompletions};
|
|
5
5
|
//# sourceMappingURL=completion-planner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion-planner.js","names":["items.moduleItems","items.featureItems","items.sliceItemsFor","items.typeItems","items.commandItems","items.eventItems","scope.readModelItems","scope.reducerItems","scope.formItems","scope.contributeItems","scope.behaviorItems","scope.personaItems","scope.profileIdentityItems","items.identityItems","scope.authenticationItems","scope.seedItems","scope.themeItems","scope.uiProfileItems","scope.profileRootTemplateItems","scope.profileAppearanceItems","scope.profileSampleDataItems","scope.sampleDataItems","scope.sampleShapeItems","scope.outcomeItems","scope.layoutItems","scope.navigationItems","scope.toolbarItems","items.operationItems","items.operationPhaseItems","items.producesItems","items.handlerItems","items.implementationItems","items.operationImplementationItems","items.queryItems","items.performerItems","items.constraintItems","items.reactionItems","items.invocationItems","items.triggerItems","items.reactionTriggerItems","items.specificationItems","items.policyItems","items.validateItems","items.actionItems","items.tableItems","scope.templateItems","items.screenItems","items.actionSubjectValueItems","items.actionSubjectItems","items.guardedActionItems","items.actionArgumentItems","items.interactionChoiceItems","items.interactionActionItems","items.refusalItems","items.namedRuleImplementationItems","items.commandRuleItems","items.optionalTypeItems","items.specificationStepItems","items.inlineEventItems","items.ruleItems","productionRouteItem","RULE_LINE_PATTERN","document","keyword","line","topLevelItems","item","header","relative","text","index","indent","indentOf","construct","chain","where","subLanguage","getSubLanguage","purposeItems","moduleScopeItems","featureScopeItems","sliceItemsFor","conceptItems","typeItems","commandItems","eventItems","readModelItems","reducerItems","formItems","contributeItems","behaviorItems","personaItems","profileIdentityItems","identityItems","authenticationItems","seedItems","themeItems","uiProfileItems","profileRootTemplateItems","profileAppearanceItems","profileSampleDataItems","sampleDataItems","sampleShapeItems","outcomeItems","layoutItems","navigationItems","toolbarItems","operationItems","operationPhaseItems","producesItems","handlerItems","implementationItems","operationImplementationItems","queryItems","performerItems","constraintItems","reactionItems","invocationItems","triggerItems","reactionTriggerItems","specificationItems","policyItems","validateItems","actionItems","tableItems","templateItems","screenItems","candidate","scanDocument","lines","fences","fenceMap","lineIndex","withoutComment","textBefore","marker","generationChain","enclosingChain","inConcept","nearestEnclosingLine","generationEntries","generationCompletions","scope","category","continuationEntries","continuationResponseCompletions","symbols","responseEntries","exampleCompletions","responseCompletions","readEntries","commandReadCompletions","keyEntries","readModelKeyCompletions","dependencyEntries","dependencyTargetCompletions","importPath","refusal","refusalContext","member","contextVariableMatch","currentLine","effectiveIndent","subjectHeader","suffix","actionSubjectValueItems","actionSubjectItems","parentIndent","guarded","parent","guardedActionItems","actionArgumentItems","interactionChoiceItems","interactionActionItems","refusalItems","ruleContext","namedRuleContext","namedRuleImplementationItems","commandRuleItems","propertyOwner","propertyName","reservedProperty","match","afterPropertyType","afterQueryType","subjectModifier","subjectConcept","concept","subjectType","subjectTarget","attribute","afterSubjectType","keyModifier","modifierEntries","optionalTypeItems","step","specificationStepItems","enclosingLine","inlineEventItems","ruleItems","headers","enclosingHeaders","entries","expansion","structureCompletion"],"sources":["../../completion-planner.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { enclosingChain, enclosingHeaders, fenceMap, indentOf, nearestEnclosingLine, withoutComment } from './document-context';\nimport { refusalContext } from './refusal-context';\nimport { generationCompletions } from './generation-completions';\nimport { namedRuleContext } from './named-rule-context';\nimport { continuationResponseCompletions } from './continuation-responses';\nimport { responseCompletions } from './response-completions';\nimport { dependencyTargetCompletions } from './dependency-completions';\nimport { exampleCompletions } from './example-authoring';\nimport { DocumentSymbols, scanDocument } from './symbols';\nimport { structureCompletion } from './structure-completions';\nimport { getSubLanguage } from './sub-language-registry';\nimport * as items from './completion-items';\nimport * as scope from './scope-items';\nimport { CompletionEntry } from './completion-items';\nimport { purposeItems } from './purpose-items';\nimport { readModelKeyCompletions } from './read-model-key-completions';\nimport { commandReadCompletions } from './command-read-completions';\n\n// Matches a validation rule line ending in \"rule <Name>\" (optionally followed by a\n// message clause) - both the command form (\"<property> rule <Name>\") and the\n// concept implied-subject form (\"rule <Name>\"). Its first word is the property\n// name, not \"rule\", so it can't be recognized through the chain[0] keyword switch\n// the way \"on <EventType>\" or \"handler\" are - hence the dedicated regex check.\nconst productionRouteItem = { label: 'stream', insertText: 'stream ${1:Source.Stream}', documentation: 'Replace the whole command route for this event production. ESM v10.' };\n\nconst RULE_LINE_PATTERN = /(?:^|\\s)rule\\s+[A-Za-z_]\\w*(?:\\s+severity\\s+(?:information|warning|error))?(?:\\s+message\\s+.*)?$/;\n\nexport type CompletionPlan =\n | { kind: 'none' }\n | { kind: 'entries'; entries: CompletionEntry[] }\n | { kind: 'contextVariables'; replaceLength: number }\n | { kind: 'playFiles'; replaceLength: number }\n | { kind: 'policies' }\n | { kind: 'events' }\n | { kind: 'triggers' }\n | { kind: 'commands' }\n | { kind: 'producesTargets' }\n | { kind: 'screens' }\n | { kind: 'queries' }\n | { kind: 'types' };\n\n// What the position sits inside, beyond the keyword chain: the whole header of each enclosing block, so a\n// slice's type and a template's kind are known, and the document's own lines, so a declaration that may\n// appear once is not offered again.\nexport interface CompletionScope {\n headers: readonly string[];\n document: readonly string[];\n}\n\nconst declaredIn = (document: readonly string[], keyword: string) => document.some(line => new RegExp(`^${keyword}\\\\b`).test(line));\n\nfunction topLevelEntries(document: readonly string[]): CompletionEntry[] {\n return items.topLevelItems.filter(item => !(item.label === 'domain' && declaredIn(document, 'domain')) && !(item.label === 'authentication' && declaredIn(document, 'authentication')) && !(item.label === 'identity' && declaredIn(document, 'identity')));\n}\n\nconst isTemplate = (header: string | undefined) => /^(?:screen|dialog)\\s+template\\b/.test(header ?? '');\n\n// A whole block as one completion entry. Continuation lines are indented relative to the line it is inserted on,\n// which is how the editors indent a multi-line snippet.\nfunction expansionEntry(text: string, indent: number): CompletionEntry {\n const relative = text.split('\\n').map((line, index) => (index === 0 ? line : line.slice(Math.min(indent, indentOf(line))))).join('\\n');\n const label = text.split('\\n')[0].trim();\n return { label, insertText: relative.replace(/[$}\\\\]/g, '\\\\$&'), documentation: 'Expands the whole block from what the command and its events declare.' };\n}\n\nexport function completionEntriesFor(chain: string[], where: CompletionScope = { headers: [], document: [] }): CompletionEntry[] {\n const construct = chain[0];\n if (construct === undefined || construct === 'domain') return topLevelEntries(where.document);\n const subLanguage = getSubLanguage(construct);\n if (subLanguage) return subLanguage.completions ?? [];\n const header = where.headers[0];\n switch (construct) {\n case 'purpose':\n return purposeItems;\n case 'module':\n return items.moduleItems;\n case 'feature':\n return items.featureItems;\n case 'slice':\n return items.sliceItemsFor(header?.split(/\\s+/)[1]);\n case 'concept':\n return /:\\s*Enum\\b/.test(header ?? '') ? [...items.conceptItems.filter(item => item.label !== 'validate checksum'), { label: 'enum member (numbered)', insertText: '${1:value} = ${2:0}', documentation: 'Every member must declare a unique int32 number. Keep published numbers unchanged; specifications name members, not numbers.' }] : items.conceptItems.filter(item => item.label !== 'validate checksum' || /:\\s*String\\b/.test(header ?? ''));\n case 'type':\n return items.typeItems;\n case 'command':\n return items.commandItems;\n case 'public':\n case 'event':\n return items.eventItems;\n case 'readmodel':\n return scope.readModelItems;\n case 'reducer':\n return scope.reducerItems;\n case 'form':\n return scope.formItems;\n case 'contribute':\n return scope.contributeItems;\n case 'behavior':\n return scope.behaviorItems;\n case 'persona':\n return scope.personaItems;\n case 'identity':\n return chain.includes('ui') ? scope.profileIdentityItems : items.identityItems;\n case 'authentication':\n return scope.authenticationItems;\n case 'seed':\n return scope.seedItems;\n case 'theme':\n return scope.themeItems;\n case 'ui':\n return scope.uiProfileItems;\n case 'root':\n return chain.includes('ui') ? scope.profileRootTemplateItems : [];\n case 'appearance':\n return chain.includes('ui') ? scope.profileAppearanceItems : [];\n case 'sample':\n return chain.includes('ui') ? scope.profileSampleDataItems : scope.sampleDataItems;\n case 'shape':\n return chain[1] === 'sample' ? scope.sampleShapeItems : [];\n case 'on':\n case 'success':\n case 'failure':\n case 'confirm':\n return scope.outcomeItems;\n case 'layout':\n return scope.layoutItems;\n case 'navigation':\n return scope.navigationItems;\n case 'toolbar':\n return scope.toolbarItems;\n case 'system':\n return items.operationItems.filter(item => item.label === 'description');\n case 'operation':\n return items.operationItems;\n case 'execute':\n case 'compensate':\n return items.operationPhaseItems;\n case 'produces':\n return chain.includes('command') ? [...items.producesItems, productionRouteItem] : items.producesItems;\n case 'handler':\n return items.handlerItems;\n case 'implementation':\n return chain[1] === 'handler' ? items.implementationItems : ['execute', 'compensate'].includes(chain[1]) ? items.operationImplementationItems : [];\n case 'reads':\n return [{ label: 'by parts', insertText: 'by\\n ${1:part} = ${2:source}\\n ${3:part} = ${4:source}', documentation: 'Supply every composite read-model key part by name.' }];\n case 'query':\n return items.queryItems;\n case 'performer':\n return items.performerItems;\n case 'constraint':\n return items.constraintItems;\n case 'reaction':\n return items.reactionItems;\n case 'invokes':\n return chain.includes('reaction') ? items.invocationItems : [];\n case 'trigger':\n return items.triggerItems;\n case 'when':\n case 'every':\n case 'at':\n return chain.includes('reaction') ? items.reactionTriggerItems : [];\n case 'specification':\n return items.specificationItems;\n case 'policy':\n return items.policyItems;\n case 'validate':\n return chain.includes('concept') && /:\\s*String\\b/.test(where.headers.find(header => /^concept\\s/.test(header)) ?? '')\n ? [...items.validateItems, { label: 'checksum', insertText: 'checksum ${1|luhn,mod11,mod97|}', documentation: 'Exact trailing check digits over preceding ASCII digits. String concepts only; also validates inputs and stored values.' }]\n : items.validateItems;\n case 'action':\n return items.actionItems;\n case 'table':\n case 'summary':\n return items.tableItems;\n case 'screen':\n return isTemplate(header) ? scope.templateItems : items.screenItems;\n case 'dialog':\n return scope.templateItems;\n default:\n if (isTemplate(where.headers.find(candidate => isTemplate(candidate)))) return scope.templateItems;\n // Sections inside a screen expose the screen vocabulary.\n if (chain.includes('screen') || construct === 'section') return items.screenItems;\n if (chain.includes('produces')) return chain.includes('command') ? [...items.producesItems, productionRouteItem] : items.producesItems;\n return [];\n }\n}\n\n// Decides what to complete at a position, without any editor dependency — the\n// Monaco service and the VSCode extension both materialize the plan into items.\nexport function planCompletions(\n lines: string[],\n lineIndex: number,\n textBefore: string,\n symbols: DocumentSymbols = scanDocument(lines),\n): CompletionPlan {\n const fences = fenceMap(lines);\n if (fences[lineIndex] || withoutComment(textBefore).length < textBefore.length) return { kind: 'none' };\n if (/^\\s*concept\\s+[\\p{L}\\p{Mn}\\p{Nd}\\p{Pc}]+\\s*:\\s*\\w+\\s+(?:(?:pii|personal|secret)\\s+)*\\w*$/u.test(textBefore)) {\n return { kind: 'entries', entries: ['pii', 'secret'].filter(marker => !new RegExp(`\\\\b${marker}\\\\b`).test(textBefore)).map(marker => ({ label: marker, insertText: marker, documentation: marker === 'pii' ? 'personal data (GDPR Art. 4(1)); renders Chronicle [PII]' : 'Operational secret; renders [Encrypted] + [NotAudited].' })) };\n }\n const generationChain = enclosingChain(lines, fences, lineIndex, indentOf(textBefore));\n const inConcept = generationChain[0] === 'concept';\n if (generationChain[0] === 'generate' && generationChain[1] === 'concept' && /^generate\\s+rule\\s+/.test((nearestEnclosingLine(lines, fences, lineIndex, indentOf(textBefore)) ?? '').trim())) {\n return { kind: 'entries', entries: [\n { label: 'file', insertText: 'file ${1:Generator.cs}', documentation: 'The sole ValueGeneration source. Receives the provider-bound GenerationContext (Now, Tenant); returns String.' },\n { label: 'csharp', insertText: '```csharp\\n${1:return value;}\\n```', documentation: 'The sole ValueGeneration body. Reference execution requires fixtures; it never invokes this code.' },\n ] };\n }\n const generationEntries = inConcept || (generationChain[0] === 'validate' && generationChain[1] === 'concept') ? generationCompletions(lines, lineIndex, textBefore) : null;\n if (generationEntries !== null) return { kind: 'entries', entries: generationEntries };\n if (inConcept && /^\\s*(?:secret|sensitive|@sensitive)\\s+scope\\s+\\w*$/.test(textBefore)) {\n return { kind: 'entries', entries: ['subject', 'namespace', 'global'].map(scope => ({ label: scope, insertText: scope, documentation: 'Explicit secret encryption scope.' })) };\n }\n if (inConcept && /^\\s*(?:pii|personal|@pii)\\s+special\\s+\\w*$/.test(textBefore)) {\n return { kind: 'entries', entries: ['racialOrEthnicOrigin', 'politicalOpinions', 'religiousOrPhilosophicalBeliefs', 'tradeUnionMembership', 'genetic', 'biometric', 'health', 'sexLifeOrSexualOrientation'].map(category => ({ label: category, insertText: category, documentation: 'GDPR Art. 9(1) special category.' })) };\n }\n const continuationEntries = continuationResponseCompletions(lines, lineIndex, textBefore, symbols);\n if (continuationEntries !== null) return { kind: 'entries', entries: continuationEntries };\n const responseEntries = exampleCompletions(lines, lineIndex, textBefore) ?? responseCompletions(lines, lineIndex, textBefore, scanDocument(lines));\n if (responseEntries !== null) return { kind: 'entries', entries: responseEntries };\n const readEntries = commandReadCompletions(lines, lineIndex, textBefore, symbols);\n if (readEntries !== null) return { kind: 'entries', entries: readEntries };\n const keyEntries = readModelKeyCompletions(lines, lineIndex, textBefore, symbols);\n if (keyEntries !== null) return { kind: 'entries', entries: keyEntries };\n const dependencyEntries = dependencyTargetCompletions(lines, lineIndex, textBefore, symbols);\n if (dependencyEntries !== null) return { kind: 'entries', entries: dependencyEntries };\n\n // Inside the quotes of a file import, what is wanted is a path - replacing what has been typed so far.\n const importPath = textBefore.match(/^\\s*import\\s+\"([^\"]*)$/);\n if (importPath) {\n return { kind: 'playFiles', replaceLength: importPath[1].length };\n }\n\n // A quote or a slash only asks for a completion inside an import path.\n if (/[\"/]$/.test(textBefore)) return { kind: 'none' };\n\n const refusal = refusalContext(lines, lineIndex, indentOf(lines[lineIndex] ?? textBefore));\n if (/\\$refusal\\.\\w*$/.test(textBefore)) {\n return { kind: 'entries', entries: refusal === undefined ? [] : ['reason', 'message', ...(/^on\\s+refused\\s+by\\s+constraint(?:\\s|$)/.test(refusal) ? ['constraint'] : [])].map(member => ({ label: member, insertText: member, documentation: 'String refusal value in branch event mappings; executable from ESM v19. Constraint is available only in a by constraint branch.' })) };\n }\n const contextVariableMatch = textBefore.match(/\\$[\\w.]*$/);\n if (contextVariableMatch) {\n return { kind: 'contextVariables', replaceLength: contextVariableMatch[0].length };\n }\n\n const currentLine = lines[lineIndex] ?? '';\n const effectiveIndent =\n textBefore.trim().length === 0 ? textBefore.length : indentOf(currentLine);\n const chain = enclosingChain(lines, fences, lineIndex, effectiveIndent);\n if (chain.includes('screen')) {\n const subjectHeader = /^\\s*(?:action\\s+(?:\"(?:[^\"\\\\]|\\\\.)*\"|\\$strings\\.[\\w.]+|[\\w.]+)|item\\s+\\w+\\s+action\\s+[\\w.]+)\\s+/;\n if (subjectHeader.test(textBefore)) {\n const suffix = textBefore.replace(subjectHeader, '');\n if (/^for\\s+\\w*$/.test(suffix)) return { kind: 'entries', entries: items.actionSubjectValueItems };\n if (/^(?:f|fo|for)?$/.test(suffix)) return { kind: 'entries', entries: items.actionSubjectItems };\n }\n let parentIndent = effectiveIndent;\n let guarded = false;\n for (let index = lineIndex - 1; index >= 0; index--) {\n if (fences[index]) continue;\n const parent = withoutComment(lines[index]);\n if (parent.trim().length === 0 || indentOf(parent) >= parentIndent) continue;\n parentIndent = indentOf(parent);\n if (/^\\s*action\\s+(?:\"|\\$strings\\.)/.test(parent)) { guarded = true; break; }\n if (/^\\s*screen\\b/.test(parent)) break;\n }\n if (guarded) {\n if (/^\\s*(?:when\\b.*|otherwise)\\s+execute\\s+[\\w.]*$/.test(textBefore)) return { kind: 'commands' };\n if (chain[0] === 'action') return { kind: 'entries', entries: items.guardedActionItems };\n if (['when', 'otherwise'].includes(chain[0])) {\n const parent = nearestEnclosingLine(lines, fences, lineIndex, effectiveIndent) ?? '';\n return { kind: 'entries', entries: /\\bexecute\\s+[\\w.]+$/.test(parent) ? items.actionArgumentItems : [] };\n }\n }\n }\n if (['on', 'when', 'otherwise'].includes(chain[0])) {\n let parentIndent = effectiveIndent;\n for (let index = lineIndex - 1; index >= 0; index--) {\n if (fences[index]) continue;\n const parent = withoutComment(lines[index]);\n if (parent.trim().length === 0 || indentOf(parent) >= parentIndent) continue;\n parentIndent = indentOf(parent);\n if (/^\\s*on\\s+(?:click|double click|select)\\s*$/.test(parent)) {\n return { kind: 'entries', entries: chain[0] === 'on' ? items.interactionChoiceItems : items.interactionActionItems };\n }\n if (/^\\s*(?:screen|behavior|specification|reaction)\\b/.test(parent)) break;\n }\n }\n if (chain[0] === 'on' && refusal !== undefined) return { kind: 'entries', entries: items.refusalItems };\n const ruleContext = namedRuleContext(lines, lineIndex, effectiveIndent);\n if (ruleContext === 'implementation') return { kind: 'entries', entries: items.namedRuleImplementationItems };\n if (ruleContext === 'rule') return { kind: 'entries', entries: items.commandRuleItems };\n\n const propertyOwner = ['public', 'event', 'command', 'type', 'readmodel', 'trigger', 'when', 'every', 'at'].includes(chain[0]) ||\n (chain[0] === 'produces' && /^produces\\s+event\\b/.test(nearestEnclosingLine(lines, fences, lineIndex, effectiveIndent) ?? ''));\n const propertyName = textBefore.trimStart().split(/\\s+/)[0];\n const reservedProperty = (chain[0] === 'command' && ['reads', 'authorize', 'produces'].includes(propertyName)) ||\n (chain[0] === 'event' && propertyName === 'tag') ||\n (['trigger', 'when', 'every', 'at'].includes(chain[0]) && ['description', 'file', 'reads', 'produces', 'invokes'].includes(propertyName));\n const optionalPrefix = (match: RegExpMatchArray | null) => match !== null && 'optional'.startsWith(match[1]);\n const afterPropertyType = propertyOwner && !reservedProperty && optionalPrefix(textBefore.match(/^\\s*@?[a-z_]\\w*\\s+[\\w.]+(?:\\[\\])?\\s+(\\w*)$/));\n const afterQueryType = (chain[0] === 'query' && optionalPrefix(textBefore.match(/^\\s*(?:by|filter)\\s+[a-z_]\\w*\\s+[\\w.]+(?:\\[\\])?\\s+(\\w*)$/))) ||\n optionalPrefix(textBefore.match(/^\\s*query\\s+[A-Za-z_]\\w*\\s*=>\\s*(?:observable\\s+)?[\\w.]+(?:\\[\\])?\\s+(\\w*)$/));\n const eventPropertyOwner = chain[0] === 'event' || (chain[0] === 'produces' && /^produces\\s+event\\b/.test(nearestEnclosingLine(lines, fences, lineIndex, effectiveIndent) ?? ''));\n const subjectModifier = eventPropertyOwner && !reservedProperty ? textBefore.match(/^\\s*@?[a-z_]\\w*\\s+([\\w.]+)\\s+(\\w*)$/) : null;\n const subjectConcept = symbols.concepts.find(concept => concept.name === subjectModifier?.[1]);\n const subjectType = subjectConcept?.primitive ?? subjectModifier?.[1];\n const subjectTarget = (subjectType === 'String' || subjectType === 'Uuid' || (subjectType === 'Int' && subjectConcept !== undefined)) &&\n !subjectConcept?.attributes.some(attribute => ['pii', 'personal', 'secret', 'sensitive'].includes(attribute.replace(/^@/, '')));\n const afterSubjectType = subjectModifier !== null && subjectTarget && 'subject'.startsWith(subjectModifier[2]);\n const keyModifier = chain[0] === 'readmodel' ? textBefore.match(/^\\s*@?[a-z_]\\w*\\s+[\\w.]+\\s+(\\w*)$/) : null;\n const modifierEntries = [\n ...(keyModifier && 'key'.startsWith(keyModifier[1]) ? [{ label: 'key', insertText: 'key', documentation: 'Declares a required scalar read-model key part. Explicit keys replace inference. Supply every part by name when looking up one instance.' }] : []),\n ...((afterPropertyType || afterQueryType) && !/=>\\s*observable\\s+$/.test(textBefore) ? items.optionalTypeItems : []),\n ...(afterSubjectType ? [{ label: 'subject', insertText: 'subject', documentation: 'One required scalar event data-subject identity; not pii or secret. Report-only lineage metadata (PLAY0270), no ESM or provider output yet.' }] : []),\n ];\n if (modifierEntries.length > 0) return { kind: 'entries', entries: modifierEntries };\n\n if (/\\bauthorize\\s+[\\w\\s]*$/.test(textBefore) || chain[0] === 'authorize') {\n return { kind: 'policies' };\n }\n if (/\\bwhen\\s+\\w*$/.test(textBefore) && chain.includes('reaction')) {\n return { kind: 'triggers' };\n }\n if (/\\bon\\s+\\w*$/.test(textBefore) && chain.includes('constraint')) {\n return { kind: 'events' };\n }\n if (/\\binvokes\\s+\\w*$/.test(textBefore) && chain.includes('reaction')) {\n return { kind: 'commands' };\n }\n if (/\\b(?:on|unique\\s+event)\\s+\\w*$/.test(textBefore) && chain[0] === 'constraint') {\n return { kind: 'events' };\n }\n if (/\\bproduces\\s+\\w*$/.test(textBefore)) {\n return { kind: 'producesTargets' };\n }\n if (/\\bnavigate\\s+to\\s+\\w*$/.test(textBefore)) {\n return { kind: 'screens' };\n }\n if (chain[0] === 'specification') {\n if (/^\\s*when\\s+query\\s+[\\w.]*$/.test(textBefore)) return { kind: 'queries' };\n const step = textBefore.match(/^\\s*(given|when|then)\\s+\\w*$/);\n if (step) return { kind: 'entries', entries: items.specificationStepItems[step[1] as 'given' | 'when' | 'then'] };\n }\n if (/\\b(?:via|then)\\s+query\\s+[\\w.]*$/.test(textBefore)) {\n return { kind: 'queries' };\n }\n if (\n (chain[0] === 'event' || chain[0] === 'command' || chain[0] === 'type') &&\n /^\\s+[a-z_]\\w*\\s+[\\w[\\]?]*$/.test(textBefore)\n ) {\n return { kind: 'types' };\n }\n if (chain[0] === 'query' && /^\\s+(?:by|filter)\\s+[a-z_]\\w*\\s+[\\w[\\]?]*$/.test(textBefore)) {\n return { kind: 'types' };\n }\n\n const enclosingLine = nearestEnclosingLine(lines, fences, lineIndex, effectiveIndent);\n if (enclosingLine && /^produces\\s+operation\\b/.test(enclosingLine)) return { kind: 'entries', entries: items.operationItems };\n if (enclosingLine && /^produces\\s+event\\b/.test(enclosingLine)) {\n if (/^\\s+@?[a-z_]\\w*\\s+[\\w[\\]?]*$/.test(textBefore)) return { kind: 'types' };\n return { kind: 'entries', entries: chain.includes('command') ? [...items.inlineEventItems, productionRouteItem] : items.inlineEventItems };\n }\n if (enclosingLine && RULE_LINE_PATTERN.test(enclosingLine)) {\n return { kind: 'entries', entries: items.ruleItems };\n }\n\n const headers = enclosingHeaders(lines, fences, lineIndex, effectiveIndent);\n if (chain[0] === 'for' && chain.includes('seed')) return { kind: 'events' };\n const entries = completionEntriesFor(chain, { headers, document: lines });\n const expansion = chain[0] === 'command' ? structureCompletion(lines, lineIndex, ' '.repeat(effectiveIndent), '', symbols) : null;\n return { kind: 'entries', entries: expansion ? [expansionEntry(expansion.text, effectiveIndent), ...entries] : entries };\n}\n"],"mappings":"83EA0BA,MAAM4D,EAAsB,CAAE,MAAO,SAAU,WAAY,4BAA6B,cAAe,qEAAsE,EAEvKC,GAAoB,mGAwBpB,YAAc,EAA6B,IAAoBC,EAAS,KAAK,GAAY,OAAO,IAAIC,EAAQ,IAAI,CAAC,CAAC,KAAKC,CAAI,CAAC,EAElI,SAAS,gBAAgB,EAAgD,CACrE,OAAAC,GAA2B,OAAO,GAAQ,EAAEC,EAAK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AAe,EACpF,GAAImC,GAAiB,0BAA0B,KAAKA,CAAa,EAAG,MAAO,CAAE,KAAM,UAAW,QAAS1K,CAAqB,EAC5H,GAAI0K,GAAiB,sBAAsB,KAAKA,CAAa,EAEzD,MADI,+BAA+B,KAAK/D,CAAU,EAAU,CAAE,KAAM,OAAQ,EACrE,CAAE,KAAM,UAAW,QAAS5D,EAAM,SAAS,SAAS,EAAI,CAAC,GAAGhB,EAAwBE,CAAmB,EAAIF,CAAuB,EAE7I,GAAI2I,GAAiBxI,GAAkB,KAAKwI,CAAa,EACrD,MAAO,CAAE,KAAM,UAAW,QAAS1I,EAAgB,EAGvD,IAAM6I,EAAUC,EAAiBxE,EAAOC,EAAQE,EAAW8B,CAAe,EAC1E,GAAIxF,EAAM,KAAO,OAASA,EAAM,SAAS,MAAM,EAAG,MAAO,CAAE,KAAM,QAAS,EAC1E,IAAMgI,EAAU,qBAAqBhI,EAAO,CAAE,UAAS,SAAUuD,CAAM,CAAC,EAClE0E,EAAYjI,EAAM,KAAO,UAAYkI,GAAoB3E,EAAOG,EAAW,IAAI,OAAO8B,CAAe,EAAG,GAAIhB,CAAO,EAAI,KAC7H,MAAO,CAAE,KAAM,UAAW,QAASyD,EAAY,CAAC,eAAeA,EAAU,KAAMzC,CAAe,EAAG,GAAGwC,CAAO,EAAIA,CAAQ,CAC3H"}
|
|
1
|
+
{"version":3,"file":"completion-planner.js","names":["items.moduleItems","items.featureItems","items.sliceItemsFor","items.typeItems","items.commandItems","items.eventItems","scope.readModelItems","scope.reducerItems","scope.formItems","scope.contributeItems","scope.behaviorItems","scope.personaItems","scope.profileIdentityItems","items.identityItems","scope.authenticationItems","scope.seedItems","scope.themeItems","scope.uiProfileItems","scope.profileRootTemplateItems","scope.profileAppearanceItems","scope.profileSampleDataItems","scope.sampleDataItems","scope.sampleShapeItems","scope.outcomeItems","scope.layoutItems","scope.navigationItems","scope.toolbarItems","items.operationItems","items.operationPhaseItems","items.producesItems","items.handlerItems","items.implementationItems","items.operationImplementationItems","items.queryItems","items.performerItems","items.constraintItems","items.reactionItems","items.invocationItems","items.triggerItems","items.reactionTriggerItems","items.specificationItems","items.policyItems","items.validateItems","items.actionItems","items.tableItems","scope.templateItems","items.screenItems","items.actionSubjectValueItems","items.actionSubjectItems","items.guardedActionItems","items.actionArgumentItems","items.interactionChoiceItems","items.interactionActionItems","items.refusalItems","items.namedRuleImplementationItems","items.commandRuleItems","items.optionalTypeItems","items.specificationStepItems","items.inlineEventItems","items.ruleItems","productionRouteItem","RULE_LINE_PATTERN","document","keyword","line","topLevelItems","item","header","relative","text","index","indent","indentOf","construct","chain","where","subLanguage","getSubLanguage","purposeItems","moduleScopeItems","featureScopeItems","sliceItemsFor","conceptItems","typeItems","commandItems","eventItems","readModelItems","reducerItems","formItems","contributeItems","behaviorItems","personaItems","profileIdentityItems","identityItems","authenticationItems","seedItems","themeItems","uiProfileItems","profileRootTemplateItems","profileAppearanceItems","profileSampleDataItems","sampleDataItems","sampleShapeItems","outcomeItems","layoutItems","navigationItems","toolbarItems","operationItems","operationPhaseItems","producesItems","handlerItems","implementationItems","operationImplementationItems","queryItems","performerItems","constraintItems","reactionItems","invocationItems","triggerItems","reactionTriggerItems","specificationItems","policyItems","validateItems","actionItems","tableItems","templateItems","screenItems","candidate","scanDocument","lines","fences","fenceMap","lineIndex","withoutComment","textBefore","marker","generationChain","enclosingChain","inConcept","nearestEnclosingLine","generationEntries","generationCompletions","scope","category","continuationEntries","continuationResponseCompletions","symbols","responseEntries","exampleCompletions","responseCompletions","readEntries","commandReadCompletions","keyEntries","readModelKeyCompletions","dependencyEntries","dependencyTargetCompletions","importPath","refusal","refusalContext","member","contextVariableMatch","currentLine","effectiveIndent","subjectHeader","suffix","actionSubjectValueItems","actionSubjectItems","parentIndent","guarded","parent","guardedActionItems","actionArgumentItems","interactionChoiceItems","interactionActionItems","refusalItems","ruleContext","namedRuleContext","namedRuleImplementationItems","commandRuleItems","propertyOwner","propertyName","reservedProperty","match","afterPropertyType","afterQueryType","subjectModifier","subjectConcept","concept","subjectType","subjectTarget","attribute","afterSubjectType","keyModifier","modifierEntries","optionalTypeItems","step","specificationStepItems","enclosingLine","inlineEventItems","ruleItems","headers","enclosingHeaders","entries","expansion","structureCompletion"],"sources":["../../completion-planner.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { enclosingChain, enclosingHeaders, fenceMap, indentOf, nearestEnclosingLine, withoutComment } from './document-context';\nimport { refusalContext } from './refusal-context';\nimport { generationCompletions } from './generation-completions';\nimport { namedRuleContext } from './named-rule-context';\nimport { continuationResponseCompletions } from './continuation-responses';\nimport { responseCompletions } from './response-completions';\nimport { dependencyTargetCompletions } from './dependency-completions';\nimport { exampleCompletions } from './example-authoring';\nimport { DocumentSymbols, scanDocument } from './symbols';\nimport { structureCompletion } from './structure-completions';\nimport { getSubLanguage } from './sub-language-registry';\nimport * as items from './completion-items';\nimport * as scope from './scope-items';\nimport { CompletionEntry } from './completion-items';\nimport { purposeItems } from './purpose-items';\nimport { readModelKeyCompletions } from './read-model-key-completions';\nimport { commandReadCompletions } from './command-read-completions';\n\n// Matches a validation rule line ending in \"rule <Name>\" (optionally followed by a\n// message clause) - both the command form (\"<property> rule <Name>\") and the\n// concept implied-subject form (\"rule <Name>\"). Its first word is the property\n// name, not \"rule\", so it can't be recognized through the chain[0] keyword switch\n// the way \"on <EventType>\" or \"handler\" are - hence the dedicated regex check.\nconst productionRouteItem = { label: 'stream', insertText: 'stream ${1:Source.Stream}', documentation: 'Replace the whole command route for this event production. ESM v10.' };\n\nconst RULE_LINE_PATTERN = /(?:^|\\s)rule\\s+[A-Za-z_]\\w*(?:\\s+severity\\s+(?:information|warning|error))?(?:\\s+message\\s+.*)?$/;\n\nexport type CompletionPlan =\n | { kind: 'none' }\n | { kind: 'entries'; entries: CompletionEntry[] }\n | { kind: 'contextVariables'; replaceLength: number }\n | { kind: 'playFiles'; replaceLength: number }\n | { kind: 'policies' }\n | { kind: 'events' }\n | { kind: 'triggers' }\n | { kind: 'commands' }\n | { kind: 'producesTargets' }\n | { kind: 'screens' }\n | { kind: 'queries' }\n | { kind: 'types' };\n\n// What the position sits inside, beyond the keyword chain: the whole header of each enclosing block, so a\n// slice's type and a template's kind are known, and the document's own lines, so a declaration that may\n// appear once is not offered again.\nexport interface CompletionScope {\n headers: readonly string[];\n document: readonly string[];\n}\n\nconst declaredIn = (document: readonly string[], keyword: string) => document.some(line => new RegExp(`^${keyword}\\\\b`).test(line));\n\nfunction topLevelEntries(document: readonly string[]): CompletionEntry[] {\n return items.topLevelItems.filter(item => !(item.label === 'domain' && declaredIn(document, 'domain')) && !(item.label === 'authentication' && declaredIn(document, 'authentication')) && !(item.label === 'identity' && declaredIn(document, 'identity')));\n}\n\nconst isTemplate = (header: string | undefined) => /^(?:screen|dialog)\\s+template\\b/.test(header ?? '');\n\n// A whole block as one completion entry. Continuation lines are indented relative to the line it is inserted on,\n// which is how the editors indent a multi-line snippet.\nfunction expansionEntry(text: string, indent: number): CompletionEntry {\n const relative = text.split('\\n').map((line, index) => (index === 0 ? line : line.slice(Math.min(indent, indentOf(line))))).join('\\n');\n const label = text.split('\\n')[0].trim();\n return { label, insertText: relative.replace(/[$}\\\\]/g, '\\\\$&'), documentation: 'Expands the whole block from what the command and its events declare.' };\n}\n\nexport function completionEntriesFor(chain: string[], where: CompletionScope = { headers: [], document: [] }): CompletionEntry[] {\n const construct = chain[0];\n if (construct === undefined || construct === 'domain') return topLevelEntries(where.document);\n const subLanguage = getSubLanguage(construct);\n if (subLanguage) return subLanguage.completions ?? [];\n const header = where.headers[0];\n switch (construct) {\n case 'purpose':\n return purposeItems;\n case 'module':\n return items.moduleItems;\n case 'feature':\n return items.featureItems;\n case 'slice':\n return items.sliceItemsFor(header?.split(/\\s+/)[1]);\n case 'concept':\n return /:\\s*Enum\\b/.test(header ?? '') ? [...items.conceptItems.filter(item => item.label !== 'validate checksum'), { label: 'enum member (numbered)', insertText: '${1:value} = ${2:0}', documentation: 'Every member must declare a unique int32 number. Keep published numbers unchanged; specifications name members, not numbers.' }] : items.conceptItems.filter(item => item.label !== 'validate checksum' || /:\\s*String\\b/.test(header ?? ''));\n case 'type':\n return items.typeItems;\n case 'command':\n return items.commandItems;\n case 'public':\n case 'event':\n return items.eventItems;\n case 'readmodel':\n return scope.readModelItems;\n case 'reducer':\n return scope.reducerItems;\n case 'form':\n return scope.formItems;\n case 'contribute':\n return scope.contributeItems;\n case 'behavior':\n return scope.behaviorItems;\n case 'persona':\n return scope.personaItems;\n case 'identity':\n return chain.includes('ui') ? scope.profileIdentityItems : items.identityItems;\n case 'authentication':\n return scope.authenticationItems;\n case 'seed':\n return scope.seedItems;\n case 'theme':\n return scope.themeItems;\n case 'ui':\n return scope.uiProfileItems;\n case 'root':\n return chain.includes('ui') ? scope.profileRootTemplateItems : [];\n case 'appearance':\n return chain.includes('ui') ? scope.profileAppearanceItems : [];\n case 'sample':\n return chain.includes('ui') ? scope.profileSampleDataItems : scope.sampleDataItems;\n case 'shape':\n return chain[1] === 'sample' ? scope.sampleShapeItems : [];\n case 'on':\n case 'success':\n case 'failure':\n case 'confirm':\n return scope.outcomeItems;\n case 'layout':\n return scope.layoutItems;\n case 'navigation':\n return scope.navigationItems;\n case 'toolbar':\n return scope.toolbarItems;\n case 'system':\n return items.operationItems.filter(item => item.label === 'description');\n case 'operation':\n return items.operationItems;\n case 'execute':\n case 'compensate':\n return items.operationPhaseItems;\n case 'produces':\n return chain.includes('command') ? [...items.producesItems, productionRouteItem] : items.producesItems;\n case 'handler':\n return items.handlerItems;\n case 'implementation':\n return chain[1] === 'handler' ? items.implementationItems : ['execute', 'compensate'].includes(chain[1]) ? items.operationImplementationItems : [];\n case 'reads':\n return [{ label: 'by parts', insertText: 'by\\n ${1:part} = ${2:source}\\n ${3:part} = ${4:source}', documentation: 'Supply every composite read-model key part by name.' }];\n case 'query':\n return items.queryItems;\n case 'performer':\n return items.performerItems;\n case 'constraint':\n return items.constraintItems;\n case 'reaction':\n return items.reactionItems;\n case 'invokes':\n return chain.includes('reaction') ? items.invocationItems : [];\n case 'trigger':\n return items.triggerItems;\n case 'when':\n case 'every':\n case 'at':\n return chain.includes('reaction') ? items.reactionTriggerItems : [];\n case 'specification':\n return items.specificationItems;\n case 'policy':\n return items.policyItems;\n case 'validate':\n return chain.includes('concept') && /:\\s*String\\b/.test(where.headers.find(header => /^concept\\s/.test(header)) ?? '')\n ? [...items.validateItems, { label: 'checksum', insertText: 'checksum ${1|luhn,mod11,mod97|}', documentation: 'Exact trailing check digits over preceding ASCII digits. String concepts only; also validates inputs and stored values.' }]\n : items.validateItems;\n case 'action':\n return items.actionItems;\n case 'table':\n case 'summary':\n return items.tableItems;\n case 'screen':\n return isTemplate(header) ? scope.templateItems : items.screenItems;\n case 'dialog':\n return scope.templateItems;\n default:\n if (isTemplate(where.headers.find(candidate => isTemplate(candidate)))) return scope.templateItems;\n // Sections inside a screen expose the screen vocabulary.\n if (chain.includes('screen') || construct === 'section') return items.screenItems;\n if (chain.includes('produces')) return chain.includes('command') ? [...items.producesItems, productionRouteItem] : items.producesItems;\n return [];\n }\n}\n\n// Decides what to complete at a position, without any editor dependency — the\n// Monaco service and the VSCode extension both materialize the plan into items.\nexport function planCompletions(\n lines: string[],\n lineIndex: number,\n textBefore: string,\n symbols: DocumentSymbols = scanDocument(lines),\n): CompletionPlan {\n const fences = fenceMap(lines);\n if (fences[lineIndex] || withoutComment(textBefore).length < textBefore.length) return { kind: 'none' };\n if (/^\\s*concept\\s+[\\p{L}\\p{Mn}\\p{Nd}\\p{Pc}]+\\s*:\\s*\\w+\\s+(?:(?:pii|personal|secret)\\s+)*\\w*$/u.test(textBefore)) {\n return { kind: 'entries', entries: ['pii', 'secret'].filter(marker => !new RegExp(`\\\\b${marker}\\\\b`).test(textBefore)).map(marker => ({ label: marker, insertText: marker, documentation: marker === 'pii' ? 'personal data (GDPR Art. 4(1)); renders Chronicle [PII]' : 'Operational secret; renders [Encrypted] + [NotAudited].' })) };\n }\n const generationChain = enclosingChain(lines, fences, lineIndex, indentOf(textBefore));\n const inConcept = generationChain[0] === 'concept';\n if (generationChain[0] === 'generate' && generationChain[1] === 'concept' && /^generate\\s+rule\\s+/.test((nearestEnclosingLine(lines, fences, lineIndex, indentOf(textBefore)) ?? '').trim())) {\n return { kind: 'entries', entries: [\n { label: 'file', insertText: 'file ${1:Generator.cs}', documentation: 'The sole ValueGeneration source. Receives the provider-bound GenerationContext (Now, Tenant); returns String.' },\n { label: 'csharp', insertText: '```csharp\\n${1:return value;}\\n```', documentation: 'The sole ValueGeneration body. Reference execution requires fixtures; it never invokes this code.' },\n ] };\n }\n const generationEntries = inConcept || (generationChain[0] === 'validate' && generationChain[1] === 'concept') ? generationCompletions(lines, lineIndex, textBefore) : null;\n if (generationEntries !== null) return { kind: 'entries', entries: generationEntries };\n if (inConcept && /^\\s*(?:secret|sensitive|@sensitive)\\s+scope\\s+\\w*$/.test(textBefore)) {\n return { kind: 'entries', entries: ['subject', 'namespace', 'global'].map(scope => ({ label: scope, insertText: scope, documentation: 'Explicit secret encryption scope.' })) };\n }\n if (inConcept && /^\\s*(?:pii|personal|@pii)\\s+special\\s+\\w*$/.test(textBefore)) {\n return { kind: 'entries', entries: ['racialOrEthnicOrigin', 'politicalOpinions', 'religiousOrPhilosophicalBeliefs', 'tradeUnionMembership', 'genetic', 'biometric', 'health', 'sexLifeOrSexualOrientation'].map(category => ({ label: category, insertText: category, documentation: 'GDPR Art. 9(1) special category.' })) };\n }\n const continuationEntries = continuationResponseCompletions(lines, lineIndex, textBefore, symbols);\n if (continuationEntries !== null) return { kind: 'entries', entries: continuationEntries };\n const responseEntries = exampleCompletions(lines, lineIndex, textBefore) ?? responseCompletions(lines, lineIndex, textBefore, scanDocument(lines));\n if (responseEntries !== null) return { kind: 'entries', entries: responseEntries };\n const readEntries = commandReadCompletions(lines, lineIndex, textBefore, symbols);\n if (readEntries !== null) return { kind: 'entries', entries: readEntries };\n const keyEntries = readModelKeyCompletions(lines, lineIndex, textBefore, symbols);\n if (keyEntries !== null) return { kind: 'entries', entries: keyEntries };\n const dependencyEntries = dependencyTargetCompletions(lines, lineIndex, textBefore, symbols);\n if (dependencyEntries !== null) return { kind: 'entries', entries: dependencyEntries };\n\n // Inside the quotes of a file import, what is wanted is a path - replacing what has been typed so far.\n const importPath = textBefore.match(/^\\s*import\\s+\"([^\"]*)$/);\n if (importPath) {\n return { kind: 'playFiles', replaceLength: importPath[1].length };\n }\n\n // A quote or a slash only asks for a completion inside an import path.\n if (/[\"/]$/.test(textBefore)) return { kind: 'none' };\n\n const refusal = refusalContext(lines, lineIndex, indentOf(lines[lineIndex] ?? textBefore));\n if (/\\$refusal\\.\\w*$/.test(textBefore)) {\n return { kind: 'entries', entries: refusal === undefined ? [] : ['reason', 'message', ...(/^on\\s+refused\\s+by\\s+constraint(?:\\s|$)/.test(refusal) ? ['constraint'] : [])].map(member => ({ label: member, insertText: member, documentation: 'String refusal value in branch event mappings; executable from ESM v19. Constraint is available only in a by constraint branch.' })) };\n }\n const contextVariableMatch = textBefore.match(/\\$[\\w.]*$/);\n if (contextVariableMatch) {\n return { kind: 'contextVariables', replaceLength: contextVariableMatch[0].length };\n }\n\n const currentLine = lines[lineIndex] ?? '';\n const effectiveIndent =\n textBefore.trim().length === 0 ? textBefore.length : indentOf(currentLine);\n const chain = enclosingChain(lines, fences, lineIndex, effectiveIndent);\n if (chain.includes('screen')) {\n const subjectHeader = /^\\s*(?:action\\s+(?:\"(?:[^\"\\\\]|\\\\.)*\"|\\$strings\\.[\\w.]+|[\\w.]+)|item\\s+\\w+\\s+action\\s+[\\w.]+)\\s+/;\n if (subjectHeader.test(textBefore)) {\n const suffix = textBefore.replace(subjectHeader, '');\n if (/^for\\s+\\w*$/.test(suffix)) return { kind: 'entries', entries: items.actionSubjectValueItems };\n if (/^(?:f|fo|for)?$/.test(suffix)) return { kind: 'entries', entries: items.actionSubjectItems };\n }\n let parentIndent = effectiveIndent;\n let guarded = false;\n for (let index = lineIndex - 1; index >= 0; index--) {\n if (fences[index]) continue;\n const parent = withoutComment(lines[index]);\n if (parent.trim().length === 0 || indentOf(parent) >= parentIndent) continue;\n parentIndent = indentOf(parent);\n if (/^\\s*action\\s+(?:\"|\\$strings\\.)/.test(parent)) { guarded = true; break; }\n if (/^\\s*screen\\b/.test(parent)) break;\n }\n if (guarded) {\n if (/^\\s*(?:when\\b.*|otherwise)\\s+execute\\s+[\\w.]*$/.test(textBefore)) return { kind: 'commands' };\n if (chain[0] === 'action') return { kind: 'entries', entries: items.guardedActionItems };\n if (['when', 'otherwise'].includes(chain[0])) {\n const parent = nearestEnclosingLine(lines, fences, lineIndex, effectiveIndent) ?? '';\n return { kind: 'entries', entries: /\\bexecute\\s+[\\w.]+$/.test(parent) ? items.actionArgumentItems : [] };\n }\n }\n }\n if (['on', 'when', 'otherwise'].includes(chain[0])) {\n let parentIndent = effectiveIndent;\n for (let index = lineIndex - 1; index >= 0; index--) {\n if (fences[index]) continue;\n const parent = withoutComment(lines[index]);\n if (parent.trim().length === 0 || indentOf(parent) >= parentIndent) continue;\n parentIndent = indentOf(parent);\n if (/^\\s*on\\s+(?:click|double click|select|change)\\s*$/.test(parent)) {\n return { kind: 'entries', entries: chain[0] === 'on' ? items.interactionChoiceItems : items.interactionActionItems };\n }\n if (/^\\s*(?:screen|behavior|specification|reaction)\\b/.test(parent)) break;\n }\n }\n if (chain[0] === 'on' && refusal !== undefined) return { kind: 'entries', entries: items.refusalItems };\n const ruleContext = namedRuleContext(lines, lineIndex, effectiveIndent);\n if (ruleContext === 'implementation') return { kind: 'entries', entries: items.namedRuleImplementationItems };\n if (ruleContext === 'rule') return { kind: 'entries', entries: items.commandRuleItems };\n\n const propertyOwner = ['public', 'event', 'command', 'type', 'readmodel', 'trigger', 'when', 'every', 'at'].includes(chain[0]) ||\n (chain[0] === 'produces' && /^produces\\s+event\\b/.test(nearestEnclosingLine(lines, fences, lineIndex, effectiveIndent) ?? ''));\n const propertyName = textBefore.trimStart().split(/\\s+/)[0];\n const reservedProperty = (chain[0] === 'command' && ['reads', 'authorize', 'produces'].includes(propertyName)) ||\n (chain[0] === 'event' && propertyName === 'tag') ||\n (['trigger', 'when', 'every', 'at'].includes(chain[0]) && ['description', 'file', 'reads', 'produces', 'invokes'].includes(propertyName));\n const optionalPrefix = (match: RegExpMatchArray | null) => match !== null && 'optional'.startsWith(match[1]);\n const afterPropertyType = propertyOwner && !reservedProperty && optionalPrefix(textBefore.match(/^\\s*@?[a-z_]\\w*\\s+[\\w.]+(?:\\[\\])?\\s+(\\w*)$/));\n const afterQueryType = (chain[0] === 'query' && optionalPrefix(textBefore.match(/^\\s*(?:by|filter)\\s+[a-z_]\\w*\\s+[\\w.]+(?:\\[\\])?\\s+(\\w*)$/))) ||\n optionalPrefix(textBefore.match(/^\\s*query\\s+[A-Za-z_]\\w*\\s*=>\\s*(?:observable\\s+)?[\\w.]+(?:\\[\\])?\\s+(\\w*)$/));\n const eventPropertyOwner = chain[0] === 'event' || (chain[0] === 'produces' && /^produces\\s+event\\b/.test(nearestEnclosingLine(lines, fences, lineIndex, effectiveIndent) ?? ''));\n const subjectModifier = eventPropertyOwner && !reservedProperty ? textBefore.match(/^\\s*@?[a-z_]\\w*\\s+([\\w.]+)\\s+(\\w*)$/) : null;\n const subjectConcept = symbols.concepts.find(concept => concept.name === subjectModifier?.[1]);\n const subjectType = subjectConcept?.primitive ?? subjectModifier?.[1];\n const subjectTarget = (subjectType === 'String' || subjectType === 'Uuid' || (subjectType === 'Int' && subjectConcept !== undefined)) &&\n !subjectConcept?.attributes.some(attribute => ['pii', 'personal', 'secret', 'sensitive'].includes(attribute.replace(/^@/, '')));\n const afterSubjectType = subjectModifier !== null && subjectTarget && 'subject'.startsWith(subjectModifier[2]);\n const keyModifier = chain[0] === 'readmodel' ? textBefore.match(/^\\s*@?[a-z_]\\w*\\s+[\\w.]+\\s+(\\w*)$/) : null;\n const modifierEntries = [\n ...(keyModifier && 'key'.startsWith(keyModifier[1]) ? [{ label: 'key', insertText: 'key', documentation: 'Declares a required scalar read-model key part. Explicit keys replace inference. Supply every part by name when looking up one instance.' }] : []),\n ...((afterPropertyType || afterQueryType) && !/=>\\s*observable\\s+$/.test(textBefore) ? items.optionalTypeItems : []),\n ...(afterSubjectType ? [{ label: 'subject', insertText: 'subject', documentation: 'One required scalar event data-subject identity; not pii or secret. Report-only lineage metadata (PLAY0270), no ESM or provider output yet.' }] : []),\n ];\n if (modifierEntries.length > 0) return { kind: 'entries', entries: modifierEntries };\n\n if (/\\bauthorize\\s+[\\w\\s]*$/.test(textBefore) || chain[0] === 'authorize') {\n return { kind: 'policies' };\n }\n if (/\\bwhen\\s+\\w*$/.test(textBefore) && chain.includes('reaction')) {\n return { kind: 'triggers' };\n }\n if (/\\bon\\s+\\w*$/.test(textBefore) && chain.includes('constraint')) {\n return { kind: 'events' };\n }\n if (/\\binvokes\\s+\\w*$/.test(textBefore) && chain.includes('reaction')) {\n return { kind: 'commands' };\n }\n if (/\\b(?:on|unique\\s+event)\\s+\\w*$/.test(textBefore) && chain[0] === 'constraint') {\n return { kind: 'events' };\n }\n if (/\\bproduces\\s+\\w*$/.test(textBefore)) {\n return { kind: 'producesTargets' };\n }\n if (/\\bnavigate\\s+to\\s+\\w*$/.test(textBefore)) {\n return { kind: 'screens' };\n }\n if (chain[0] === 'specification') {\n if (/^\\s*when\\s+query\\s+[\\w.]*$/.test(textBefore)) return { kind: 'queries' };\n const step = textBefore.match(/^\\s*(given|when|then)\\s+\\w*$/);\n if (step) return { kind: 'entries', entries: items.specificationStepItems[step[1] as 'given' | 'when' | 'then'] };\n }\n if (/\\b(?:via|then)\\s+query\\s+[\\w.]*$/.test(textBefore)) {\n return { kind: 'queries' };\n }\n if (\n (chain[0] === 'event' || chain[0] === 'command' || chain[0] === 'type') &&\n /^\\s+[a-z_]\\w*\\s+[\\w[\\]?]*$/.test(textBefore)\n ) {\n return { kind: 'types' };\n }\n if (chain[0] === 'query' && /^\\s+(?:by|filter)\\s+[a-z_]\\w*\\s+[\\w[\\]?]*$/.test(textBefore)) {\n return { kind: 'types' };\n }\n\n const enclosingLine = nearestEnclosingLine(lines, fences, lineIndex, effectiveIndent);\n if (enclosingLine && /^produces\\s+operation\\b/.test(enclosingLine)) return { kind: 'entries', entries: items.operationItems };\n if (enclosingLine && /^produces\\s+event\\b/.test(enclosingLine)) {\n if (/^\\s+@?[a-z_]\\w*\\s+[\\w[\\]?]*$/.test(textBefore)) return { kind: 'types' };\n return { kind: 'entries', entries: chain.includes('command') ? [...items.inlineEventItems, productionRouteItem] : items.inlineEventItems };\n }\n if (enclosingLine && RULE_LINE_PATTERN.test(enclosingLine)) {\n return { kind: 'entries', entries: items.ruleItems };\n }\n\n const headers = enclosingHeaders(lines, fences, lineIndex, effectiveIndent);\n if (chain[0] === 'for' && chain.includes('seed')) return { kind: 'events' };\n const entries = completionEntriesFor(chain, { headers, document: lines });\n const expansion = chain[0] === 'command' ? structureCompletion(lines, lineIndex, ' '.repeat(effectiveIndent), '', symbols) : null;\n return { kind: 'entries', entries: expansion ? [expansionEntry(expansion.text, effectiveIndent), ...entries] : entries };\n}\n"],"mappings":"83EA0BA,MAAM4D,EAAsB,CAAE,MAAO,SAAU,WAAY,4BAA6B,cAAe,qEAAsE,EAEvKC,GAAoB,mGAwBpB,YAAc,EAA6B,IAAoBC,EAAS,KAAK,GAAY,OAAO,IAAIC,EAAQ,IAAI,CAAC,CAAC,KAAKC,CAAI,CAAC,EAElI,SAAS,gBAAgB,EAAgD,CACrE,OAAAC,GAA2B,OAAO,GAAQ,EAAEC,EAAK,QAAU,UAAY,WAAWJ,EAAU,QAAQ,IAAM,EAAEI,EAAK,QAAU,kBAAoB,WAAWJ,EAAU,gBAAgB,IAAM,EAAEI,EAAK,QAAU,YAAc,WAAWJ,EAAU,UAAU,EAAE,CAC9P,CAEA,MAAM,WAAc,GAA+B,kCAAkC,KAAKK,GAAU,EAAE,EAItG,SAAS,eAAe,EAAc,EAAiC,C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,SAAS,EAAI,CAAC,GAAGhB,EAAwBE,CAAmB,EAAIF,CAAuB,EAE7I,GAAI2I,GAAiBxI,GAAkB,KAAKwI,CAAa,EACrD,MAAO,CAAE,KAAM,UAAW,QAAS1I,EAAgB,EAGvD,IAAM6I,EAAUC,EAAiBxE,EAAOC,EAAQE,EAAW8B,CAAe,EAC1E,GAAIxF,EAAM,KAAO,OAASA,EAAM,SAAS,MAAM,EAAG,MAAO,CAAE,KAAM,QAAS,EAC1E,IAAMgI,EAAU,qBAAqBhI,EAAO,CAAE,UAAS,SAAUuD,CAAM,CAAC,EAClE0E,EAAYjI,EAAM,KAAO,UAAYkI,GAAoB3E,EAAOG,EAAW,IAAI,OAAO8B,CAAe,EAAG,GAAIhB,CAAO,EAAI,KAC7H,MAAO,CAAE,KAAM,UAAW,QAASyD,EAAY,CAAC,eAAeA,EAAU,KAAMzC,CAAe,EAAG,GAAGwC,CAAO,EAAIA,CAAQ,CAC3H"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./_virtual/_virtual/_rolldown/runtime.js";import{fenceMap as e}from"./document-context.js";const t=RegExp(`^(\\s*(?:public\\s+)?(?:`+(/* @__PURE__ */ `screen\\s+template.dialog\\s+template.slice\\s+\\w+.ui\\s+profile.sample\\s+data.toolbar.concept.type.policy.purpose.persona.module.layout.theme.feature.event.system.eventsource.operation.command.query.projection.reaction.reducer.readmodel.trigger.screen.dialog.form.constraint.specification.behavior.exposure.instance`.split(`.`)).join(`|`)+`)\\s+)([A-Za-z_][\\w.]*)`);function declarationHeaders(n){let r=e([...n]),i=[];return n.forEach((e,n)=>{if(r[n]||/^\s*\/\//.test(e))return;let a=t.exec(e);if(a===null)return;let o=a[1].trim().replace(/^public\s+/,``).replace(/\s+/g,` `);i.push({keyword:o,name:a[2],line:n,column:a[1].length})}),i}export{declarationHeaders};
|
|
2
|
+
//# sourceMappingURL=declarations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declarations.js","names":["header","fences","fenceMap","lines","headers","line","text","match","keyword"],"sources":["../../declarations.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { fenceMap } from './document-context';\n\n/** Where a named construct is declared. */\nexport interface DeclarationHeader {\n /** The construct keyword, such as `concept`, `screen template` or `slice StateChange`. */\n readonly keyword: string;\n\n /** The name the construct declares. */\n readonly name: string;\n\n /** The zero-based line of the header. */\n readonly line: number;\n\n /** The zero-based column the name starts at. */\n readonly column: number;\n}\n\n// Every construct that is declared by a header line naming it: `concept TalkId : Uuid`, `screen template ReviewDesk`,\n// `slice StateChange SubmitTalk`. References to a name (`navigate to TalkList`, `template ReviewDesk`, `authorize\n// IsSpeaker`) are not headers, so a reference never reads as a second declaration.\nconst header = new RegExp(\n '^(\\\\s*(?:public\\\\s+)?(?:' + [\n 'screen\\\\s+template', 'dialog\\\\s+template', 'slice\\\\s+\\\\w+', 'ui\\\\s+profile', 'sample\\\\s+data', 'toolbar',\n 'concept', 'type', 'policy', 'purpose', 'persona', 'module', 'layout', 'theme', 'feature', 'event', 'system', 'eventsource',\n 'operation', 'command', 'query', 'projection', 'reaction', 'reducer', 'readmodel', 'trigger', 'screen', 'dialog', 'form',\n 'constraint', 'specification', 'behavior', 'exposure', 'instance',\n ].join('|') + ')\\\\s+)([A-Za-z_][\\\\w.]*)');\n\n/**\n * Finds the headers that declare constructs in a document.\n *\n * @param lines The document's lines.\n * @returns The headers, in document order.\n */\nexport function declarationHeaders(lines: readonly string[]): DeclarationHeader[] {\n const fences = fenceMap([...lines]);\n const headers: DeclarationHeader[] = [];\n lines.forEach((text, line) => {\n if (fences[line] || /^\\s*\\/\\//.test(text)) return;\n const match = header.exec(text);\n if (match === null) return;\n const keyword = match[1].trim().replace(/^public\\s+/, '').replace(/\\s+/g, ' ');\n headers.push({ keyword, name: match[2], line, column: match[1].length });\n });\n\n return headers;\n}\n"],"mappings":"kGAuBA,MAAMA,EAAa,OACf,4BAA6B,0VAK7B,EAAC,CAAC,KAAK,GAAG,EAAI,0BAA0B,EAQ5C,SAAgB,mBAAmB,EAA+C,CAC9E,IAAMC,EAASC,EAAS,CAAC,GAAGC,CAAK,CAAC,EAC5BC,EAA+B,CAAC,EAStC,OARAD,EAAM,SAAS,EAAM,IAAS,CAC1B,GAAIF,EAAOI,IAAS,WAAW,KAAKC,CAAI,EAAG,OAC3C,IAAMC,EAAQP,EAAO,KAAKM,CAAI,EAC9B,GAAIC,IAAU,KAAM,OACpB,IAAMC,EAAUD,EAAM,EAAE,CAAC,KAAK,CAAC,CAAC,QAAQ,aAAc,EAAE,CAAC,CAAC,QAAQ,OAAQ,GAAG,EAC7EH,EAAQ,KAAK,CAAE,UAAS,KAAMG,EAAM,GAAI,OAAM,OAAQA,EAAM,EAAE,CAAC,MAAO,CAAC,CAC3E,CAAC,EAEMH,CACX"}
|
package/dist/bundles/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./_virtual/_virtual/_rolldown/runtime.js";import{blockHeaderPattern as e,causedByProperties as t,clauseKeywords as n,codeBlockTags as r,conceptAttributes as i,constructKeywords as a,contextRoots as o,languageConfiguration as s,languageExtensionPoint as c,languageId as l,primitiveTypes as u,sliceTypes as d}from"./language.js";import{createTokensProvider as f}from"./tokens.js";import{typeReferenceSymbol as p,typeReferenceText as m}from"./TypeReferenceSymbol.js";import{enclosingChain as ee,fenceMap as te,firstWord as ne,indentOf as re,withoutComment as ie}from"./document-context.js";import{eventContextPaths as ae}from"./event-context-catalog.js";import{eventContextMemberAt as oe,eventContextMembers as se,eventContextMembersAfter as ce,namesEventContextMember as le}from"./event-context.js";import{contextVariableEntries as ue,contextVariableItems as de,producesItems as fe,specificationStepItems as pe}from"./completion-items.js";import{responseAnalysis as me,responseAvailability as he}from"./response-analysis.js";import{fileReferenceKeyword as h,fileReferenceOn as g,fileReferences as _,isAbsoluteFileReferencePath as v}from"./file-references.js";import{builtInTriggerNames as y,knownEventNames as b,knownTriggerNames as x,knownTypeNames as S,mergeSymbols as C,scanDocument as w,symbolsForBuffer as T}from"./symbols.js";import{responseCompletions as E}from"./response-completions.js";import{exampleCompletions as D,exampleHover as O}from"./example-authoring.js";import{analyzeOperations as k,operationAvailability as A,operationCompletions as j,operationDetails as M,operationHover as N,operationReferenceAt as P,phaseState as F}from"./operation-authoring.js";import{analyzeEventSources as I,eventSourceAvailability as L,eventSourceCompletions as R,eventSourceDetails as ge,eventSourceHover as _e,eventSourceIdentifier as z,eventSourceReferenceAt as B}from"./event-source-authoring.js";import{structureCompletion as ve}from"./structure-completions.js";import{getSubLanguage as V,getSubLanguages as H,onSubLanguagesChanged as ye,registerSubLanguage as U}from"./sub-language-registry.js";import{completionEntriesFor as be,planCompletions as xe}from"./completion-planner.js";import{createCompletionProvider as Se}from"./completions.js";import{createInlineCompletionProvider as Ce}from"./inline-completions.js";import{responseTokenTypes as W,responseTokens as G}from"./response-tokens.js";import{reactionReferenceAt as K}from"./reaction-authoring.js";import{attributeDocs as we,contextVariableDocs as Te,keywordDocs as Ee,specificationKeywordDocs as De}from"./keyword-docs.js";import{hoverContent as Oe}from"./hover-content.js";import{createHoverProvider as ke}from"./hover.js";import{destinationHints as Ae,productionDestinations as je}from"./production-destinations.js";import{createInlayHintsProvider as Me}from"./inlay-hints.js";import{createCodeActionProvider as q}from"./code-actions.js";import{diagnosticCodes as
|
|
1
|
+
import"./_virtual/_virtual/_rolldown/runtime.js";import{blockHeaderPattern as e,causedByProperties as t,clauseKeywords as n,codeBlockTags as r,conceptAttributes as i,constructKeywords as a,contextRoots as o,languageConfiguration as s,languageExtensionPoint as c,languageId as l,primitiveTypes as u,sliceTypes as d}from"./language.js";import{createTokensProvider as f}from"./tokens.js";import{typeReferenceSymbol as p,typeReferenceText as m}from"./TypeReferenceSymbol.js";import{enclosingChain as ee,fenceMap as te,firstWord as ne,indentOf as re,withoutComment as ie}from"./document-context.js";import{eventContextPaths as ae}from"./event-context-catalog.js";import{eventContextMemberAt as oe,eventContextMembers as se,eventContextMembersAfter as ce,namesEventContextMember as le}from"./event-context.js";import{contextVariableEntries as ue,contextVariableItems as de,producesItems as fe,specificationStepItems as pe}from"./completion-items.js";import{responseAnalysis as me,responseAvailability as he}from"./response-analysis.js";import{fileReferenceKeyword as h,fileReferenceOn as g,fileReferences as _,isAbsoluteFileReferencePath as v}from"./file-references.js";import{builtInTriggerNames as y,knownEventNames as b,knownTriggerNames as x,knownTypeNames as S,mergeSymbols as C,scanDocument as w,symbolsForBuffer as T}from"./symbols.js";import{responseCompletions as E}from"./response-completions.js";import{exampleCompletions as D,exampleHover as O}from"./example-authoring.js";import{analyzeOperations as k,operationAvailability as A,operationCompletions as j,operationDetails as M,operationHover as N,operationReferenceAt as P,phaseState as F}from"./operation-authoring.js";import{analyzeEventSources as I,eventSourceAvailability as L,eventSourceCompletions as R,eventSourceDetails as ge,eventSourceHover as _e,eventSourceIdentifier as z,eventSourceReferenceAt as B}from"./event-source-authoring.js";import{structureCompletion as ve}from"./structure-completions.js";import{getSubLanguage as V,getSubLanguages as H,onSubLanguagesChanged as ye,registerSubLanguage as U}from"./sub-language-registry.js";import{completionEntriesFor as be,planCompletions as xe}from"./completion-planner.js";import{createCompletionProvider as Se}from"./completions.js";import{createInlineCompletionProvider as Ce}from"./inline-completions.js";import{responseTokenTypes as W,responseTokens as G}from"./response-tokens.js";import{reactionReferenceAt as K}from"./reaction-authoring.js";import{attributeDocs as we,contextVariableDocs as Te,keywordDocs as Ee,specificationKeywordDocs as De}from"./keyword-docs.js";import{hoverContent as Oe}from"./hover-content.js";import{createHoverProvider as ke}from"./hover.js";import{destinationHints as Ae,productionDestinations as je}from"./production-destinations.js";import{createInlayHintsProvider as Me}from"./inlay-hints.js";import{createCodeActionProvider as q}from"./code-actions.js";import{diagnosticCodes as Ne}from"./diagnostic-codes.js";import{fileImportOn as Pe,fileImports as Fe,importablePaths as Ie,isFileImportLine as J}from"./file-imports.js";import{validateLines as Le}from"./validation.js";import{attachDiagnostics as Re}from"./diagnostics.js";import{pdl as Y}from"./sub-languages/pdl.js";import{cdl as X}from"./sub-languages/cdl.js";import{screenplayDark as ze,screenplayDarkThemeName as Z}from"./themes/screenplay-dark.js";import{screenplayLight as Be,screenplayLightThemeName as Q}from"./themes/screenplay-light.js";import{declarationHeaders as Ve}from"./declarations.js";const $=/* @__PURE__ */ new Set;function applyTokensProvider(e){e.languages.setMonarchTokensProvider(l,f(H()))}ye(()=>$.forEach(applyTokensProvider));function ensureBuiltInSubLanguages(){V(`projection`)||U(`projection`,Y),V(`capture`)||U(`capture`,X)}function register(e,t={}){$.has(e)||(ensureBuiltInSubLanguages(),$.add(e),e.languages.register(c),e.languages.setLanguageConfiguration(l,s),applyTokensProvider(e),e.languages.registerCompletionItemProvider(l,Se(e,t)),e.languages.registerInlineCompletionsProvider(l,Ce(t)),e.languages.registerHoverProvider(l,ke(t)),e.languages.registerDefinitionProvider(l,{provideDefinition(n,r){let i=n.getWordAtPosition(r);if(!i)return[];let a=t.application?.(n),o=B(n.getLinesContent(),r.lineNumber-1,i.startColumn,i.endColumn,a),s=K(n.getLinesContent(),r.lineNumber-1,i.startColumn,i.endColumn,a),c=s?s.target:o?.target;if(!c)return[];let l=a?.authoringPath??`current.play`,u=c.location.path===l?n.getValue():a?.authoringDocuments?.find(e=>e.path===c.location.path)?.source,d=s?s.target?.location:u&&z(c.location,c.name,u);if(!d)return[];let f=c.location.path&&n.uri.path.endsWith(`/${l}`)?n.uri.with({path:n.uri.path.slice(0,-l.length)+c.location.path}):void 0,p=f?e.editor.getModels().filter(e=>e.uri.toString()===f.toString()):[],m=c.location.path===l?n:p.length===1?p[0]:void 0;return m?[{uri:m.uri,range:new e.Range(d.line,d.column,d.line,d.column+c.name.length)}]:[]}}),e.languages.registerDocumentSemanticTokensProvider(l,{getLegend:()=>({tokenTypes:[...W],tokenModifiers:[]}),provideDocumentSemanticTokens(e){let n=[],r=0,i=0;for(let a of G(e.getLinesContent(),t.application?.(e)))n.push(a.line-r,a.line===r?a.column-i:a.column,a.length,a.type,0),r=a.line,i=a.column;return{data:new Uint32Array(n)}},releaseDocumentSemanticTokens(){}}),e.languages.registerInlayHintsProvider(l,Me(t)),e.languages.registerCodeActionProvider(l,q()),e.editor.defineTheme(Z,ze),e.editor.defineTheme(Q,Be),Re(e,t))}export{I as analyzeEventSources,k as analyzeOperations,we as attributeDocs,e as blockHeaderPattern,y as builtInTriggerNames,t as causedByProperties,X as cdl,n as clauseKeywords,r as codeBlockTags,be as completionEntriesFor,i as conceptAttributes,a as constructKeywords,o as contextRoots,Te as contextVariableDocs,ue as contextVariableEntries,de as contextVariableItems,q as createCodeActionProvider,Ve as declarationHeaders,Ae as destinationHints,Ne as diagnosticCodes,ee as enclosingChain,ensureBuiltInSubLanguages,oe as eventContextMemberAt,se as eventContextMembers,ce as eventContextMembersAfter,ae as eventContextPaths,L as eventSourceAvailability,R as eventSourceCompletions,ge as eventSourceDetails,_e as eventSourceHover,z as eventSourceIdentifier,B as eventSourceReferenceAt,D as exampleCompletions,O as exampleHover,te as fenceMap,Pe as fileImportOn,Fe as fileImports,h as fileReferenceKeyword,g as fileReferenceOn,_ as fileReferences,ne as firstWord,V as getSubLanguage,H as getSubLanguages,Oe as hoverContent,Ie as importablePaths,re as indentOf,v as isAbsoluteFileReferencePath,J as isFileImportLine,Ee as keywordDocs,b as knownEventNames,x as knownTriggerNames,S as knownTypeNames,l as languageId,C as mergeSymbols,le as namesEventContextMember,A as operationAvailability,j as operationCompletions,M as operationDetails,N as operationHover,P as operationReferenceAt,Y as pdl,F as phaseState,xe as planCompletions,u as primitiveTypes,fe as producesItems,je as productionDestinations,K as reactionReferenceAt,register,U as registerSubLanguage,me as responseAnalysis,he as responseAvailability,E as responseCompletions,W as responseTokenTypes,G as responseTokens,w as scanDocument,Z as screenplayDarkThemeName,Q as screenplayLightThemeName,d as sliceTypes,De as specificationKeywordDocs,pe as specificationStepItems,ve as structureCompletion,T as symbolsForBuffer,p as typeReferenceSymbol,m as typeReferenceText,Le as validateLines,ie as withoutComment};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["registeredInstances","monaco","languageId","createTokensProvider","getSubLanguages","onSubLanguagesChanged","getSubLanguage","registerSubLanguage","pdl","cdl","languageExtensionPoint","languageConfiguration","createCompletionProvider","options","createInlineCompletionProvider","createHoverProvider","word","model","position","symbols","reference","eventSourceReferenceAt","reaction","reactionReferenceAt","target","current","source","document","location","eventSourceIdentifier","targetUri","targetModels","candidate","targetModel","responseTokenTypes","data","previousLine","previousColumn","token","responseTokens","createInlayHintsProvider","createCodeActionProvider","screenplayDarkThemeName","screenplayDark","screenplayLightThemeName","screenplayLight","attachDiagnostics","analyzeEventSources","analyzeOperations","attributeDocs","blockHeaderPattern","builtInTriggerNames","causedByProperties","clauseKeywords","codeBlockTags","completionEntriesFor","conceptAttributes","constructKeywords","contextRoots","contextVariableDocs","contextVariableEntries","contextVariableItems","destinationHints","diagnosticCodes","enclosingChain","eventContextMemberAt","eventContextMembers","eventContextMembersAfter","eventContextPaths","eventSourceAvailability","eventSourceCompletions","eventSourceDetails","eventSourceHover","exampleCompletions","exampleHover","fenceMap","fileImportOn","fileImports","fileReferenceKeyword","fileReferenceOn","fileReferences","firstWord","hoverContent","importablePaths","indentOf","isAbsoluteFileReferencePath","isFileImportLine","keywordDocs","knownEventNames","knownTriggerNames","knownTypeNames","mergeSymbols","namesEventContextMember","operationAvailability","operationCompletions","operationDetails","operationHover","operationReferenceAt","phaseState","planCompletions","primitiveTypes","producesItems","productionDestinations","responseAnalysis","responseAvailability","responseCompletions","scanDocument","sliceTypes","specificationKeywordDocs","specificationStepItems","structureCompletion","symbolsForBuffer","typeReferenceSymbol","typeReferenceText","validateLines","withoutComment"],"sources":["../../index.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport {\n Monaco,\n languageConfiguration,\n languageExtensionPoint,\n languageId,\n} from './language';\nimport { createTokensProvider } from './tokens';\nimport { CompletionOptions, createCompletionProvider } from './completions';\nimport { createInlineCompletionProvider } from './inline-completions';\nimport { responseTokens, responseTokenTypes } from './response-tokens';\nimport { reactionReferenceAt } from './reaction-authoring';\nimport { createHoverProvider } from './hover';\nimport { createInlayHintsProvider } from './inlay-hints';\nimport { eventSourceIdentifier, eventSourceReferenceAt } from './event-source-authoring';\nimport { createCodeActionProvider } from './code-actions';\nimport { attachDiagnostics } from './diagnostics';\nimport {\n getSubLanguage,\n getSubLanguages,\n onSubLanguagesChanged,\n registerSubLanguage,\n} from './sub-language-registry';\nimport { pdl } from './sub-languages/pdl';\nimport { cdl } from './sub-languages/cdl';\nimport { screenplayDark, screenplayDarkThemeName } from './themes/screenplay-dark';\nimport { screenplayLight, screenplayLightThemeName } from './themes/screenplay-light';\n\nconst registeredInstances = new Set<Monaco>();\n\nfunction applyTokensProvider(monaco: Monaco): void {\n monaco.languages.setMonarchTokensProvider(languageId, createTokensProvider(getSubLanguages()));\n}\n\n// Sub-languages registered after register() recompose the tokenizer on the fly.\nonSubLanguagesChanged(() => registeredInstances.forEach(applyTokensProvider));\n\n// Registers the built-in PDL and CDL sub-languages. Hosts that do not go through\n// register() — such as the VSCode extension — call this before using the registry.\nexport function ensureBuiltInSubLanguages(): void {\n if (!getSubLanguage('projection')) registerSubLanguage('projection', pdl);\n if (!getSubLanguage('capture')) registerSubLanguage('capture', cdl);\n}\n\n// What a host can tell the language service beyond the models it holds.\nexport type LanguageServiceOptions = CompletionOptions;\n\nexport function register(monaco: Monaco, options: LanguageServiceOptions = {}): void {\n if (registeredInstances.has(monaco)) return;\n\n ensureBuiltInSubLanguages();\n\n registeredInstances.add(monaco);\n\n monaco.languages.register(languageExtensionPoint);\n monaco.languages.setLanguageConfiguration(languageId, languageConfiguration);\n applyTokensProvider(monaco);\n monaco.languages.registerCompletionItemProvider(languageId, createCompletionProvider(monaco, options));\n monaco.languages.registerInlineCompletionsProvider(languageId, createInlineCompletionProvider(options));\n monaco.languages.registerHoverProvider(languageId, createHoverProvider(options));\n monaco.languages.registerDefinitionProvider(languageId, {\n provideDefinition(model, position) {\n const word = model.getWordAtPosition(position);\n if (!word) return [];\n const symbols = options.application?.(model);\n const reference = eventSourceReferenceAt(model.getLinesContent(), position.lineNumber - 1, word.startColumn, word.endColumn, symbols);\n const reaction = reactionReferenceAt(model.getLinesContent(), position.lineNumber - 1, word.startColumn, word.endColumn, symbols);\n const target = reaction ? reaction.target : reference?.target;\n if (!target) return [];\n const current = symbols?.authoringPath ?? 'current.play';\n const source = target.location.path === current ? model.getValue() : symbols?.authoringDocuments?.find(document => document.path === target.location.path)?.source;\n const location = reaction ? reaction.target?.location : source && eventSourceIdentifier(target.location, target.name, source);\n if (!location) return [];\n // Foreign navigation requires an actual host model, not a guessed path or merged line.\n const targetUri = target.location.path && model.uri.path.endsWith(`/${current}`)\n ? model.uri.with({ path: model.uri.path.slice(0, -current.length) + target.location.path }) : undefined;\n const targetModels = targetUri ? monaco.editor.getModels().filter(candidate => candidate.uri.toString() === targetUri.toString()) : [];\n const targetModel = target.location.path === current ? model : targetModels.length === 1 ? targetModels[0] : undefined;\n return targetModel ? [{ uri: targetModel.uri, range: new monaco.Range(location.line, location.column, location.line, location.column + target.name.length) }] : [];\n }\n });\n monaco.languages.registerDocumentSemanticTokensProvider(languageId, {\n getLegend: () => ({ tokenTypes: [...responseTokenTypes], tokenModifiers: [] }),\n provideDocumentSemanticTokens(model) {\n const data: number[] = [];\n let previousLine = 0;\n let previousColumn = 0;\n for (const token of responseTokens(model.getLinesContent(), options.application?.(model))) {\n data.push(token.line - previousLine, token.line === previousLine ? token.column - previousColumn : token.column, token.length, token.type, 0);\n previousLine = token.line;\n previousColumn = token.column;\n }\n return { data: new Uint32Array(data) };\n },\n releaseDocumentSemanticTokens() {},\n });\n monaco.languages.registerInlayHintsProvider(languageId, createInlayHintsProvider(options));\n monaco.languages.registerCodeActionProvider(languageId, createCodeActionProvider());\n monaco.editor.defineTheme(screenplayDarkThemeName, screenplayDark);\n monaco.editor.defineTheme(screenplayLightThemeName, screenplayLight);\n attachDiagnostics(monaco, options);\n}\n\nexport { reactionReferenceAt } from './reaction-authoring';\n\nexport {\n causedByProperties,\n clauseKeywords,\n codeBlockTags,\n conceptAttributes,\n constructKeywords,\n contextRoots,\n languageId,\n primitiveTypes,\n sliceTypes,\n} from './language';\nexport type { Monaco } from './language';\nexport { getSubLanguage, getSubLanguages, registerSubLanguage } from './sub-language-registry';\nexport type {\n MonarchTokenRules,\n SubLanguage,\n SubLanguageCompletion,\n SubLanguageDefinition,\n} from './sub-language-registry';\nexport { pdl } from './sub-languages/pdl';\nexport { cdl } from './sub-languages/cdl';\nexport { screenplayDarkThemeName } from './themes/screenplay-dark';\nexport { screenplayLightThemeName } from './themes/screenplay-light';\nexport { enclosingChain, fenceMap, firstWord, indentOf, withoutComment } from './document-context';\nexport { exampleCompletions, exampleHover } from './example-authoring';\nexport {\n fileReferenceKeyword,\n fileReferenceOn,\n fileReferences,\n isAbsoluteFileReferencePath,\n} from './file-references';\nexport type { FileReference } from './file-references';\nexport { fileImportOn, fileImports, importablePaths, isFileImportLine } from './file-imports';\nexport type { FileImport } from './file-imports';\nexport type { CompletionOptions } from './completions';\nexport { builtInTriggerNames, knownEventNames, knownTriggerNames, knownTypeNames, mergeSymbols, scanDocument, symbolsForBuffer } from './symbols';\nexport type {\n CommandSymbol,\n ConceptSymbol,\n DocumentSymbols,\n EventSymbol,\n ImportSymbol,\n NamedSymbol,\n PolicySymbol,\n PropertySymbol,\n ReadSymbol,\n QuerySymbol,\n TypeSymbol,\n} from './symbols';\nexport { attributeDocs, contextVariableDocs, keywordDocs, specificationKeywordDocs } from './keyword-docs';\nexport { eventContextMemberAt, eventContextMembers, eventContextMembersAfter, eventContextPaths, namesEventContextMember } from './event-context';\nexport type { EventContextMember, EventContextPath } from './event-context';\nexport { contextVariableEntries, contextVariableItems, producesItems, specificationStepItems } from './completion-items';\nexport type { CompletionEntry } from './completion-items';\nexport { completionEntriesFor, planCompletions } from './completion-planner';\nexport type { CompletionPlan } from './completion-planner';\nexport { responseTokens, responseTokenTypes } from './response-tokens';\nexport { responseCompletions } from './response-completions';\nexport { structureCompletion } from './structure-completions';\nexport { blockHeaderPattern } from './language';\nexport type { StructureCompletion } from './structure-completions';\nexport { analyzeEventSources, eventSourceAvailability, eventSourceCompletions, eventSourceDetails, eventSourceHover, eventSourceIdentifier, eventSourceReferenceAt } from './event-source-authoring';\nexport type { EventSourceAnalysis } from './EventSourceAnalysis';\nexport type { AuthoredEventSource } from './AuthoredEventSource';\nexport type { AuthoredStream } from './AuthoredStream';\nexport type { AuthoredCommandRoute } from './AuthoredCommandRoute';\nexport type { AuthoredSpecificationEvent } from './AuthoredSpecificationEvent';\nexport { analyzeOperations, operationCompletions, operationDetails, operationAvailability, operationHover, operationReferenceAt, phaseState } from './operation-authoring';\nexport type { OperationAnalysis, OperationDeclaration, OperationInput, OperationPhase, OperationReference, SystemDeclaration } from './OperationAnalysis';\nexport { responseAvailability, responseAnalysis } from './response-analysis';\nexport { hoverContent } from './hover-content';\nexport { validateLines } from './validation';\nexport { destinationHints, productionDestinations } from './production-destinations';\nexport type { DestinationHint } from './DestinationHint';\nexport type { ProductionSymbol } from './ProductionSymbol';\nexport type { ValidationContext, ValidationIssue, ValidationSeverity } from './validation';\nexport { createCodeActionProvider } from './code-actions';\nexport { typeReferenceSymbol, typeReferenceText } from './TypeReferenceSymbol';\nexport type { TypeReferenceSymbol } from './TypeReferenceSymbol';\nexport { diagnosticCodes } from './diagnostic-codes';\nexport type { DiagnosticCode } from './diagnostic-codes';\n"],"mappings":"83GA8BA,MAAMA,kBAAsB,IAAI,IAEhC,SAAS,oBAAoB,EAAsB,CAC/CC,EAAO,UAAU,yBAAyBC,EAAYC,EAAqBC,EAAgB,CAAC,CAAC,CACjG,CAGAC,OAA4BL,EAAoB,QAAQ,mBAAmB,CAAC,EAI5E,SAAg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,2BAA2BC,EAAYuC,EAAyB,CAAC,EAClFxC,EAAO,OAAO,YAAYyC,EAAyBC,EAAc,EACjE1C,EAAO,OAAO,YAAY2C,EAA0BC,EAAe,EACnEC,GAAkB7C,EAAQY,CAAO,EACrC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["registeredInstances","monaco","languageId","createTokensProvider","getSubLanguages","onSubLanguagesChanged","getSubLanguage","registerSubLanguage","pdl","cdl","languageExtensionPoint","languageConfiguration","createCompletionProvider","options","createInlineCompletionProvider","createHoverProvider","word","model","position","symbols","reference","eventSourceReferenceAt","reaction","reactionReferenceAt","target","current","source","document","location","eventSourceIdentifier","targetUri","targetModels","candidate","targetModel","responseTokenTypes","data","previousLine","previousColumn","token","responseTokens","createInlayHintsProvider","createCodeActionProvider","screenplayDarkThemeName","screenplayDark","screenplayLightThemeName","screenplayLight","attachDiagnostics","analyzeEventSources","analyzeOperations","attributeDocs","blockHeaderPattern","builtInTriggerNames","causedByProperties","clauseKeywords","codeBlockTags","completionEntriesFor","conceptAttributes","constructKeywords","contextRoots","contextVariableDocs","contextVariableEntries","contextVariableItems","declarationHeaders","destinationHints","diagnosticCodes","enclosingChain","eventContextMemberAt","eventContextMembers","eventContextMembersAfter","eventContextPaths","eventSourceAvailability","eventSourceCompletions","eventSourceDetails","eventSourceHover","exampleCompletions","exampleHover","fenceMap","fileImportOn","fileImports","fileReferenceKeyword","fileReferenceOn","fileReferences","firstWord","hoverContent","importablePaths","indentOf","isAbsoluteFileReferencePath","isFileImportLine","keywordDocs","knownEventNames","knownTriggerNames","knownTypeNames","mergeSymbols","namesEventContextMember","operationAvailability","operationCompletions","operationDetails","operationHover","operationReferenceAt","phaseState","planCompletions","primitiveTypes","producesItems","productionDestinations","responseAnalysis","responseAvailability","responseCompletions","scanDocument","sliceTypes","specificationKeywordDocs","specificationStepItems","structureCompletion","symbolsForBuffer","typeReferenceSymbol","typeReferenceText","validateLines","withoutComment"],"sources":["../../index.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport {\n Monaco,\n languageConfiguration,\n languageExtensionPoint,\n languageId,\n} from './language';\nimport { createTokensProvider } from './tokens';\nimport { CompletionOptions, createCompletionProvider } from './completions';\nimport { createInlineCompletionProvider } from './inline-completions';\nimport { responseTokens, responseTokenTypes } from './response-tokens';\nimport { reactionReferenceAt } from './reaction-authoring';\nimport { createHoverProvider } from './hover';\nimport { createInlayHintsProvider } from './inlay-hints';\nimport { eventSourceIdentifier, eventSourceReferenceAt } from './event-source-authoring';\nimport { createCodeActionProvider } from './code-actions';\nimport { attachDiagnostics } from './diagnostics';\nimport {\n getSubLanguage,\n getSubLanguages,\n onSubLanguagesChanged,\n registerSubLanguage,\n} from './sub-language-registry';\nimport { pdl } from './sub-languages/pdl';\nimport { cdl } from './sub-languages/cdl';\nimport { screenplayDark, screenplayDarkThemeName } from './themes/screenplay-dark';\nimport { screenplayLight, screenplayLightThemeName } from './themes/screenplay-light';\n\nconst registeredInstances = new Set<Monaco>();\n\nfunction applyTokensProvider(monaco: Monaco): void {\n monaco.languages.setMonarchTokensProvider(languageId, createTokensProvider(getSubLanguages()));\n}\n\n// Sub-languages registered after register() recompose the tokenizer on the fly.\nonSubLanguagesChanged(() => registeredInstances.forEach(applyTokensProvider));\n\n// Registers the built-in PDL and CDL sub-languages. Hosts that do not go through\n// register() — such as the VSCode extension — call this before using the registry.\nexport function ensureBuiltInSubLanguages(): void {\n if (!getSubLanguage('projection')) registerSubLanguage('projection', pdl);\n if (!getSubLanguage('capture')) registerSubLanguage('capture', cdl);\n}\n\n// What a host can tell the language service beyond the models it holds.\nexport type LanguageServiceOptions = CompletionOptions;\n\nexport function register(monaco: Monaco, options: LanguageServiceOptions = {}): void {\n if (registeredInstances.has(monaco)) return;\n\n ensureBuiltInSubLanguages();\n\n registeredInstances.add(monaco);\n\n monaco.languages.register(languageExtensionPoint);\n monaco.languages.setLanguageConfiguration(languageId, languageConfiguration);\n applyTokensProvider(monaco);\n monaco.languages.registerCompletionItemProvider(languageId, createCompletionProvider(monaco, options));\n monaco.languages.registerInlineCompletionsProvider(languageId, createInlineCompletionProvider(options));\n monaco.languages.registerHoverProvider(languageId, createHoverProvider(options));\n monaco.languages.registerDefinitionProvider(languageId, {\n provideDefinition(model, position) {\n const word = model.getWordAtPosition(position);\n if (!word) return [];\n const symbols = options.application?.(model);\n const reference = eventSourceReferenceAt(model.getLinesContent(), position.lineNumber - 1, word.startColumn, word.endColumn, symbols);\n const reaction = reactionReferenceAt(model.getLinesContent(), position.lineNumber - 1, word.startColumn, word.endColumn, symbols);\n const target = reaction ? reaction.target : reference?.target;\n if (!target) return [];\n const current = symbols?.authoringPath ?? 'current.play';\n const source = target.location.path === current ? model.getValue() : symbols?.authoringDocuments?.find(document => document.path === target.location.path)?.source;\n const location = reaction ? reaction.target?.location : source && eventSourceIdentifier(target.location, target.name, source);\n if (!location) return [];\n // Foreign navigation requires an actual host model, not a guessed path or merged line.\n const targetUri = target.location.path && model.uri.path.endsWith(`/${current}`)\n ? model.uri.with({ path: model.uri.path.slice(0, -current.length) + target.location.path }) : undefined;\n const targetModels = targetUri ? monaco.editor.getModels().filter(candidate => candidate.uri.toString() === targetUri.toString()) : [];\n const targetModel = target.location.path === current ? model : targetModels.length === 1 ? targetModels[0] : undefined;\n return targetModel ? [{ uri: targetModel.uri, range: new monaco.Range(location.line, location.column, location.line, location.column + target.name.length) }] : [];\n }\n });\n monaco.languages.registerDocumentSemanticTokensProvider(languageId, {\n getLegend: () => ({ tokenTypes: [...responseTokenTypes], tokenModifiers: [] }),\n provideDocumentSemanticTokens(model) {\n const data: number[] = [];\n let previousLine = 0;\n let previousColumn = 0;\n for (const token of responseTokens(model.getLinesContent(), options.application?.(model))) {\n data.push(token.line - previousLine, token.line === previousLine ? token.column - previousColumn : token.column, token.length, token.type, 0);\n previousLine = token.line;\n previousColumn = token.column;\n }\n return { data: new Uint32Array(data) };\n },\n releaseDocumentSemanticTokens() {},\n });\n monaco.languages.registerInlayHintsProvider(languageId, createInlayHintsProvider(options));\n monaco.languages.registerCodeActionProvider(languageId, createCodeActionProvider());\n monaco.editor.defineTheme(screenplayDarkThemeName, screenplayDark);\n monaco.editor.defineTheme(screenplayLightThemeName, screenplayLight);\n attachDiagnostics(monaco, options);\n}\n\nexport { reactionReferenceAt } from './reaction-authoring';\n\nexport {\n causedByProperties,\n clauseKeywords,\n codeBlockTags,\n conceptAttributes,\n constructKeywords,\n contextRoots,\n languageId,\n primitiveTypes,\n sliceTypes,\n} from './language';\nexport type { Monaco } from './language';\nexport { getSubLanguage, getSubLanguages, registerSubLanguage } from './sub-language-registry';\nexport type {\n MonarchTokenRules,\n SubLanguage,\n SubLanguageCompletion,\n SubLanguageDefinition,\n} from './sub-language-registry';\nexport { pdl } from './sub-languages/pdl';\nexport { cdl } from './sub-languages/cdl';\nexport { screenplayDarkThemeName } from './themes/screenplay-dark';\nexport { screenplayLightThemeName } from './themes/screenplay-light';\nexport { enclosingChain, fenceMap, firstWord, indentOf, withoutComment } from './document-context';\nexport { exampleCompletions, exampleHover } from './example-authoring';\nexport {\n fileReferenceKeyword,\n fileReferenceOn,\n fileReferences,\n isAbsoluteFileReferencePath,\n} from './file-references';\nexport type { FileReference } from './file-references';\nexport { fileImportOn, fileImports, importablePaths, isFileImportLine } from './file-imports';\nexport type { FileImport } from './file-imports';\nexport type { CompletionOptions } from './completions';\nexport { declarationHeaders, type DeclarationHeader } from './declarations';\nexport { builtInTriggerNames, knownEventNames, knownTriggerNames, knownTypeNames, mergeSymbols, scanDocument, symbolsForBuffer } from './symbols';\nexport type {\n CommandSymbol,\n ConceptSymbol,\n DocumentSymbols,\n EventSymbol,\n ImportSymbol,\n NamedSymbol,\n PolicySymbol,\n PropertySymbol,\n ReadSymbol,\n QuerySymbol,\n TypeSymbol,\n} from './symbols';\nexport { attributeDocs, contextVariableDocs, keywordDocs, specificationKeywordDocs } from './keyword-docs';\nexport { eventContextMemberAt, eventContextMembers, eventContextMembersAfter, eventContextPaths, namesEventContextMember } from './event-context';\nexport type { EventContextMember, EventContextPath } from './event-context';\nexport { contextVariableEntries, contextVariableItems, producesItems, specificationStepItems } from './completion-items';\nexport type { CompletionEntry } from './completion-items';\nexport { completionEntriesFor, planCompletions } from './completion-planner';\nexport type { CompletionPlan } from './completion-planner';\nexport { responseTokens, responseTokenTypes } from './response-tokens';\nexport { responseCompletions } from './response-completions';\nexport { structureCompletion } from './structure-completions';\nexport { blockHeaderPattern } from './language';\nexport type { StructureCompletion } from './structure-completions';\nexport { analyzeEventSources, eventSourceAvailability, eventSourceCompletions, eventSourceDetails, eventSourceHover, eventSourceIdentifier, eventSourceReferenceAt } from './event-source-authoring';\nexport type { EventSourceAnalysis } from './EventSourceAnalysis';\nexport type { AuthoredEventSource } from './AuthoredEventSource';\nexport type { AuthoredStream } from './AuthoredStream';\nexport type { AuthoredCommandRoute } from './AuthoredCommandRoute';\nexport type { AuthoredSpecificationEvent } from './AuthoredSpecificationEvent';\nexport { analyzeOperations, operationCompletions, operationDetails, operationAvailability, operationHover, operationReferenceAt, phaseState } from './operation-authoring';\nexport type { OperationAnalysis, OperationDeclaration, OperationInput, OperationPhase, OperationReference, SystemDeclaration } from './OperationAnalysis';\nexport { responseAvailability, responseAnalysis } from './response-analysis';\nexport { hoverContent } from './hover-content';\nexport { validateLines } from './validation';\nexport { destinationHints, productionDestinations } from './production-destinations';\nexport type { DestinationHint } from './DestinationHint';\nexport type { ProductionSymbol } from './ProductionSymbol';\nexport type { ValidationContext, ValidationIssue, ValidationSeverity } from './validation';\nexport { createCodeActionProvider } from './code-actions';\nexport { typeReferenceSymbol, typeReferenceText } from './TypeReferenceSymbol';\nexport type { TypeReferenceSymbol } from './TypeReferenceSymbol';\nexport { diagnosticCodes } from './diagnostic-codes';\nexport type { DiagnosticCode } from './diagnostic-codes';\n"],"mappings":"s7GA8BA,MAAMA,kBAAsB,IAAI,IAEhC,SAAS,oBAAoB,EAAsB,CAC/CC,EAA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