@cratis/screenplay-language 4.123.0 → 4.124.1
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/README.md +50 -0
- package/dist/bundles/TypeReferenceSymbol.js +2 -0
- package/dist/bundles/TypeReferenceSymbol.js.map +1 -0
- package/dist/bundles/_virtual/_virtual/_rolldown/runtime.js +1 -0
- package/dist/bundles/bmp-word-characters.js +2 -0
- package/dist/bundles/bmp-word-characters.js.map +1 -0
- package/dist/bundles/case-authoring.js +3 -0
- package/dist/bundles/case-authoring.js.map +1 -0
- package/dist/bundles/code-actions.js +2 -0
- package/dist/bundles/code-actions.js.map +1 -0
- package/dist/bundles/compiler/Authoring/QuickFixes.js +5 -0
- package/dist/bundles/compiler/Authoring/QuickFixes.js.map +1 -0
- package/dist/bundles/compiler/Dependencies/DeclaredDependencies.js +2 -0
- package/dist/bundles/compiler/Dependencies/DeclaredDependencies.js.map +1 -0
- package/dist/bundles/compiler/Dependencies/DeclaredDependencyTargets.js +2 -0
- package/dist/bundles/compiler/Dependencies/DeclaredDependencyTargets.js.map +1 -0
- package/dist/bundles/compiler/Dependencies/DependencyGraph.js +2 -0
- package/dist/bundles/compiler/Dependencies/DependencyGraph.js.map +1 -0
- package/dist/bundles/compiler/Dependencies/DependencyKind.js +2 -0
- package/dist/bundles/compiler/Dependencies/DependencyKind.js.map +1 -0
- package/dist/bundles/compiler/Dependencies/InvalidDependencyQuery.js +2 -0
- package/dist/bundles/compiler/Dependencies/InvalidDependencyQuery.js.map +1 -0
- package/dist/bundles/compiler/Dependencies/SliceReferences.js +2 -0
- package/dist/bundles/compiler/Dependencies/SliceReferences.js.map +1 -0
- package/dist/bundles/compiler/Dependencies/StronglyConnectedGroups.js +2 -0
- package/dist/bundles/compiler/Dependencies/StronglyConnectedGroups.js.map +1 -0
- package/dist/bundles/compiler/Dependencies/index.js +1 -0
- package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js +2 -0
- package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js.map +1 -0
- package/dist/bundles/compiler/Diagnostics/ProductionDestinationDiagnostics.js +2 -0
- package/dist/bundles/compiler/Diagnostics/ProductionDestinationDiagnostics.js.map +1 -0
- package/dist/bundles/compiler/Diagnostics/SourceLocation.js +2 -0
- package/dist/bundles/compiler/Diagnostics/SourceLocation.js.map +1 -0
- package/dist/bundles/compiler/Files/AuthoredOrder.js +2 -0
- package/dist/bundles/compiler/Files/AuthoredOrder.js.map +1 -0
- package/dist/bundles/compiler/Files/OrderingRoot.js +1 -0
- package/dist/bundles/compiler/Files/PlayApplicationAssembly.js +2 -0
- package/dist/bundles/compiler/Files/PlayApplicationAssembly.js.map +1 -0
- package/dist/bundles/compiler/Files/PlayFolderMerge.js +2 -0
- package/dist/bundles/compiler/Files/PlayFolderMerge.js.map +1 -0
- package/dist/bundles/compiler/Files/PlayImports.js +1 -0
- package/dist/bundles/compiler/Files/PlayPlacement.js +2 -0
- package/dist/bundles/compiler/Files/PlayPlacement.js.map +1 -0
- package/dist/bundles/compiler/Files/TimelineOrder.js +2 -0
- package/dist/bundles/compiler/Files/TimelineOrder.js.map +1 -0
- package/dist/bundles/compiler/Parsing/AuthorizeParser.js +2 -0
- package/dist/bundles/compiler/Parsing/AuthorizeParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/CaptureParser.js +2 -0
- package/dist/bundles/compiler/Parsing/CaptureParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/CodeBlockParser.js +3 -0
- package/dist/bundles/compiler/Parsing/CodeBlockParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/CommandDestinationTypes.js +2 -0
- package/dist/bundles/compiler/Parsing/CommandDestinationTypes.js.map +1 -0
- package/dist/bundles/compiler/Parsing/CommandParser.js +2 -0
- package/dist/bundles/compiler/Parsing/CommandParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/CommandReadSources.js +2 -0
- package/dist/bundles/compiler/Parsing/CommandReadSources.js.map +1 -0
- package/dist/bundles/compiler/Parsing/CommandResponseParser.js +2 -0
- package/dist/bundles/compiler/Parsing/CommandResponseParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/CommandStreamCandidates.js +2 -0
- package/dist/bundles/compiler/Parsing/CommandStreamCandidates.js.map +1 -0
- package/dist/bundles/compiler/Parsing/CompositeStreamIdValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/CompositeStreamIdValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/CompositionParser.js +2 -0
- package/dist/bundles/compiler/Parsing/CompositionParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ConceptComplianceParser.js +2 -0
- package/dist/bundles/compiler/Parsing/ConceptComplianceParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ConditionParser.js +2 -0
- package/dist/bundles/compiler/Parsing/ConditionParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ConstraintParser.js +2 -0
- package/dist/bundles/compiler/Parsing/ConstraintParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ConstraintPropertyValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/ConstraintPropertyValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/DeclarationParsers.js +2 -0
- package/dist/bundles/compiler/Parsing/DeclarationParsers.js.map +1 -0
- package/dist/bundles/compiler/Parsing/DependencySourceParser.js +2 -0
- package/dist/bundles/compiler/Parsing/DependencySourceParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/DependsOnParser.js +2 -0
- package/dist/bundles/compiler/Parsing/DependsOnParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/DescriptionParser.js +2 -0
- package/dist/bundles/compiler/Parsing/DescriptionParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/DocumentationParser.js +2 -0
- package/dist/bundles/compiler/Parsing/DocumentationParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/EventMetadataParser.js +2 -0
- package/dist/bundles/compiler/Parsing/EventMetadataParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/EventSourceParser.js +2 -0
- package/dist/bundles/compiler/Parsing/EventSourceParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/EventSourceValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/EventSourceValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/EventSubjectValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/EventSubjectValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ExpressionParser.js +2 -0
- package/dist/bundles/compiler/Parsing/ExpressionParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/FeatureBody.js +2 -0
- package/dist/bundles/compiler/Parsing/FeatureBody.js.map +1 -0
- package/dist/bundles/compiler/Parsing/FileImportParser.js +2 -0
- package/dist/bundles/compiler/Parsing/FileImportParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/FileReferences.js +2 -0
- package/dist/bundles/compiler/Parsing/FileReferences.js.map +1 -0
- package/dist/bundles/compiler/Parsing/GuardedActionParser.js +2 -0
- package/dist/bundles/compiler/Parsing/GuardedActionParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/GuardedActionShadowing.js +2 -0
- package/dist/bundles/compiler/Parsing/GuardedActionShadowing.js.map +1 -0
- package/dist/bundles/compiler/Parsing/GuardedActionValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/GuardedActionValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/IdentifierComplianceValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/IdentifierComplianceValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/IdentityParser.js +2 -0
- package/dist/bundles/compiler/Parsing/IdentityParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/IdentityValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/IdentityValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ImplementationParser.js +3 -0
- package/dist/bundles/compiler/Parsing/ImplementationParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ImportDiscovery.js +1 -0
- package/dist/bundles/compiler/Parsing/InlineEventValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/InlineEventValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/InputUses.js +2 -0
- package/dist/bundles/compiler/Parsing/InputUses.js.map +1 -0
- package/dist/bundles/compiler/Parsing/InteractionAlternatives.js +2 -0
- package/dist/bundles/compiler/Parsing/InteractionAlternatives.js.map +1 -0
- package/dist/bundles/compiler/Parsing/LineReader.js +2 -0
- package/dist/bundles/compiler/Parsing/LineReader.js.map +1 -0
- package/dist/bundles/compiler/Parsing/LineText.js +2 -0
- package/dist/bundles/compiler/Parsing/LineText.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ModuleBody.js +2 -0
- package/dist/bundles/compiler/Parsing/ModuleBody.js.map +1 -0
- package/dist/bundles/compiler/Parsing/OperationParser.js +2 -0
- package/dist/bundles/compiler/Parsing/OperationParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/OperationValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/OperationValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ParserContext.js +2 -0
- package/dist/bundles/compiler/Parsing/ParserContext.js.map +1 -0
- package/dist/bundles/compiler/Parsing/PersonaCallerValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/PersonaCallerValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/PolicyParser.js +2 -0
- package/dist/bundles/compiler/Parsing/PolicyParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ProducesParser.js +2 -0
- package/dist/bundles/compiler/Parsing/ProducesParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ProjectionExpressionParser.js +2 -0
- package/dist/bundles/compiler/Parsing/ProjectionExpressionParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ProjectionParser.js +2 -0
- package/dist/bundles/compiler/Parsing/ProjectionParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ProjectionTargetValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/ProjectionTargetValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/PropertyLineParser.js +2 -0
- package/dist/bundles/compiler/Parsing/PropertyLineParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/PublicEventMetadataValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/PublicEventMetadataValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/PublicEventUsageCollector.js +2 -0
- package/dist/bundles/compiler/Parsing/PublicEventUsageCollector.js.map +1 -0
- package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/PurposeParser.js +2 -0
- package/dist/bundles/compiler/Parsing/PurposeParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/PurposeValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/PurposeValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/QueryParser.js +2 -0
- package/dist/bundles/compiler/Parsing/QueryParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ReactionIdentityParser.js +2 -0
- package/dist/bundles/compiler/Parsing/ReactionIdentityParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ReactionParser.js +2 -0
- package/dist/bundles/compiler/Parsing/ReactionParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ReactionRefusalValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/ReactionRefusalValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/RedeliveryValues.js +2 -0
- package/dist/bundles/compiler/Parsing/RedeliveryValues.js.map +1 -0
- package/dist/bundles/compiler/Parsing/RefusalDeclarations.js +2 -0
- package/dist/bundles/compiler/Parsing/RefusalDeclarations.js.map +1 -0
- package/dist/bundles/compiler/Parsing/RefusalValueWalker.js +2 -0
- package/dist/bundles/compiler/Parsing/RefusalValueWalker.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ResponseDateValues.js +2 -0
- package/dist/bundles/compiler/Parsing/ResponseDateValues.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ResponseValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/ResponseValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ScreenParser.js +2 -0
- package/dist/bundles/compiler/Parsing/ScreenParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ScreenplayParser.js +2 -0
- package/dist/bundles/compiler/Parsing/ScreenplayParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SeedParser.js +2 -0
- package/dist/bundles/compiler/Parsing/SeedParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SliceParser.js +2 -0
- package/dist/bundles/compiler/Parsing/SliceParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SourceLine.js +2 -0
- package/dist/bundles/compiler/Parsing/SourceLine.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SourceLineSplitter.js +3 -0
- package/dist/bundles/compiler/Parsing/SourceLineSplitter.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SourceOptionsParser.js +2 -0
- package/dist/bundles/compiler/Parsing/SourceOptionsParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SpecificationCaseParser.js +2 -0
- package/dist/bundles/compiler/Parsing/SpecificationCaseParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SpecificationCaseValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/SpecificationCaseValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SpecificationCommandExamples.js +2 -0
- package/dist/bundles/compiler/Parsing/SpecificationCommandExamples.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SpecificationExampleParser.js +2 -0
- package/dist/bundles/compiler/Parsing/SpecificationExampleParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SpecificationParser.js +2 -0
- package/dist/bundles/compiler/Parsing/SpecificationParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SpecificationRedeliveryValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/SpecificationRedeliveryValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SpecificationResponseParser.js +2 -0
- package/dist/bundles/compiler/Parsing/SpecificationResponseParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SpecificationRouteComparison.js +2 -0
- package/dist/bundles/compiler/Parsing/SpecificationRouteComparison.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SpecificationStreamValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/SpecificationStreamValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/StructuredValueParser.js +3 -0
- package/dist/bundles/compiler/Parsing/StructuredValueParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/TriggerDataParser.js +2 -0
- package/dist/bundles/compiler/Parsing/TriggerDataParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/UiBindingParser.js +2 -0
- package/dist/bundles/compiler/Parsing/UiBindingParser.js.map +1 -0
- package/dist/bundles/compiler/ScreenplayCompiler.js +2 -0
- package/dist/bundles/compiler/ScreenplayCompiler.js.map +1 -0
- package/dist/bundles/compiler/Syntax/AuthoringProductionResolver.js +2 -0
- package/dist/bundles/compiler/Syntax/AuthoringProductionResolver.js.map +1 -0
- package/dist/bundles/compiler/Syntax/CaptureEventsSource.js +2 -0
- package/dist/bundles/compiler/Syntax/CaptureEventsSource.js.map +1 -0
- package/dist/bundles/compiler/Syntax/DependencySources.js +2 -0
- package/dist/bundles/compiler/Syntax/DependencySources.js.map +1 -0
- package/dist/bundles/compiler/Syntax/EventDeclarations.js +2 -0
- package/dist/bundles/compiler/Syntax/EventDeclarations.js.map +1 -0
- package/dist/bundles/compiler/Syntax/EventSourceCatalog.js +2 -0
- package/dist/bundles/compiler/Syntax/EventSourceCatalog.js.map +1 -0
- package/dist/bundles/compiler/Syntax/EventSourceReadConfidence.js +2 -0
- package/dist/bundles/compiler/Syntax/EventSourceReadConfidence.js.map +1 -0
- package/dist/bundles/compiler/Syntax/ExactMathFacts.js +2 -0
- package/dist/bundles/compiler/Syntax/ExactMathFacts.js.map +1 -0
- package/dist/bundles/compiler/Syntax/ExactNumber.js +2 -0
- package/dist/bundles/compiler/Syntax/ExactNumber.js.map +1 -0
- package/dist/bundles/compiler/Syntax/InvalidSyntaxJson.js +2 -0
- package/dist/bundles/compiler/Syntax/InvalidSyntaxJson.js.map +1 -0
- package/dist/bundles/compiler/Syntax/LegacyWireProjection.js +2 -0
- package/dist/bundles/compiler/Syntax/LegacyWireProjection.js.map +1 -0
- package/dist/bundles/compiler/Syntax/Operations.js +2 -0
- package/dist/bundles/compiler/Syntax/Operations.js.map +1 -0
- package/dist/bundles/compiler/Syntax/PersonaCallers.js +2 -0
- package/dist/bundles/compiler/Syntax/PersonaCallers.js.map +1 -0
- package/dist/bundles/compiler/Syntax/ProductionDestinations.js +2 -0
- package/dist/bundles/compiler/Syntax/ProductionDestinations.js.map +1 -0
- package/dist/bundles/compiler/Syntax/PublicEventInvariants.js +2 -0
- package/dist/bundles/compiler/Syntax/PublicEventInvariants.js.map +1 -0
- package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js +2 -0
- package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js.map +1 -0
- package/dist/bundles/compiler/Syntax/SourceOptions.js +2 -0
- package/dist/bundles/compiler/Syntax/SourceOptions.js.map +1 -0
- package/dist/bundles/compiler/Syntax/SpecificationCaseOrigin.js +2 -0
- package/dist/bundles/compiler/Syntax/SpecificationCaseOrigin.js.map +1 -0
- package/dist/bundles/compiler/Syntax/StreamIdFormatter.js +2 -0
- package/dist/bundles/compiler/Syntax/StreamIdFormatter.js.map +1 -0
- package/dist/bundles/compiler/Syntax/StrictSyntaxJson.js +1 -0
- package/dist/bundles/compiler/Syntax/Structure.js +2 -0
- package/dist/bundles/compiler/Syntax/Structure.js.map +1 -0
- package/dist/bundles/compiler/Syntax/SyntaxCollections.js +2 -0
- package/dist/bundles/compiler/Syntax/SyntaxCollections.js.map +1 -0
- package/dist/bundles/compiler/Syntax/SyntaxInvariants.js +2 -0
- package/dist/bundles/compiler/Syntax/SyntaxInvariants.js.map +1 -0
- package/dist/bundles/compiler/Syntax/SyntaxJson.js +2 -0
- package/dist/bundles/compiler/Syntax/SyntaxJson.js.map +1 -0
- package/dist/bundles/compiler/Syntax/SyntaxMemberContracts.js +2 -0
- package/dist/bundles/compiler/Syntax/SyntaxMemberContracts.js.map +1 -0
- package/dist/bundles/compiler/Syntax/index.js +1 -0
- package/dist/bundles/compiler/Text/ImplementationHintText.js +2 -0
- package/dist/bundles/compiler/Text/ImplementationHintText.js.map +1 -0
- package/dist/bundles/compiler/Text/ReservedWords.js +2 -0
- package/dist/bundles/compiler/Text/ReservedWords.js.map +1 -0
- package/dist/bundles/compiler/Text/SourceStreamNames.js +2 -0
- package/dist/bundles/compiler/Text/SourceStreamNames.js.map +1 -0
- package/dist/bundles/compiler/Text/StringLiteral.js +3 -0
- package/dist/bundles/compiler/Text/StringLiteral.js.map +1 -0
- package/dist/bundles/compiler/Text/ordinalIgnoreCaseKey.js +2 -0
- package/dist/bundles/compiler/Text/ordinalIgnoreCaseKey.js.map +1 -0
- package/dist/bundles/compiler/Text/patterns.js +2 -0
- package/dist/bundles/compiler/Text/patterns.js.map +1 -0
- package/dist/bundles/compiler/index.js +1 -0
- package/dist/bundles/completion-items.js +21 -0
- package/dist/bundles/completion-items.js.map +1 -0
- package/dist/bundles/completion-planner.js +5 -0
- package/dist/bundles/completion-planner.js.map +1 -0
- package/dist/bundles/completions.js +2 -0
- package/dist/bundles/completions.js.map +1 -0
- package/dist/bundles/dependency-completions.js +3 -0
- package/dist/bundles/dependency-completions.js.map +1 -0
- package/dist/bundles/dependency-target-analysis.js +2 -0
- package/dist/bundles/dependency-target-analysis.js.map +1 -0
- package/dist/bundles/diagnostic-codes.js +2 -0
- package/dist/bundles/diagnostic-codes.js.map +1 -0
- package/dist/bundles/diagnostics.js +2 -0
- package/dist/bundles/diagnostics.js.map +1 -0
- package/dist/bundles/document-context.js +2 -0
- package/dist/bundles/document-context.js.map +1 -0
- package/dist/bundles/documentation-item.js +2 -0
- package/dist/bundles/documentation-item.js.map +1 -0
- package/dist/bundles/event-analysis-source.js +2 -0
- package/dist/bundles/event-analysis-source.js.map +1 -0
- package/dist/bundles/event-context-catalog.js +2 -0
- package/dist/bundles/event-context-catalog.js.map +1 -0
- package/dist/bundles/event-context.js +4 -0
- package/dist/bundles/event-context.js.map +1 -0
- package/dist/bundles/event-source-authoring.js +13 -0
- package/dist/bundles/event-source-authoring.js.map +1 -0
- package/dist/bundles/example-analysis.js +3 -0
- package/dist/bundles/example-analysis.js.map +1 -0
- package/dist/bundles/example-authoring.js +3 -0
- package/dist/bundles/example-authoring.js.map +1 -0
- package/dist/bundles/example-declaration-items.js +2 -0
- package/dist/bundles/example-declaration-items.js.map +1 -0
- package/dist/bundles/example-values.js +2 -0
- package/dist/bundles/example-values.js.map +1 -0
- package/dist/bundles/file-imports.js +2 -0
- package/dist/bundles/file-imports.js.map +1 -0
- package/dist/bundles/file-references.js +2 -0
- package/dist/bundles/file-references.js.map +1 -0
- package/dist/bundles/hover-content.js +6 -0
- package/dist/bundles/hover-content.js.map +1 -0
- package/dist/bundles/hover.js +2 -0
- package/dist/bundles/hover.js.map +1 -0
- package/dist/bundles/index.js +2 -104
- package/dist/bundles/index.js.map +1 -7
- package/dist/bundles/inlay-hints.js +2 -0
- package/dist/bundles/inlay-hints.js.map +1 -0
- package/dist/bundles/inline-completions.js +2 -0
- package/dist/bundles/inline-completions.js.map +1 -0
- package/dist/bundles/inline-event-validation.js +2 -0
- package/dist/bundles/inline-event-validation.js.map +1 -0
- package/dist/bundles/keyword-docs.js +2 -0
- package/dist/bundles/keyword-docs.js.map +1 -0
- package/dist/bundles/language.js +2 -0
- package/dist/bundles/language.js.map +1 -0
- package/dist/bundles/named-rule-context.js +2 -0
- package/dist/bundles/named-rule-context.js.map +1 -0
- package/dist/bundles/operation-authoring.js +7 -0
- package/dist/bundles/operation-authoring.js.map +1 -0
- package/dist/bundles/persona-analysis.js +2 -0
- package/dist/bundles/persona-analysis.js.map +1 -0
- package/dist/bundles/production-destinations.js +2 -0
- package/dist/bundles/production-destinations.js.map +1 -0
- package/dist/bundles/purpose-items.js +2 -0
- package/dist/bundles/purpose-items.js.map +1 -0
- package/dist/bundles/reaction-authoring.js +5 -0
- package/dist/bundles/reaction-authoring.js.map +1 -0
- package/dist/bundles/refusal-context.js +2 -0
- package/dist/bundles/refusal-context.js.map +1 -0
- package/dist/bundles/response-analysis.js +7 -0
- package/dist/bundles/response-analysis.js.map +1 -0
- package/dist/bundles/response-completions.js +2 -0
- package/dist/bundles/response-completions.js.map +1 -0
- package/dist/bundles/response-tokens.js +3 -0
- package/dist/bundles/response-tokens.js.map +1 -0
- package/dist/bundles/scope-items.js +18 -0
- package/dist/bundles/scope-items.js.map +1 -0
- package/dist/bundles/structure-completions.js +7 -0
- package/dist/bundles/structure-completions.js.map +1 -0
- package/dist/bundles/sub-language-registry.js +2 -0
- package/dist/bundles/sub-language-registry.js.map +1 -0
- package/dist/bundles/sub-languages/capture/CompletionProvider.js +2 -0
- package/dist/bundles/sub-languages/capture/CompletionProvider.js.map +1 -0
- package/dist/bundles/sub-languages/capture/HoverProvider.js +60 -0
- package/dist/bundles/sub-languages/capture/HoverProvider.js.map +1 -0
- package/dist/bundles/sub-languages/capture/Validator.js +2 -0
- package/dist/bundles/sub-languages/capture/Validator.js.map +1 -0
- package/dist/bundles/sub-languages/capture/index.js +2 -40
- package/dist/bundles/sub-languages/capture/index.js.map +1 -7
- package/dist/bundles/sub-languages/capture/language.js +2 -0
- package/dist/bundles/sub-languages/capture/language.js.map +1 -0
- package/dist/bundles/sub-languages/cdl.js +2 -0
- package/dist/bundles/sub-languages/cdl.js.map +1 -0
- package/dist/bundles/sub-languages/pdl.js +2 -0
- package/dist/bundles/sub-languages/pdl.js.map +1 -0
- package/dist/bundles/sub-languages/projection/CodeActionProvider.js +2 -0
- package/dist/bundles/sub-languages/projection/CodeActionProvider.js.map +1 -0
- package/dist/bundles/sub-languages/projection/CompletionProvider.js +2 -0
- package/dist/bundles/sub-languages/projection/CompletionProvider.js.map +1 -0
- package/dist/bundles/sub-languages/projection/HoverProvider.js +43 -0
- package/dist/bundles/sub-languages/projection/HoverProvider.js.map +1 -0
- package/dist/bundles/sub-languages/projection/Validator.js +5 -0
- package/dist/bundles/sub-languages/projection/Validator.js.map +1 -0
- package/dist/bundles/sub-languages/projection/index.js +3 -75
- package/dist/bundles/sub-languages/projection/index.js.map +1 -7
- package/dist/bundles/sub-languages/projection/language.js +2 -0
- package/dist/bundles/sub-languages/projection/language.js.map +1 -0
- package/dist/bundles/symbols.js +3 -0
- package/dist/bundles/symbols.js.map +1 -0
- package/dist/bundles/themes/screenplay-dark.js +2 -0
- package/dist/bundles/themes/screenplay-dark.js.map +1 -0
- package/dist/bundles/themes/screenplay-light.js +2 -0
- package/dist/bundles/themes/screenplay-light.js.map +1 -0
- package/dist/bundles/tokens.js +2 -0
- package/dist/bundles/tokens.js.map +1 -0
- package/dist/bundles/validation.js +3 -0
- package/dist/bundles/validation.js.map +1 -0
- package/dist/completion-items.d.ts.map +1 -1
- package/dist/diagnostic-codes.d.ts +6 -0
- package/dist/diagnostic-codes.d.ts.map +1 -1
- package/dist/keyword-docs.d.ts.map +1 -1
- package/dist/language.d.ts.map +1 -1
- package/dist/tokens.d.ts.map +1 -1
- package/package.json +4 -3
- package/dist/bundles/chunk-4CLLEMBX.js +0 -42
- package/dist/bundles/chunk-4CLLEMBX.js.map +0 -7
- package/dist/bundles/chunk-AYDF3IFZ.js +0 -2
- package/dist/bundles/chunk-AYDF3IFZ.js.map +0 -7
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./_virtual/_virtual/_rolldown/runtime.js";import{primitiveTypes as e}from"./language.js";import{typeReferenceText as t}from"./TypeReferenceSymbol.js";import{enclosingChain as n,fenceMap as r,indentOf as i,nearestEnclosingLine as a,withoutComment as o}from"./document-context.js";import{optionalTypeItems as s}from"./completion-items.js";import{responseAnalysis as c,responseAvailability as l}from"./response-analysis.js";import{propertyTypeReference as u,scanDocument as d}from"./symbols.js";function responseCompletions(f,p,m,h){let g=r(f);if(g[p]||o(m).length<m.length)return null;let _=m.trim()===``?m.length:i(f[p]),v=n(f,g,p,_),y=a(f,g,p,_),namedCommand=e=>{let t=h.commands.filter(t=>t.name===e);return t.length===1?t[0]:void 0},entry=(e,n=e.name)=>({label:e.name,insertText:n,documentation:`${t(u(e))}${e.isGenerated?` — generated, not request/form input`:``}. ${l}`});if(v.includes(`command`)){let t=d(f).commands.filter(e=>e.line<p).at(-1);if(!t)return null;if(v[0]===`command`){if(/^\s*returns\s+@?\w*$/.test(m))return!/returns\s+@/.test(m)&&t.properties.some(e=>e.name===`returns`&&e.line===p)?null:t.properties.map(e=>entry(e,`${/returns\s+@/.test(m)?``:`@`}${e.name}`));let e=m.match(/^\s*@?[a-z_]\w*\s+([\w.]+)\s+(\w*)$/);if(e&&[`generated`,`identifier`].some(t=>t.startsWith(e[2]))&&h.concepts.find(t=>t.name===e[1])?.primitive===`Uuid`)return[...`optional`.startsWith(e[2])?s:[],{label:`generated`,insertText:`generated`,documentation:`Required scalar Uuid concept with no validation rules; not a request/form input. ${l}`},{label:`generated identifier`,insertText:`generated identifier`,documentation:`Specification fixture uses an indented for value. ${l}`},{label:`identifier`,insertText:`identifier`,documentation:`Names the event source identifier.`}];if(/^\s*@?[a-z_]\w*\s+[\w.]+\s+generated\s+\w*$/.test(m))return[{label:`identifier`,insertText:`identifier`,documentation:l}]}if(v[0]===`returns`)return/=\s*@?\w*$/.test(m)?t.properties.map(e=>entry(e)):/^\s*@?[a-z_]\w*\s+[\w.]*$/.test(m)?[...h.concepts.map(e=>e.name),...h.types.map(e=>e.name),...e].map(e=>({label:e,insertText:e,documentation:`Explicit response type must exactly match the source. ${l}`})):t.properties.map(e=>entry(e,`${e.name} = ${e.name}`))}if(v[0]===`form`&&y&&(/^\s*field\s+\w*$/.test(m)||m.trim()===``)){let e=namedCommand(y.match(/\bfor\s+([\w.]+)$/)?.[1]);if(e)return e.properties.filter(e=>!e.isGenerated).map(e=>entry(e,m.trim()===``?`field ${e.name}`:e.name))}if(v.includes(`specification`)){if(v[0]===`when`&&y){let e=y.match(/^when\s+([\w.]+)$/)?.[1],t=namedCommand(e);if(!t)return null;if(/^\s*generated\s+\w*$/.test(m))return t.properties.filter(e=>e.isGenerated&&!e.isIdentifier).map(e=>entry(e,`${e.name} = "\${1:uuid}"`));if(m.trim()===``)return[...t.properties.filter(e=>!e.isGenerated).map(e=>entry(e,`${e.name} = \${1:value}`)),...t.properties.filter(e=>e.isGenerated&&!e.isIdentifier).map(e=>({...entry(e,`generated ${e.name} = "\${1:uuid}"`),label:`generated ${e.name}`})),...t.properties.some(e=>e.isGenerated&&e.isIdentifier)?[{label:`for`,insertText:'for "${1:uuid}"',documentation:`Generated identifier fixture, not request input. ${l}`}]:[]]}if(v[0]===`then`&&/^then\s+returns$/.test(y??``)){let e=namedCommand([...c(f).specifications.values()].filter(e=>e.location.line-1<p).at(-1)?.when?.commandType);if(e?.response?.kind===`RecordCommandResponseSyntax`){let n=new Map(e.properties.map(e=>[e.name,e]));return e.response.fields.map(e=>{let r=n.get(e.source.property),i=e.type??(r?u(r):void 0);return{label:e.name,insertText:`${e.name} = \${1:value}`,documentation:`${i?t(i):`Unresolved type`}. ${l}`}})}}}return null}export{responseCompletions};
|
|
2
|
+
//# sourceMappingURL=response-completions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response-completions.js","names":["fences","fenceMap","lines","line","withoutComment","before","indent","indentOf","chain","enclosingChain","enclosing","nearestEnclosingLine","matches","symbols","command","name","property","typeReferenceText","propertyTypeReference","responseAvailability","scanDocument","modifier","word","concept","optionalTypeItems","type","primitiveTypes","responseAnalysis","specification","properties","source","field"],"sources":["../../response-completions.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, fenceMap, indentOf, nearestEnclosingLine, withoutComment } from './document-context';\nimport { CompletionEntry, optionalTypeItems } from './completion-items';\nimport { DocumentSymbols, PropertySymbol, propertyTypeReference, scanDocument } from './symbols';\nimport { typeReferenceText } from './TypeReferenceSymbol';\nimport { responseAvailability, responseAnalysis } from './response-analysis';\nimport { primitiveTypes } from './language';\n\nexport function responseCompletions(lines: string[], line: number, before: string, symbols: DocumentSymbols): CompletionEntry[] | null {\n const fences = fenceMap(lines);\n if (fences[line] || withoutComment(before).length < before.length) return null;\n const indent = before.trim() === '' ? before.length : indentOf(lines[line]);\n const chain = enclosingChain(lines, fences, line, indent);\n const enclosing = nearestEnclosingLine(lines, fences, line, indent);\n const namedCommand = (name: string | undefined) => {\n const matches = symbols.commands.filter(command => command.name === name);\n return matches.length === 1 ? matches[0] : undefined;\n };\n const entry = (property: PropertySymbol, insertText = property.name): CompletionEntry => ({\n label: property.name, insertText,\n documentation: `${typeReferenceText(propertyTypeReference(property))}${property.isGenerated ? ' — generated, not request/form input' : ''}. ${responseAvailability}`,\n });\n if (chain.includes('command')) {\n // Merged symbol line offsets belong to different documents. Only the current (possibly\n // unsaved) source can own the cursor; application symbols are for external lookup.\n const command = scanDocument(lines).commands.filter(command => command.line < line).at(-1);\n if (!command) return null;\n if (chain[0] === 'command') {\n if (/^\\s*returns\\s+@?\\w*$/.test(before)) {\n if (!/returns\\s+@/.test(before) && command.properties.some(property => property.name === 'returns' && property.line === line)) return null;\n return command.properties.map(property => entry(property, `${/returns\\s+@/.test(before) ? '' : '@'}${property.name}`));\n }\n const modifier = before.match(/^\\s*@?[a-z_]\\w*\\s+([\\w.]+)\\s+(\\w*)$/);\n if (modifier && ['generated', 'identifier'].some(word => word.startsWith(modifier[2]))) {\n const concept = symbols.concepts.find(concept => concept.name === modifier[1]);\n if (concept?.primitive === 'Uuid') return [\n ...('optional'.startsWith(modifier[2]) ? optionalTypeItems : []),\n { label: 'generated', insertText: 'generated', documentation: `Required scalar Uuid concept with no validation rules; not a request/form input. ${responseAvailability}` },\n { label: 'generated identifier', insertText: 'generated identifier', documentation: `Specification fixture uses an indented for value. ${responseAvailability}` },\n { label: 'identifier', insertText: 'identifier', documentation: 'Names the event source identifier.' },\n ];\n }\n if (/^\\s*@?[a-z_]\\w*\\s+[\\w.]+\\s+generated\\s+\\w*$/.test(before)) return [{ label: 'identifier', insertText: 'identifier', documentation: responseAvailability }];\n }\n if (chain[0] === 'returns') {\n if (/=\\s*@?\\w*$/.test(before)) return command.properties.map(property => entry(property));\n if (/^\\s*@?[a-z_]\\w*\\s+[\\w.]*$/.test(before)) return [...symbols.concepts.map(concept => concept.name), ...symbols.types.map(type => type.name), ...primitiveTypes].map(name => ({ label: name, insertText: name, documentation: `Explicit response type must exactly match the source. ${responseAvailability}` }));\n return command.properties.map(property => entry(property, `${property.name} = ${property.name}`));\n }\n }\n if (chain[0] === 'form' && enclosing && (/^\\s*field\\s+\\w*$/.test(before) || before.trim() === '')) {\n const command = namedCommand(enclosing.match(/\\bfor\\s+([\\w.]+)$/)?.[1]);\n if (command) return command.properties.filter(property => !property.isGenerated).map(property => entry(property, before.trim() === '' ? `field ${property.name}` : property.name));\n }\n if (chain.includes('specification')) {\n if (chain[0] === 'when' && enclosing) {\n const name = enclosing.match(/^when\\s+([\\w.]+)$/)?.[1];\n const command = namedCommand(name);\n if (!command) return null;\n if (/^\\s*generated\\s+\\w*$/.test(before)) return command.properties.filter(property => property.isGenerated && !property.isIdentifier).map(property => entry(property, `${property.name} = \"\\${1:uuid}\"`));\n if (before.trim() === '') return [\n ...command.properties.filter(property => !property.isGenerated).map(property => entry(property, `${property.name} = \\${1:value}`)),\n ...command.properties.filter(property => property.isGenerated && !property.isIdentifier).map(property => ({ ...entry(property, `generated ${property.name} = \"\\${1:uuid}\"`), label: `generated ${property.name}` })),\n ...(command.properties.some(property => property.isGenerated && property.isIdentifier) ? [{ label: 'for', insertText: 'for \"${1:uuid}\"', documentation: `Generated identifier fixture, not request input. ${responseAvailability}` }] : []),\n ];\n }\n if (chain[0] === 'then' && /^then\\s+returns$/.test(enclosing ?? '')) {\n const specification = [...responseAnalysis(lines).specifications.values()].filter(specification => specification.location.line - 1 < line).at(-1);\n const command = namedCommand(specification?.when?.commandType);\n if (command?.response?.kind === 'RecordCommandResponseSyntax') {\n const properties = new Map(command.properties.map(property => [property.name, property]));\n return command.response.fields.map(field => {\n const source = properties.get(field.source.property);\n const type = field.type ?? (source ? propertyTypeReference(source) : undefined);\n return { label: field.name, insertText: `${field.name} = \\${1:value}`, documentation: `${type ? typeReferenceText(type) : 'Unresolved type'}. ${responseAvailability}` };\n });\n }\n }\n }\n return null;\n}\n"],"mappings":"mfAUA,SAAgB,oBAAoB,EAAiB,EAAc,EAAgB,EAAoD,CACnI,IAAMA,EAASC,EAASC,CAAK,EAC7B,GAAIF,EAAOG,IAASC,EAAeC,CAAM,CAAC,CAAC,OAASA,EAAO,OAAQ,OAAO,KAC1E,IAAMC,EAASD,EAAO,KAAK,IAAM,GAAKA,EAAO,OAASE,EAASL,EAAMC,EAAK,EACpEK,EAAQC,EAAeP,EAAOF,EAAQG,EAAMG,CAAM,EAClDI,EAAYC,EAAqBT,EAAOF,EAAQG,EAAMG,CAAM,EAC5D,aAAgB,GAA6B,CAC/C,IAAMM,EAAUC,EAAQ,SAAS,OAAO,GAAWC,EAAQ,OAASC,CAAI,EACxE,OAAOH,EAAQ,SAAW,EAAIA,EAAQ,GAAK,IAAA,EAC/C,EACM,OAAS,EAA0B,EAAaI,EAAS,QAA2B,CACtF,MAAOA,EAAS,KAAM,aACtB,cAAe,GAAGC,EAAkBC,EAAsBF,CAAQ,CAAC,IAAIA,EAAS,YAAc,uCAAyC,GAAG,IAAIG,GAClJ,GACA,GAAIX,EAAM,SAAS,SAAS,EAAG,CAG3B,IAAMM,EAAUM,EAAalB,CAAK,CAAC,CAAC,SAAS,OAAO,GAAWY,EAAQ,KAAOX,CAAI,CAAC,CAAC,GAAG,EAAE,EACzF,GAAI,CAACW,EAAS,OAAO,KACrB,G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AoDG,GAAuB,CAAC,EAAI,CAAC,CAC7O,CACJ,CACA,GAAIX,EAAM,KAAO,QAAU,mBAAmB,KAAKE,GAAa,EAAE,EAAG,CAEjE,IAAMI,EAAU,aADM,CAAC,GAAGa,EAAiBzB,CAAK,CAAC,CAAC,eAAe,OAAO,CAAC,CAAC,CAAC,OAAO,GAAiB0B,EAAc,SAAS,KAAO,EAAIzB,CAAI,CAAC,CAAC,GAAG,EACrG,CAAC,EAAE,MAAM,WAAW,EAC7D,GAAIW,GAAS,UAAU,OAAS,8BAA+B,CAC3D,IAAMe,EAAa,IAAI,IAAIf,EAAQ,WAAW,IAAI,GAAY,CAACE,EAAS,KAAMA,CAAQ,CAAC,CAAC,EACxF,OAAOF,EAAQ,SAAS,OAAO,IAAI,GAAS,CACxC,IAAMgB,EAASD,EAAW,IAAIE,EAAM,OAAO,QAAQ,EAC7CN,EAAOM,EAAM,OAASD,EAASZ,EAAsBY,CAAM,EAAI,IAAA,IACrE,MAAO,CAAE,MAAOC,EAAM,KAAM,WAAY,GAAGA,EAAM,KAAK,gBAAiB,cAAe,GAAGN,EAAOR,EAAkBQ,CAAI,EAAI,kBAAkB,IAAIN,GAAuB,CAC3K,CAAC,CACL,CACJ,CACJ,CACA,OAAO,IACX"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import"./_virtual/_virtual/_rolldown/runtime.js";import{withoutComment as e}from"./document-context.js";import{responseAnalysis as t}from"./response-analysis.js";const n=[`keyword`,`property`,`type`];function responseTokens(n,r){let i=[],add=(e,t,r,a)=>{let o=n[e-1];if(o===void 0||t<1||r<1)return;let s=t-1+ +(o[t-1]===`@`);s+r<=o.length&&i.push({line:e-1,column:s,length:r,type:a})},a=r?.authoringPath??`current.play`,o=t(n,r?.authoringDocuments??r?.authoringSources?.filter(e=>e!==n.join(`
|
|
2
|
+
`))??[],r?.authoringPlacement,a,r?.authoringPlacementResolved);for(let e of o.eventSources.declarations.filter(e=>e.location.path===a)){add(e.location.line,e.location.column,11,0),e.identifier&&add(e.identifier.location.line,e.identifier.location.column,e.identifier.name.length,2);for(let t of e.streams){add(t.location.line,t.location.column,6,0),t.streamId&&add(t.streamId.location.line,t.streamId.location.column,t.streamId.name.length,2);let e=t.directiveLocations?.streamId;e&&add(e.line,e.column,8,0);for(let e of t.streamIdParts)add(e.location.line,e.location.column,e.name.length,1),add(e.type.location.line,e.type.location.column,e.type.name.length,2)}}for(let e of o.eventSources.routes){add(e.location.line,e.location.column,6,0),e.referenceLocation&&add(e.referenceLocation.line,e.referenceLocation.column,`${e.eventSource}.${e.stream}`.length,2),e.streamId&&add(e.streamId.location.line,e.streamId.location.column,8,0);let t=e.directiveLocations?.streamId;t&&add(t.line,t.column,8,0);for(let t of e.streamIdParts)add(t.location.line,t.location.column,t.property.length,1)}for(let t of o.commands.values()){for(let r of t.properties){if(!r.isGenerated)continue;let t=e(n[r.location.line-1]??``);add(r.location.line,t.lastIndexOf(`generated`)+1,9,0)}let r=t.response;if(r){if(add(r.location.line,r.location.column,7,0),r.kind===`ScalarCommandResponseSyntax`)add(r.source.location.line,r.source.location.column,r.source.property.length,1);else for(let e of r.fields)add(e.location.line,e.location.column,e.name.length,1),add(e.source.location.line,e.source.location.column,e.source.property.length,1),e.type&&add(e.type.location.line,e.type.location.column,e.type.name.length,2)}}for(let e of o.specifications.values()){for(let t of e.thenEvents??[])t.noStream&&add(t.noStream.location.line,t.noStream.location.column,9,0);for(let t of e.when?.generatedValues??[])add(t.location.line,t.location.column,9,0);e.thenReturns&&add(e.thenReturns.location.line,(n[e.thenReturns.location.line-1]??``).indexOf(`returns`)+1,7,0)}for(let e of o.operations.systems.filter(e=>e.location.path===a))add(e.location.line,e.location.column,6,0);for(let t of o.operations.declarations.filter(e=>e.location.path===a)){let r=e(n[t.location.line-1]??``).indexOf(`operation`,t.location.column-1);r>=0&&add(t.location.line,r+1,9,0);for(let e of t.inputs)add(e.location.line,e.location.column,e.name.length,1),add(e.type.location.line,e.type.location.column,e.type.name.length,2);t.usesLocation&&add(t.usesLocation.line,(n[t.usesLocation.line-1]??``).indexOf(`uses`)+1,4,0);for(let r of[t.execute,t.compensate]){if(!r)continue;let t=e(n[r.location.line-1]??``).trim();add(r.location.line,r.location.column,t.length,0),r.implementation&&add(r.implementation.location.line,r.implementation.location.column,14,0);for(let e of r.implementation?.hints??[])add(e.location.line,e.location.column,4,0)}}let s=i.sort((e,t)=>e.line-t.line||e.column-t.column);return s.filter((e,t)=>t===0||e.line!==s[t-1].line||e.column>=s[t-1].column+s[t-1].length)}export{n as responseTokenTypes,responseTokens};
|
|
3
|
+
//# sourceMappingURL=response-tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response-tokens.js","names":["responseTokenTypes","tokens","source","lines","line","column","length","start","path","symbols","analysis","responseAnalysis","stream","header","part","route","command","property","withoutComment","response","field","specification","event","fixture","system","operation","keyword","input","phase","name","hint","ordered","left","right","index","token"],"sources":["../../response-tokens.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 { responseAnalysis } from './response-analysis';\nimport { DocumentSymbols } from './symbols';\nimport { withoutComment } from './document-context';\n\nexport const responseTokenTypes = ['keyword', 'property', 'type'] as const;\n\n// Semantic overlays resolve the local returns ambiguity that a line-based grammar cannot.\nexport function responseTokens(lines: string[], symbols?: DocumentSymbols): { line: number; column: number; length: number; type: number }[] {\n const tokens: { line: number; column: number; length: number; type: number }[] = [];\n const add = (line: number, column: number, length: number, type: number) => {\n const source = lines[line - 1];\n if (source === undefined || column < 1 || length < 1) return;\n const start = column - 1 + (source[column - 1] === '@' ? 1 : 0);\n if (start + length <= source.length) tokens.push({ line: line - 1, column: start, length, type });\n };\n const path = symbols?.authoringPath ?? 'current.play';\n const analysis = responseAnalysis(lines, symbols?.authoringDocuments ?? symbols?.authoringSources?.filter(source => source !== lines.join('\\n')) ?? [], symbols?.authoringPlacement, path, symbols?.authoringPlacementResolved);\n for (const source of analysis.eventSources.declarations.filter(source => source.location.path === path)) {\n add(source.location.line, source.location.column, 11, 0);\n if (source.identifier) add(source.identifier.location.line, source.identifier.location.column, source.identifier.name.length, 2);\n for (const stream of source.streams) {\n add(stream.location.line, stream.location.column, 6, 0);\n if (stream.streamId) add(stream.streamId.location.line, stream.streamId.location.column, stream.streamId.name.length, 2);\n const header = stream.directiveLocations?.streamId;\n if (header) add(header.line, header.column, 8, 0);\n for (const part of stream.streamIdParts) {\n add(part.location.line, part.location.column, part.name.length, 1);\n add(part.type.location.line, part.type.location.column, part.type.name.length, 2);\n }\n }\n }\n for (const route of analysis.eventSources.routes) {\n add(route.location.line, route.location.column, 6, 0);\n if (route.referenceLocation) add(route.referenceLocation.line, route.referenceLocation.column, `${route.eventSource}.${route.stream}`.length, 2);\n if (route.streamId) add(route.streamId.location.line, route.streamId.location.column, 8, 0);\n const header = route.directiveLocations?.streamId;\n if (header) add(header.line, header.column, 8, 0);\n for (const part of route.streamIdParts) add(part.location.line, part.location.column, part.property.length, 1);\n }\n for (const command of analysis.commands.values()) {\n for (const property of command.properties) {\n if (!property.isGenerated) continue;\n const source = withoutComment(lines[property.location.line - 1] ?? '');\n add(property.location.line, source.lastIndexOf('generated') + 1, 9, 0);\n }\n const response = command.response;\n if (!response) continue;\n add(response.location.line, response.location.column, 7, 0);\n if (response.kind === 'ScalarCommandResponseSyntax') {\n add(response.source.location.line, response.source.location.column, response.source.property.length, 1);\n } else for (const field of response.fields) {\n add(field.location.line, field.location.column, field.name.length, 1);\n add(field.source.location.line, field.source.location.column, field.source.property.length, 1);\n if (field.type) add(field.type.location.line, field.type.location.column, field.type.name.length, 2);\n }\n }\n for (const specification of analysis.specifications.values()) {\n for (const event of specification.thenEvents ?? []) {\n if (event.noStream) add(event.noStream.location.line, event.noStream.location.column, 9, 0);\n }\n for (const fixture of specification.when?.generatedValues ?? []) {\n add(fixture.location.line, fixture.location.column, 9, 0);\n }\n if (specification.thenReturns) add(specification.thenReturns.location.line, (lines[specification.thenReturns.location.line - 1] ?? '').indexOf('returns') + 1, 7, 0);\n }\n for (const system of analysis.operations.systems.filter(system => system.location.path === path)) {\n add(system.location.line, system.location.column, 6, 0);\n }\n for (const operation of analysis.operations.declarations.filter(operation => operation.location.path === path)) {\n const header = withoutComment(lines[operation.location.line - 1] ?? '');\n const keyword = header.indexOf('operation', operation.location.column - 1);\n if (keyword >= 0) add(operation.location.line, keyword + 1, 9, 0);\n for (const input of operation.inputs) {\n add(input.location.line, input.location.column, input.name.length, 1);\n add(input.type.location.line, input.type.location.column, input.type.name.length, 2);\n }\n if (operation.usesLocation) add(operation.usesLocation.line, (lines[operation.usesLocation.line - 1] ?? '').indexOf('uses') + 1, 4, 0);\n for (const phase of [operation.execute, operation.compensate]) {\n if (!phase) continue;\n const name = withoutComment(lines[phase.location.line - 1] ?? '').trim();\n add(phase.location.line, phase.location.column, name.length, 0);\n if (phase.implementation) add(phase.implementation.location.line, phase.implementation.location.column, 14, 0);\n for (const hint of phase.implementation?.hints ?? []) add(hint.location.line, hint.location.column, 4, 0);\n }\n }\n // Overlays never overlap or duplicate a typed token, even with recovered malformed syntax.\n const ordered = tokens.sort((left, right) => left.line - right.line || left.column - right.column);\n return ordered.filter((token, index) => index === 0 || token.line !== ordered[index - 1].line || token.column >= ordered[index - 1].column + ordered[index - 1].length);\n}\n"],"mappings":"kKAOA,MAAaA,EAAqB,CAAC,UAAW,WAAY,MAAM,EAGhE,SAAgB,eAAe,EAAiB,EAA6F,CACzI,IAAMC,EAA2E,CAAC,EAC5E,KAAO,EAAc,EAAgB,EAAgB,IAAiB,CACxE,IAAMC,EAASC,EAAMC,EAAO,GAC5B,GAAIF,IAAW,IAAA,IAAaG,EAAS,GAAKC,EAAS,EAAG,OACtD,IAAMC,EAAQF,EAAS,GAAK,IAAOA,EAAS,KAAO,KAC/CE,EAAQD,GAAUJ,EAAO,QAAQD,EAAO,KAAK,CAAE,KAAMG,EAAO,EAAG,OAAQG,EAAO,SAAQ,MAAK,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C,CAAC,KAAK,EACvE,IAAIA,EAAM,SAAS,KAAMA,EAAM,SAAS,OAAQC,EAAK,OAAQ,CAAC,EAC1DD,EAAM,gBAAgB,IAAIA,EAAM,eAAe,SAAS,KAAMA,EAAM,eAAe,SAAS,OAAQ,GAAI,CAAC,EAC7G,IAAK,IAAME,KAAQF,EAAM,gBAAgB,OAAS,CAAC,EAAG,IAAIE,EAAK,SAAS,KAAMA,EAAK,SAAS,OAAQ,EAAG,CAAC,CAC5G,CACJ,CAEA,IAAMC,EAAU9B,EAAO,MAAM,EAAM,IAAU+B,EAAK,KAAOC,EAAM,MAAQD,EAAK,OAASC,EAAM,MAAM,EACjG,OAAOF,EAAQ,QAAQ,EAAO,IAAUG,IAAU,GAAKC,EAAM,OAASJ,EAAQG,EAAQ,EAAE,CAAC,MAAQC,EAAM,QAAUJ,EAAQG,EAAQ,EAAE,CAAC,OAASH,EAAQG,EAAQ,EAAE,CAAC,MAAM,CAC1K"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import"./_virtual/_virtual/_rolldown/runtime.js";import{documentationItem as e}from"./documentation-item.js";import{purposeReferenceItem as t}from"./purpose-items.js";import{exampleDeclarationItems as n}from"./example-declaration-items.js";const r=[{label:`on`,insertText:"on ${1|click,select,submit,change,load,unload,enter,leave|}\n ${2:execute command}",documentation:`Wires what happens on an interaction - a click, a submit, entering or leaving the screen.`},{label:`uses`,insertText:"uses ${1:Behavior}",documentation:`Attaches a named behavior declared at the top level.`}],i=[t,e,...n,{label:`description`,insertText:'description "${1:what this module is for}"',documentation:`A human-readable description.`},{label:`authorize`,insertText:"authorize ${1:PolicyName}",documentation:`Policies that must pass for everything in the module.`},{label:`depends on`,insertText:"depends on ${1:Name}",documentation:`Declares an allowed module or feature dependency. Opts this container into independent explicit-reference checks.`},{label:`import "…"`,insertText:'import "${1:*/*.play}"',documentation:"Imports `.play` files into this module — their top level is the module's body."},{label:`feature`,insertText:`feature \${1:Name}
|
|
2
|
+
`,documentation:`Groups related slices into a vertical feature.`},{label:`screen`,insertText:"screen ${1:Name}\n data ${2:ReadModel} via query ${3:QueryName}",documentation:`Declares a module-level UI screen.`},{label:`screen template`,insertText:`screen template \${1:Name}
|
|
3
|
+
fits slot \${2:content}
|
|
4
|
+
|
|
5
|
+
\${3:slot}`,documentation:`Declares a reusable screen shape that fits a slot of the shell.`},{label:`dialog template`,insertText:"dialog template ${1:Name}\n ${2:body}\n ${3:actions}",documentation:`Declares a reusable dialog shape that opens over the shell.`},{label:`form`,insertText:'form ${1:Name} for ${2:Command}\n field ${3:property} label "${4:Label}"',documentation:`Declares a form bound to a command.`},{label:`contribute`,insertText:'contribute to ${1:Navigation}\n navigate to ${2:Screen}\n label "${3:Label}"',documentation:`Contributes an entry to a slot of the shell, such as navigation.`},...r],a=[t,e,...n,{label:`description`,insertText:'description "${1:what this feature is for}"',documentation:`A human-readable description.`},{label:`authorize`,insertText:"authorize ${1:PolicyName}",documentation:`Policies that must pass for everything in the feature.`},{label:`depends on`,insertText:"depends on ${1:Name}",documentation:`Declares an allowed module or feature dependency. Sibling feature names resolve before module names.`},{label:`import "…"`,insertText:'import "${1:*.play}"',documentation:"Imports `.play` files into this feature — their top level is the feature's body."},{label:`feature`,insertText:`feature \${1:Name}
|
|
6
|
+
`,documentation:`Declares a nested sub-feature.`},{label:`slice StateChange`,insertText:`slice StateChange \${1:Name}
|
|
7
|
+
`,documentation:`A command → events flow; something that changes the system.`},{label:`slice StateView`,insertText:`slice StateView \${1:Name}
|
|
8
|
+
`,documentation:`A query + projection + screen; something that reads the system.`},{label:`slice Automation`,insertText:`slice Automation \${1:Name}
|
|
9
|
+
`,documentation:`A reaction or reducer; something that runs when something happens.`},{label:`slice Translate`,insertText:`slice Translate \${1:Name}
|
|
10
|
+
`,documentation:`A capture; converts external data into events.`},{label:`contribute`,insertText:'contribute to ${1:Navigation}\n navigate to ${2:Screen}\n label "${3:Label}"',documentation:`Contributes an entry to a slot of the shell, such as navigation.`},...r],o=[e,{label:`description`,insertText:'description "${1:what one instance holds}"',documentation:`A human-readable description.`},{label:`file`,insertText:"file ${1:Path}",documentation:`Names the file this read model is realized by.`},{label:`property`,insertText:"${1:property} ${2:Type}",documentation:`A property of the read model — a name and a type reference.`}],s=[{label:`description`,insertText:'description "${1:what the reducer does}"',documentation:`A human-readable description.`},{label:`on`,insertText:"on ${1:EventType}\n ```csharp\n ${2}\n ```",documentation:`A rule applied when the event occurs, in code or from a file.`}],c=[{label:`description`,insertText:'description "${1:input surface intent}"',documentation:`Report-only description of the form.`},{label:`populate via query`,insertText:"populate via query ${1:Query} by ${2:parameter}",documentation:`Fills the form from a query before it is shown.`},{label:`populate from item`,insertText:`populate from item`,documentation:`Fills the form from the item the screen was opened for.`},{label:`field`,insertText:'field ${1:property} label "${2:Label}"',documentation:`A form field bound to a command property.`},...r],l=[{label:`navigate to`,insertText:"navigate to ${1:Screen}",documentation:`The screen the entry opens.`},{label:`label`,insertText:'label "${1:Label}"',documentation:`The text of the entry.`},{label:`order`,insertText:"order ${1:10}",documentation:`Where the entry sits among the others; lower comes first.`}],u=[{label:`description`,insertText:'description "${1:what the behavior does}"',documentation:`A human-readable description.`},{label:`parameter`,insertText:"parameter ${1:name} ${2:Type}",documentation:`A value the behavior is given where it is attached.`},{label:`order`,insertText:"order ${1:10}",documentation:`The order behaviors attached to the same element run in.`},{label:`on`,insertText:"on ${1|click,select,submit,change,load,unload,enter,leave|}\n ${2:execute command}",documentation:`Wires what happens on an interaction.`}],step=(e,t,n)=>({label:e,insertText:t,documentation:n}),d=[step(`execute`,"execute ${1:command}",`Runs a command.`),step(`navigate to`,"navigate to ${1:Screen}",`Opens a screen.`),step(`open`,"open ${1:Dialog}",`Opens a dialog.`),step(`close`,`close`,`Closes the dialog.`),step(`refresh`,"refresh ${1:query}",`Reloads a query.`),step(`set`,"set ${1:name} ${2:value}",`Sets a value.`),step(`notify`,'notify ${1|info,warning,error|} "${2:message}"',`Shows a notification.`),step(`confirm`,`confirm \${1:message}
|
|
11
|
+
on success
|
|
12
|
+
\${2:execute command}`,`Asks before continuing.`),step(`raise`,"raise ${1:Trigger}",`Raises a trigger.`)],f=[step(`on success`,`on success
|
|
13
|
+
\${1:notify info "Done"}`,`What happens when it succeeds.`),step(`on failure`,`on failure
|
|
14
|
+
\${1:notify error "Failed"}`,`What happens when it fails.`),...d],p=[{label:`description`,insertText:'description "${1:who they are}"',documentation:`A human-readable description.`},{label:`policy`,insertText:"policy ${1:PolicyName}",documentation:`A policy this persona holds.`}],m=[{label:`provider`,insertText:"provider ${1:Name}",documentation:`An identity provider.`},{label:`provider (named)`,insertText:"provider ${1:Kind} name ${2:Name}",documentation:`An identity provider of a kind, under its own name.`}],h=[{label:`for`,insertText:'for ${1:"event-source-id"}\n ${2:EventType}\n ${3:property} = ${4:value}',documentation:`Events to seed for one event source id.`}],g=[{label:`compatible with`,insertText:"compatible with ${1:Package}",documentation:`A component package the theme is compatible with.`}],_=[{label:`target platform`,insertText:"target platform ${1:web}",documentation:`The platforms the profile is for.`},{label:`target size`,insertText:"target size ${1|compact,regular|}",documentation:`The screen sizes the profile is for.`},{label:`packages`,insertText:`packages
|
|
15
|
+
\${1:Package}`,documentation:`The component packages the profile uses.`},{label:`layout`,insertText:"layout ${1:Layout}",documentation:`The layout of the profile.`},{label:`theme`,insertText:"theme ${1:Theme}",documentation:`The theme of the profile.`}],v=[{label:`slot`,insertText:"${1:slot}",documentation:`A named slot of the shell.`},{label:`slot contributes`,insertText:"${1:slot} contributes ${2:Name}",documentation:"A slot other declarations contribute to, such as `navigation contributes Navigation`."},{label:`arrangement`,insertText:`arrangement flow
|
|
16
|
+
column
|
|
17
|
+
\${1:slot}`,documentation:`How the slots are placed.`}],y=[{label:`fits slot`,insertText:"fits slot ${1:content}",documentation:`The slot of the shell the template fits.`},...v,{label:`on`,insertText:"on ${1|enter,leave,load,unload|}\n ${2:refresh query}",documentation:`Wires what happens on an interaction.`}];export{d as actionStepItems,m as authenticationItems,u as behaviorItems,l as contributeItems,a as featureScopeItems,c as formItems,v as layoutItems,i as moduleScopeItems,f as outcomeItems,p as personaItems,o as readModelItems,s as reducerItems,h as seedItems,y as templateItems,g as themeItems,_ as uiProfileItems};
|
|
18
|
+
//# sourceMappingURL=scope-items.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-items.js","names":["interactionItems","moduleScopeItems","purposeReferenceItem","documentationItem","exampleDeclarationItems","featureScopeItems","readModelItems","reducerItems","formItems","contributeItems","behaviorItems","actionStepItems","outcomeItems","personaItems","authenticationItems","seedItems","themeItems","uiProfileItems","layoutItems","templateItems"],"sources":["../../scope-items.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 type { CompletionEntry } from './completion-items';\nimport { exampleDeclarationItems } from './example-declaration-items';\nimport { documentationItem } from './documentation-item';\nimport { purposeReferenceItem } from './purpose-items';\n\nconst interactions = ['click', 'double click', 'select', 'submit', 'change', 'load', 'unload', 'enter', 'leave'];\n\nconst interactionItems: CompletionEntry[] = [\n { label: 'on', insertText: 'on ${1|click,select,submit,change,load,unload,enter,leave|}\\n ${2:execute command}', documentation: 'Wires what happens on an interaction - a click, a submit, entering or leaving the screen.' },\n { label: 'uses', insertText: 'uses ${1:Behavior}', documentation: 'Attaches a named behavior declared at the top level.' },\n];\n\nexport const moduleScopeItems: CompletionEntry[] = [\n purposeReferenceItem,\n documentationItem,\n ...exampleDeclarationItems,\n { label: 'description', insertText: 'description \"${1:what this module is for}\"', documentation: 'A human-readable description.' },\n { label: 'authorize', insertText: 'authorize ${1:PolicyName}', documentation: 'Policies that must pass for everything in the module.' },\n { label: 'depends on', insertText: 'depends on ${1:Name}', documentation: 'Declares an allowed module or feature dependency. Opts this container into independent explicit-reference checks.' },\n { label: 'import \"…\"', insertText: 'import \"${1:*/*.play}\"', documentation: 'Imports `.play` files into this module — their top level is the module\\'s body.' },\n { label: 'feature', insertText: 'feature ${1:Name}\\n ', documentation: 'Groups related slices into a vertical feature.' },\n { label: 'screen', insertText: 'screen ${1:Name}\\n data ${2:ReadModel} via query ${3:QueryName}', documentation: 'Declares a module-level UI screen.' },\n { label: 'screen template', insertText: 'screen template ${1:Name}\\n fits slot ${2:content}\\n\\n ${3:slot}', documentation: 'Declares a reusable screen shape that fits a slot of the shell.' },\n { label: 'dialog template', insertText: 'dialog template ${1:Name}\\n ${2:body}\\n ${3:actions}', documentation: 'Declares a reusable dialog shape that opens over the shell.' },\n { label: 'form', insertText: 'form ${1:Name} for ${2:Command}\\n field ${3:property} label \"${4:Label}\"', documentation: 'Declares a form bound to a command.' },\n { label: 'contribute', insertText: 'contribute to ${1:Navigation}\\n navigate to ${2:Screen}\\n label \"${3:Label}\"', documentation: 'Contributes an entry to a slot of the shell, such as navigation.' },\n ...interactionItems,\n];\n\nexport const featureScopeItems: CompletionEntry[] = [\n purposeReferenceItem,\n documentationItem,\n ...exampleDeclarationItems,\n { label: 'description', insertText: 'description \"${1:what this feature is for}\"', documentation: 'A human-readable description.' },\n { label: 'authorize', insertText: 'authorize ${1:PolicyName}', documentation: 'Policies that must pass for everything in the feature.' },\n { label: 'depends on', insertText: 'depends on ${1:Name}', documentation: 'Declares an allowed module or feature dependency. Sibling feature names resolve before module names.' },\n { label: 'import \"…\"', insertText: 'import \"${1:*.play}\"', documentation: 'Imports `.play` files into this feature — their top level is the feature\\'s body.' },\n { label: 'feature', insertText: 'feature ${1:Name}\\n ', documentation: 'Declares a nested sub-feature.' },\n { label: 'slice StateChange', insertText: 'slice StateChange ${1:Name}\\n ', documentation: 'A command → events flow; something that changes the system.' },\n { label: 'slice StateView', insertText: 'slice StateView ${1:Name}\\n ', documentation: 'A query + projection + screen; something that reads the system.' },\n { label: 'slice Automation', insertText: 'slice Automation ${1:Name}\\n ', documentation: 'A reaction or reducer; something that runs when something happens.' },\n { label: 'slice Translate', insertText: 'slice Translate ${1:Name}\\n ', documentation: 'A capture; converts external data into events.' },\n { label: 'contribute', insertText: 'contribute to ${1:Navigation}\\n navigate to ${2:Screen}\\n label \"${3:Label}\"', documentation: 'Contributes an entry to a slot of the shell, such as navigation.' },\n ...interactionItems,\n];\n\nexport const readModelItems: CompletionEntry[] = [\n documentationItem,\n { label: 'description', insertText: 'description \"${1:what one instance holds}\"', documentation: 'A human-readable description.' },\n { label: 'file', insertText: 'file ${1:Path}', documentation: 'Names the file this read model is realized by.' },\n { label: 'property', insertText: '${1:property} ${2:Type}', documentation: 'A property of the read model — a name and a type reference.' },\n];\n\nexport const reducerItems: CompletionEntry[] = [\n { label: 'description', insertText: 'description \"${1:what the reducer does}\"', documentation: 'A human-readable description.' },\n { label: 'on', insertText: 'on ${1:EventType}\\n ```csharp\\n ${2}\\n ```', documentation: 'A rule applied when the event occurs, in code or from a file.' },\n];\n\nexport const formItems: CompletionEntry[] = [\n { label: 'description', insertText: 'description \"${1:input surface intent}\"', documentation: 'Report-only description of the form.' },\n { label: 'populate via query', insertText: 'populate via query ${1:Query} by ${2:parameter}', documentation: 'Fills the form from a query before it is shown.' },\n { label: 'populate from item', insertText: 'populate from item', documentation: 'Fills the form from the item the screen was opened for.' },\n { label: 'field', insertText: 'field ${1:property} label \"${2:Label}\"', documentation: 'A form field bound to a command property.' },\n ...interactionItems,\n];\n\nexport const contributeItems: CompletionEntry[] = [\n { label: 'navigate to', insertText: 'navigate to ${1:Screen}', documentation: 'The screen the entry opens.' },\n { label: 'label', insertText: 'label \"${1:Label}\"', documentation: 'The text of the entry.' },\n { label: 'order', insertText: 'order ${1:10}', documentation: 'Where the entry sits among the others; lower comes first.' },\n];\n\nexport const behaviorItems: CompletionEntry[] = [\n { label: 'description', insertText: 'description \"${1:what the behavior does}\"', documentation: 'A human-readable description.' },\n { label: 'parameter', insertText: 'parameter ${1:name} ${2:Type}', documentation: 'A value the behavior is given where it is attached.' },\n { label: 'order', insertText: 'order ${1:10}', documentation: 'The order behaviors attached to the same element run in.' },\n { label: 'on', insertText: 'on ${1|click,select,submit,change,load,unload,enter,leave|}\\n ${2:execute command}', documentation: 'Wires what happens on an interaction.' },\n];\n\nconst step = (label: string, insertText: string, documentation: string): CompletionEntry => ({ label, insertText, documentation });\n\n// What an interaction does, and what can follow an action's outcome.\nexport const actionStepItems: CompletionEntry[] = [\n step('execute', 'execute ${1:command}', 'Runs a command.'),\n step('navigate to', 'navigate to ${1:Screen}', 'Opens a screen.'),\n step('open', 'open ${1:Dialog}', 'Opens a dialog.'),\n step('close', 'close', 'Closes the dialog.'),\n step('refresh', 'refresh ${1:query}', 'Reloads a query.'),\n step('set', 'set ${1:name} ${2:value}', 'Sets a value.'),\n step('notify', 'notify ${1|info,warning,error|} \"${2:message}\"', 'Shows a notification.'),\n step('confirm', 'confirm ${1:message}\\n on success\\n ${2:execute command}', 'Asks before continuing.'),\n step('raise', 'raise ${1:Trigger}', 'Raises a trigger.'),\n];\n\nexport const outcomeItems: CompletionEntry[] = [\n step('on success', 'on success\\n ${1:notify info \"Done\"}', 'What happens when it succeeds.'),\n step('on failure', 'on failure\\n ${1:notify error \"Failed\"}', 'What happens when it fails.'),\n ...actionStepItems,\n];\n\nexport const personaItems: CompletionEntry[] = [\n { label: 'description', insertText: 'description \"${1:who they are}\"', documentation: 'A human-readable description.' },\n { label: 'policy', insertText: 'policy ${1:PolicyName}', documentation: 'A policy this persona holds.' },\n];\n\nexport const authenticationItems: CompletionEntry[] = [\n { label: 'provider', insertText: 'provider ${1:Name}', documentation: 'An identity provider.' },\n { label: 'provider (named)', insertText: 'provider ${1:Kind} name ${2:Name}', documentation: 'An identity provider of a kind, under its own name.' },\n];\n\nexport const seedItems: CompletionEntry[] = [\n { label: 'for', insertText: 'for ${1:\"event-source-id\"}\\n ${2:EventType}\\n ${3:property} = ${4:value}', documentation: 'Events to seed for one event source id.' },\n];\n\nexport const themeItems: CompletionEntry[] = [\n { label: 'compatible with', insertText: 'compatible with ${1:Package}', documentation: 'A component package the theme is compatible with.' },\n];\n\nexport const uiProfileItems: CompletionEntry[] = [\n { label: 'target platform', insertText: 'target platform ${1:web}', documentation: 'The platforms the profile is for.' },\n { label: 'target size', insertText: 'target size ${1|compact,regular|}', documentation: 'The screen sizes the profile is for.' },\n { label: 'packages', insertText: 'packages\\n ${1:Package}', documentation: 'The component packages the profile uses.' },\n { label: 'layout', insertText: 'layout ${1:Layout}', documentation: 'The layout of the profile.' },\n { label: 'theme', insertText: 'theme ${1:Theme}', documentation: 'The theme of the profile.' },\n];\n\nexport const layoutItems: CompletionEntry[] = [\n { label: 'slot', insertText: '${1:slot}', documentation: 'A named slot of the shell.' },\n { label: 'slot contributes', insertText: '${1:slot} contributes ${2:Name}', documentation: 'A slot other declarations contribute to, such as `navigation contributes Navigation`.' },\n { label: 'arrangement', insertText: 'arrangement flow\\n column\\n ${1:slot}', documentation: 'How the slots are placed.' },\n];\n\nexport const templateItems: CompletionEntry[] = [\n { label: 'fits slot', insertText: 'fits slot ${1:content}', documentation: 'The slot of the shell the template fits.' },\n ...layoutItems,\n { label: 'on', insertText: 'on ${1|enter,leave,load,unload|}\\n ${2:refresh query}', documentation: 'Wires what happens on an interaction.' },\n];\n\nexport const interactionNames = interactions;\n"],"mappings":"gPAUA,MAAMA,EAAsC,CACxC,CAAE,MAAO,KAAM,WAAY,wFAAyF,cAAe,2FAA4F,EAC/N,CAAE,MAAO,OAAQ,WAAY,qBAAsB,cAAe,sDAAuD,CAC7H,EAEaC,EAAsC,CAC/CC,EACAC,EACA,GAAGC,EACH,CAAE,MAAO,cAAe,WAAY,6CAA8C,cAAe,+BAAgC,EACjI,CAAE,MAAO,YAAa,WAAY,4BAA6B,cAAe,uDAAwD,EACtI,CAAE,MAAO,aAAc,WAAY,uBAAwB,cAAe,mHAAoH,EAC9L,CAAE,MAAO,aAAc,WAAY,yBAA0B,cAAe,gFAAkF,EAC9J,CAAE,MAAO,UAAW,WAAY;MAA2B,cAAe,gDAAiD,EAC3H,CAAE,MAAO,SAAU,WAAY,qEAAsE,cAAe,oCAAqC,EACzJ,CAAE,MAAO,kBAAmB,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WAAY,WAAY,qBAAsB,cAAe,uBAAwB,EAC9F,CAAE,MAAO,mBAAoB,WAAY,oCAAqC,cAAe,qDAAsD,CACvJ,EAEaC,EAA+B,CACxC,CAAE,MAAO,MAAO,WAAY,qFAAsF,cAAe,yCAA0C,CAC/K,EAEaC,EAAgC,CACzC,CAAE,MAAO,kBAAmB,WAAY,+BAAgC,cAAe,mDAAoD,CAC/I,EAEaC,EAAoC,CAC7C,CAAE,MAAO,kBAAmB,WAAY,2BAA4B,cAAe,mCAAoC,EACvH,CAAE,MAAO,cAAe,WAAY,oCAAqC,cAAe,sCAAuC,EAC/H,CAAE,MAAO,WAAY,WAAY;mBAA8B,cAAe,0CAA2C,EACzH,CAAE,MAAO,SAAU,WAAY,qBAAsB,cAAe,4BAA6B,EACjG,CAAE,MAAO,QAAS,WAAY,mBAAoB,cAAe,2BAA4B,CACjG,EAEaC,EAAiC,CAC1C,CAAE,MAAO,OAAQ,WAAY,YAAa,cAAe,4BAA6B,EACtF,CAAE,MAAO,mBAAoB,WAAY,kCAAmC,cAAe,uFAAwF,EACnL,CAAE,MAAO,cAAe,WAAY;;oBAAmD,cAAe,2BAA4B,CACtI,EAEaC,EAAmC,CAC5C,CAAE,MAAO,YAAa,WAAY,yBAA0B,cAAe,0CAA2C,EACtH,GAAGD,EACH,CAAE,MAAO,KAAM,WAAY,2DAA4D,cAAe,uCAAwC,CAClJ"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import"./_virtual/_virtual/_rolldown/runtime.js";import{fenceMap as e,indentOf as t,nearestEnclosingLine as n,withoutComment as r}from"./document-context.js";import{exampleValueFor as i}from"./example-values.js";function lastIndexWhere(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n],n))return n;return-1}const upperCamelWords=e=>e.match(/[A-Z][a-z0-9]*/g)??[e];function pastTense(e){return/[^aeiou]y$/i.test(e)?`${e.slice(0,-1)}ied`:/e$/i.test(e)?`${e}d`:`${e}ed`}function likelyEventName(e,t){let[n,...r]=upperCamelWords(e),i=r.join(``);return t.events.find(e=>i.length>0&&e.name.startsWith(i))?.name??`${i}${pastTense(n)}`}function indentUnit(e){let n=e.map(t).filter(e=>e>0);return n.length===0?4:Math.min(...n)}function producesBlock(e,t,n,r){let i=likelyEventName(e.name,t),a=t.events.find(e=>e.name===i),o=` `.repeat(n+r),s=e.properties.filter(e=>!e.isIdentifier);if(a){let t=a.properties.filter(e=>s.some(t=>t.name===e.name)),n=e.properties.find(e=>e.isIdentifier);return[`produces ${i}`,...n?[`${o}for ${n.name}`]:[],...t.map(e=>`${o}${e.name} = ${e.name}`)].join(`
|
|
2
|
+
`)}return[`produces event ${i}`,...s.map(e=>`${o}${e.name} ${e.type} = ${e.name}`)].join(`
|
|
3
|
+
`)}function newCommandBlock(e,t,n,r){let i=upperCamelWords(e).slice(1).join(``),a=likelyEventName(e,t),o=t.events.find(e=>e.name===a),s=i.length>0&&t.concepts.some(e=>e.name===`${i}Id`)?`${i[0].toLowerCase()}${i.slice(1)}Id`:void 0,c=s?[`${s} ${i}Id identifier`]:[],l=` `.repeat(n+r),u=(o?.properties??[]).filter(e=>e.name!==s),d=u.map(e=>`${` `.repeat(n)}${e.name} ${e.type}`),f=o?[`${` `.repeat(n)}produces ${a}`,...s?[`${l}for ${s}`]:[],...u.map(e=>`${l}${e.name} = ${e.name}`)]:[`${` `.repeat(n)}produces event ${a}`];return[...c.map((e,t)=>t===0?e:`${` `.repeat(n)}${e}`),...d,...f].join(`
|
|
4
|
+
`).trimStart()}function assignments(e,t,n){return e.map(e=>`${` `.repeat(n)}${e.name} = ${i(e.type,t)}`)}function sliceCommand(e,n,r,i){let a=-1;for(let i=r-1;i>=0;i--)if(!n[i]&&/^\s*slice\s/.test(e[i])&&t(e[i])<t(e[r])){a=i;break}if(a<0)return;let o,s=!1;for(let r=a+1;r<e.length;r++){if(e[r].trim().length===0||n[r])continue;if(t(e[r])<=t(e[a]))break;let i=e[r].trim().match(/^command\s+(\w+)\s*$/);i?(o=i[1],s=!1):o&&/^authorize\b/.test(e[r].trim())&&(s=!0)}let c=i.commands.find(e=>e.name===o);return c?{symbol:c,authorized:s}:void 0}function specificationBlock(e,t,n,r,a){let o=r+a,s=likelyEventName(e.name,n),c=e.properties.find(e=>e.isIdentifier),l=e.properties.filter(e=>!e.isIdentifier);return[...t?[`given caller`,`${` `.repeat(o)}authenticated`]:[],...t?[`${` `.repeat(r)}when ${e.name}`]:[`when ${e.name}`],...assignments(e.properties,n,o),`${` `.repeat(r)}then ${s}`,...c?[`${` `.repeat(o)}for ${i(c.type,n)}`]:[],...assignments(l,n,o)].join(`
|
|
5
|
+
`)}function structureCompletion(i,a,o,s,c){if(o.trim().length>0||s.trim().length>0)return null;let l=e(i);if(l[a])return null;let u=lastIndexWhere(i.slice(0,a),e=>r(e).trim().length>0);if(u<0||l[u])return null;let d=indentUnit(i),f=i[u].trim(),p=/^(?:command\s+\w+|specification\s+\w+|form\s+\w+\s+for\s+[\w.]+)\s*$/.test(f),m=p?Math.max(o.length,t(i[u])+d):o.length||t(i[u]),h=p?f:n(i,l,a,m);if(!h)return null;let g=p?t(i[u]):m-Math.max(1,d),_=` `.repeat(Math.max(0,m-o.length)),wrap=e=>e?{text:`${_}${e}`}:null,v=h.match(/^command\s+(\w+)\s*$/);if(v){let e=c.commands.find(e=>e.name===v[1]),n=lastIndexWhere(i,(e,n)=>n<a&&e.trim()===h&&t(e)<m);return i.slice(n+1,a).filter(e=>e.trim().length>0).some(e=>/^\s*(produces|handler)\b/.test(e))?null:!e||e.properties.length===0?wrap(newCommandBlock(v[1],c,m,d)):wrap(producesBlock(e,c,m,d))}if(/^specification\s+\w+\s*$/.test(h)&&g>=0){let e=sliceCommand(i,l,u,c);return e?wrap(specificationBlock(e.symbol,e.authorized,c,m,d)):null}let y=h.match(/^form\s+\w+\s+for\s+(?:\w+\.)*(\w+)\s*$/);if(y){let e=c.commands.find(e=>e.name===y[1]);return e?wrap(e.properties.map((e,t)=>`${t===0?``:` `.repeat(m)}field ${e.name}`).join(`
|
|
6
|
+
`)):null}return null}export{structureCompletion};
|
|
7
|
+
//# sourceMappingURL=structure-completions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structure-completions.js","names":["index","lines","matches","name","verb","subject","command","noun","symbols","event","indented","indentOf","indent","eventName","declared","inner","unit","sources","property","mappings","source","identifier","identity","concept","identityLine","properties","propertyLines","outcome","line","exampleValueFor","sliceIndex","headerIndex","fences","authorized","symbol","candidate","textBefore","textAfter","fenceMap","lineIndex","previous","withoutComment","previousLine","opensEmptyBlock","header","nearestEnclosingLine","headerIndent","pad","block","headerLine","found","form"],"sources":["../../structure-completions.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, indentOf, nearestEnclosingLine, withoutComment } from './document-context';\nimport { exampleValueFor } from './example-values';\nimport { CommandSymbol, DocumentSymbols, PropertySymbol } from './symbols';\n\n// A multi-line suggestion shown as ghost text at the cursor. The text starts at the cursor and\n// continues on following lines with absolute indentation, so inserting it needs no further work.\nexport interface StructureCompletion {\n text: string;\n}\n\nfunction lastIndexWhere(lines: string[], matches: (line: string, index: number) => boolean): number {\n for (let index = lines.length - 1; index >= 0; index--) if (matches(lines[index], index)) return index;\n return -1;\n}\n\nconst upperCamelWords = (name: string) => name.match(/[A-Z][a-z0-9]*/g) ?? [name];\n\nfunction pastTense(verb: string): string {\n if (/[^aeiou]y$/i.test(verb)) return `${verb.slice(0, -1)}ied`;\n return /e$/i.test(verb) ? `${verb}d` : `${verb}ed`;\n}\n\n// The event a command most likely produces: a declared event that names its subject, else the\n// subject followed by the past tense of the command's verb - AddProduct becomes ProductAdded.\nfunction likelyEventName(command: string, symbols: DocumentSymbols): string {\n const [verb, ...subject] = upperCamelWords(command);\n const noun = subject.join('');\n const declared = symbols.events.find(event => noun.length > 0 && event.name.startsWith(noun));\n return declared?.name ?? `${noun}${pastTense(verb)}`;\n}\n\n\n// The indentation of one level in the document, learned from its first indented line.\nfunction indentUnit(lines: string[]): number {\n const indented = lines.map(indentOf).filter(indent => indent > 0);\n return indented.length === 0 ? 4 : Math.min(...indented);\n}\n\nfunction producesBlock(command: CommandSymbol, symbols: DocumentSymbols, indent: number, unit: number): string {\n const eventName = likelyEventName(command.name, symbols);\n const declared = symbols.events.find(event => event.name === eventName);\n const inner = ' '.repeat(indent + unit);\n const sources = command.properties.filter(property => !property.isIdentifier);\n if (declared) {\n const mappings = declared.properties.filter(property => sources.some(source => source.name === property.name));\n const identifier = command.properties.find(property => property.isIdentifier);\n return [`produces ${eventName}`, ...(identifier ? [`${inner}for ${identifier.name}`] : []), ...mappings.map(property => `${inner}${property.name} = ${property.name}`)].join('\\n');\n }\n return [`produces event ${eventName}`, ...sources.map(property => `${inner}${property.name} ${property.type} = ${property.name}`)].join('\\n');\n}\n\n// What a command that has nothing yet most likely needs: the identity of the thing it acts on when a\n// concept for it is declared, the properties of the event it will most likely produce, and the production.\nfunction newCommandBlock(command: string, symbols: DocumentSymbols, indent: number, unit: number): string {\n const noun = upperCamelWords(command).slice(1).join('');\n const eventName = likelyEventName(command, symbols);\n const declared = symbols.events.find(event => event.name === eventName);\n const identity = noun.length > 0 && symbols.concepts.some(concept => concept.name === `${noun}Id`) ? `${noun[0].toLowerCase()}${noun.slice(1)}Id` : undefined;\n const identityLine = identity ? [`${identity} ${noun}Id identifier`] : [];\n const inner = ' '.repeat(indent + unit);\n const properties = (declared?.properties ?? []).filter(property => property.name !== identity);\n const propertyLines = properties.map(property => `${' '.repeat(indent)}${property.name} ${property.type}`);\n const outcome = declared\n ? [`${' '.repeat(indent)}produces ${eventName}`, ...(identity ? [`${inner}for ${identity}`] : []), ...properties.map(property => `${inner}${property.name} = ${property.name}`)]\n : [`${' '.repeat(indent)}produces event ${eventName}`];\n const lines = [...identityLine.map((line, index) => (index === 0 ? line : `${' '.repeat(indent)}${line}`)), ...propertyLines, ...outcome];\n return lines.join('\\n').trimStart();\n}\n\nfunction assignments(properties: PropertySymbol[], symbols: DocumentSymbols, indent: number): string[] {\n return properties.map(property => `${' '.repeat(indent)}${property.name} = ${exampleValueFor(property.type, symbols)}`);\n}\n\n// The command the slice enclosing a line declares, with whether it carries an authorize clause.\nfunction sliceCommand(lines: string[], fences: boolean[], headerIndex: number, symbols: DocumentSymbols) {\n let sliceIndex = -1;\n for (let index = headerIndex - 1; index >= 0; index--) {\n if (!fences[index] && /^\\s*slice\\s/.test(lines[index]) && indentOf(lines[index]) < indentOf(lines[headerIndex])) { sliceIndex = index; break; }\n }\n if (sliceIndex < 0) return undefined;\n let name: string | undefined;\n let authorized = false;\n for (let index = sliceIndex + 1; index < lines.length; index++) {\n if (lines[index].trim().length === 0 || fences[index]) continue;\n if (indentOf(lines[index]) <= indentOf(lines[sliceIndex])) break;\n const command = lines[index].trim().match(/^command\\s+(\\w+)\\s*$/);\n if (command) { name = command[1]; authorized = false; continue; }\n if (name && /^authorize\\b/.test(lines[index].trim())) authorized = true;\n }\n const symbol = symbols.commands.find(candidate => candidate.name === name);\n return symbol ? { symbol, authorized } : undefined;\n}\n\nfunction specificationBlock(command: CommandSymbol, authorized: boolean, symbols: DocumentSymbols, indent: number, unit: number): string {\n const inner = indent + unit;\n const eventName = likelyEventName(command.name, symbols);\n const identifier = command.properties.find(property => property.isIdentifier);\n const sources = command.properties.filter(property => !property.isIdentifier);\n return [\n ...(authorized ? [`given caller`, `${' '.repeat(inner)}authenticated`] : []),\n ...(authorized ? [`${' '.repeat(indent)}when ${command.name}`] : [`when ${command.name}`]),\n ...assignments(command.properties, symbols, inner),\n `${' '.repeat(indent)}then ${eventName}`,\n ...(identifier ? [`${' '.repeat(inner)}for ${exampleValueFor(identifier.type, symbols)}`] : []),\n ...assignments(sources, symbols, inner),\n ].join('\\n');\n}\n\n// Suggests the structure a block most obviously needs next - the production of a command, the\n// skeleton of a specification, the fields of a form - when the cursor rests on an empty line directly\n// inside a block that has no content yet. Returns null when nothing is obviously missing.\nexport function structureCompletion(lines: string[], lineIndex: number, textBefore: string, textAfter: string, symbols: DocumentSymbols): StructureCompletion | null {\n if (textBefore.trim().length > 0 || textAfter.trim().length > 0) return null;\n const fences = fenceMap(lines);\n if (fences[lineIndex]) return null;\n const previous = lastIndexWhere(lines.slice(0, lineIndex), line => withoutComment(line).trim().length > 0);\n if (previous < 0 || fences[previous]) return null;\n const unit = indentUnit(lines);\n const previousLine = lines[previous].trim();\n const opensEmptyBlock = /^(?:command\\s+\\w+|specification\\s+\\w+|form\\s+\\w+\\s+for\\s+[\\w.]+)\\s*$/.test(previousLine);\n // An empty block's body starts one level in; otherwise the cursor continues the lines above it.\n const indent = opensEmptyBlock ? Math.max(textBefore.length, indentOf(lines[previous]) + unit) : textBefore.length || indentOf(lines[previous]);\n const header = opensEmptyBlock ? previousLine : nearestEnclosingLine(lines, fences, lineIndex, indent);\n if (!header) return null;\n const headerIndent = opensEmptyBlock ? indentOf(lines[previous]) : indent - Math.max(1, unit);\n const pad = ' '.repeat(Math.max(0, indent - textBefore.length));\n const wrap = (block: string | undefined) => (block ? { text: `${pad}${block}` } : null);\n\n const command = header.match(/^command\\s+(\\w+)\\s*$/);\n if (command) {\n const symbol = symbols.commands.find(candidate => candidate.name === command[1]);\n const headerLine = lastIndexWhere(lines, (line, index) => index < lineIndex && line.trim() === header && indentOf(line) < indent);\n const body = lines.slice(headerLine + 1, lineIndex).filter(line => line.trim().length > 0);\n const hasOutcome = body.some(line => /^\\s*(produces|handler)\\b/.test(line));\n if (hasOutcome) return null;\n if (!symbol || symbol.properties.length === 0) return wrap(newCommandBlock(command[1], symbols, indent, unit));\n return wrap(producesBlock(symbol, symbols, indent, unit));\n }\n\n if (/^specification\\s+\\w+\\s*$/.test(header) && headerIndent >= 0) {\n const found = sliceCommand(lines, fences, previous, symbols);\n return found ? wrap(specificationBlock(found.symbol, found.authorized, symbols, indent, unit)) : null;\n }\n\n const form = header.match(/^form\\s+\\w+\\s+for\\s+(?:\\w+\\.)*(\\w+)\\s*$/);\n if (form) {\n const symbol = symbols.commands.find(candidate => candidate.name === form[1]);\n return symbol ? wrap(symbol.properties.map((property, index) => `${index === 0 ? '' : ' '.repeat(indent)}field ${property.name}`).join('\\n')) : null;\n }\n return null;\n}\n"],"mappings":"oNAaA,SAAS,eAAe,EAAiB,EAA2D,CAChG,IAAK,IAAIA,EAAQC,EAAM,OAAS,EAAGD,GAAS,EAAG,IAAS,GAAIE,EAAQD,EAAMD,GAAQA,CAAK,EAAG,OAAOA,EACjG,MAAO,EACX,CAEA,MAAM,gBAAmB,GAAiBG,EAAK,MAAM,iBAAiB,GAAK,CAACA,CAAI,EAEhF,SAAS,UAAU,EAAsB,CAErC,MADI,cAAc,KAAKC,CAAI,EAAU,GAAGA,EAAK,MAAM,EAAG,EAAE,EAAE,KACnD,MAAM,KAAKA,CAAI,EAAI,GAAGA,EAAK,GAAK,GAAGA,EAAK,GACnD,CAIA,SAAS,gBAAgB,EAAiB,EAAkC,CACxE,GAAM,CAACA,EAAM,GAAGC,GAAW,gBAAgBC,CAAO,EAC5CC,EAAOF,EAAQ,KAAK,EAAE,EAE5B,OADiBG,EAAQ,OAAO,KAAK,GAASD,EAAK,OAAS,GAAKE,EAAM,KAAK,WAAWF,CAAI,CAC7E,CAAC,EAAE,MAAQ,GAAGA,IAAO,UAAUH,CAAI,GACrD,CAIA,SAAS,WAAW,EAAyB,CACzC,IAAMM,EAAWT,EAAM,IAAIU,CAAQ,CAAC,CAAC,OAAO,GAAUC,EAAS,CAAC,EAChE,OAAOF,EAAS,SAAW,EAAI,EAAI,KAAK,IAAI,GAAGA,CAAQ,CAC3D,CAEA,SAAS,cAAc,EAAwB,EAA0B,EAAgB,EAAsB,CAC3G,IAAMG,EAAY,gBAAgBP,EAAQ,KAAME,CAAO,EACjDM,EAAWN,EAAQ,OAAO,KAAK,GAASC,EAAM,OAASI,CAAS,EAChEE,EAAQ,IAAI,OAAOH,EAASI,CAAI,EAChCC,EAAUX,EAAQ,WAAW,OAAO,GAAY,CAACY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I,CAAC,EACtG,KAAK,cAAckB,EAAQ1B,EAASI,EAAQI,CAAI,CAAC,CAC5D,CAEA,GAAI,2BAA2B,KAAK4B,CAAM,GAAKE,GAAgB,EAAG,CAC9D,IAAMI,EAAQ,aAAajD,EAAO+B,EAAQQ,EAAUhC,CAAO,EAC3D,OAAO0C,EAAQ,KAAK,mBAAmBA,EAAM,OAAQA,EAAM,WAAY1C,EAASI,EAAQI,CAAI,CAAC,EAAI,IACrG,CAEA,IAAMmC,EAAOP,EAAO,MAAM,yCAAyC,EACnE,GAAIO,EAAM,CACN,IAAMjB,EAAS1B,EAAQ,SAAS,KAAK,GAAa2B,EAAU,OAASgB,EAAK,EAAE,EAC5E,OAAOjB,EAAS,KAAKA,EAAO,WAAW,KAAK,EAAU,IAAU,GAAGlC,IAAU,EAAI,GAAK,IAAI,OAAOY,CAAM,EAAE,QAAQM,EAAS,MAAM,CAAC,CAAC,KAAK;CAAI,CAAC,EAAI,IACpJ,CACA,OAAO,IACX"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./_virtual/_virtual/_rolldown/runtime.js";const e=/* @__PURE__ */ new Map,t=/* @__PURE__ */ new Set;function registerSubLanguage(n,r){e.set(n,{keyword:n,...r}),t.forEach(e=>e())}function getSubLanguages(){return[...e.values()]}function getSubLanguage(t){return e.get(t)}function onSubLanguagesChanged(e){t.add(e)}export{getSubLanguage,getSubLanguages,onSubLanguagesChanged,registerSubLanguage};
|
|
2
|
+
//# sourceMappingURL=sub-language-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sub-language-registry.js","names":["subLanguages","listeners","keyword","definition","listener"],"sources":["../../sub-language-registry.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 type { languages } from 'monaco-editor';\n\nexport type MonarchTokenRules = languages.IMonarchLanguage['tokenizer'][string];\n\nexport interface SubLanguageCompletion {\n label: string;\n insertText: string;\n documentation: string;\n}\n\nexport interface SubLanguageDefinition {\n tokens: MonarchTokenRules;\n completions?: SubLanguageCompletion[];\n hovers?: Record<string, string>;\n}\n\nexport interface SubLanguage extends SubLanguageDefinition {\n keyword: string;\n}\n\nconst subLanguages = new Map<string, SubLanguage>();\nconst listeners = new Set<() => void>();\n\nexport function registerSubLanguage(keyword: string, definition: SubLanguageDefinition): void {\n subLanguages.set(keyword, { keyword, ...definition });\n listeners.forEach((listener) => listener());\n}\n\nexport function getSubLanguages(): SubLanguage[] {\n return [...subLanguages.values()];\n}\n\nexport function getSubLanguage(keyword: string): SubLanguage | undefined {\n return subLanguages.get(keyword);\n}\n\nexport function onSubLanguagesChanged(listener: () => void): void {\n listeners.add(listener);\n}\n"],"mappings":"iDAuBA,MAAMA,kBAAe,IAAI,IACnBC,kBAAY,IAAI,IAEtB,SAAgB,oBAAoB,EAAiB,EAAyC,CAC1FD,EAAa,IAAIE,EAAS,CAAE,UAAS,GAAGC,CAAW,CAAC,EACpDF,EAAU,QAAS,GAAaG,EAAS,CAAC,CAC9C,CAEA,SAAgB,iBAAiC,CAC7C,MAAO,CAAC,GAAGJ,EAAa,OAAO,CAAC,CACpC,CAEA,SAAgB,eAAe,EAA0C,CACrE,OAAOA,EAAa,IAAIE,CAAO,CACnC,CAEA,SAAgB,sBAAsB,EAA4B,CAC9DD,EAAU,IAAIG,CAAQ,CAC1B"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{languages as e}from"monaco-editor";const t=[`id`,`status`,`firstName`,`lastName`,`fullName`,`address.street`,`address.city`,`lineItems`,`lineItems.quantity`,`lineNumber`,`quantity`];var CompletionProvider=class{triggerCharacters=[`.`,` `,`=`,`$`];provideCompletionItems(e,t){let n=this.buildContext(e,t),r=[];return n.lineNumber===1?this.addCaptureLineCompletions(r,n):this.isAfterKeyword(n,`capture`)?this.addCaptureNameCompletions(r,n):this.isAfterKeyword(n,`source`)?this.addSourceTypeCompletions(r,n):this.isAfterAppendKeyword(n)?this.addAppendNameCompletions(r,n):this.isAfterWhenKeyword(n)?this.addWhenCompletions(r,n):this.isAfterWhenFrom(n)?this.addFromValueCompletions(r,n):this.isAfterWhenTo(n)?this.addToValueCompletions(r,n):this.isAfterContextPrefix(n,`$.`)?this.addPathCompletions(r,n,`$.`):this.isAfterContextPrefix(n,`$previous.`)?this.addPathCompletions(r,n,`$previous.`):this.isAfterContextPrefix(n,`$context.`)?this.addContextCompletions(r,n):this.isAfterContextPrefix(n,`$env.`)?this.addEnvironmentCompletions(r,n):this.isAfterAssignment(n)?this.addAssignmentValueCompletions(r,n):(this.isStartOfLine(n)||this.isAfterIndent(n))&&n.indentLevel===1?this.addTopLevelStatementCompletions(r,n):(this.isStartOfLine(n)||this.isAfterIndent(n))&&n.indentLevel>=2&&this.addSourceBlockCompletions(r,n,this.getCurrentSourceType(e,t.lineNumber)),{suggestions:r}}buildContext(e,t){let n=e.getLineContent(t.lineNumber).substring(0,t.column-1),r=e.getWordUntilPosition(t);return{textBeforeCursor:n,currentWord:r.word||``,indentLevel:this.getIndentLevel(n),lineNumber:t.lineNumber,wordStartColumn:r.startColumn,wordEndColumn:r.endColumn}}getIndentLevel(e){let t=e.match(/^(\s*)/);return t?Math.floor(t[1].length/2):0}isStartOfLine(e){return e.textBeforeCursor.trim()===``}isAfterIndent(e){return/^\s+$/.test(e.textBeforeCursor)}isAfterKeyword(e,t){return RegExp(`\\b${t}\\s+\\w*$`).test(e.textBeforeCursor)}isAfterAppendKeyword(e){return/\bappend\s+[\w.]*$/.test(e.textBeforeCursor)}isAfterWhenKeyword(e){return/\bwhen\s+[\w.]*$/.test(e.textBeforeCursor)}isAfterWhenFrom(e){return/\bwhen\s+[\w.]+\s+from\s+[^\s]*$/.test(e.textBeforeCursor)}isAfterWhenTo(e){return/\bwhen\s+[\w.]+\s+from\s+\S+\s+to\s+[^\s]*$/.test(e.textBeforeCursor)}isAfterAssignment(e){return/=\s*([$\w.]*)$/.test(e.textBeforeCursor)}isAfterContextPrefix(e,t){return e.textBeforeCursor.endsWith(t)}addCaptureLineCompletions(t,n){let r=n.textBeforeCursor.trim();(r===``||`capture`.startsWith(r))&&t.push({label:`capture`,kind:e.CompletionItemKind.Keyword,insertText:`capture `,documentation:`Define a capture declaration`,detail:`capture <Name>`,range:this.getRangeForWord(n)}),r.startsWith(`capture `)&&this.addCaptureNameCompletions(t,n)}addCaptureNameCompletions(t,n){t.push({label:`CaptureDefinition`,kind:e.CompletionItemKind.Class,insertText:`CaptureDefinition`,documentation:`A descriptive name for this capture declaration`,detail:`Capture name`,range:this.getRangeForWord(n)})}addSourceTypeCompletions(t,n){[{label:`api`,detail:`source api`,documentation:`Capture data by polling an HTTP API`},{label:`webhook`,detail:`source webhook`,documentation:`Capture data from incoming webhook requests`},{label:`message`,detail:`source message`,documentation:`Capture data from a message topic`},{label:`events`,detail:`source events`,documentation:`Capture another application's public events (inbound translation); each 'from <Event>' names one consumed event`}].forEach(r=>{t.push({label:r.label,kind:e.CompletionItemKind.Keyword,insertText:r.label,documentation:r.documentation,detail:r.detail,range:this.getRangeForWord(n)})})}addSourceBlockCompletions(t,n,r){(r?{api:[{label:`api`,detail:`api <ServiceName>`,documentation:`References a configured External Service by name for the base URL and authentication`},{label:`route`,detail:`route <path>`,documentation:`Optional path appended to the External Service base URL; if omitted, the base URL is used as-is`},{label:`poll`,detail:`poll <interval>`,documentation:`The polling interval, for example 5m`}],webhook:[{label:`path`,detail:`path <route>`,documentation:`The inbound path this webhook listens on`}],events:[{label:`from`,detail:`from <Event>`,documentation:`Names a public event of another application to consume; repeat for more events`}],message:[{label:`topic`,detail:`topic <name>`,documentation:`The topic or subject to subscribe to`}]}[r]??[]:[]).forEach(r=>{t.push({label:r.label,kind:e.CompletionItemKind.Keyword,insertText:`${r.label} `,documentation:r.documentation,detail:r.detail,range:this.getRangeForWord(n)})})}addTopLevelStatementCompletions(t,n){[{label:`key`,insertText:`key `,detail:`key <property>`,documentation:`Identify the captured entity`},{label:`map`,insertText:`map`,detail:`map`,documentation:`Map captured fields into a normalized shape`},{label:`append`,insertText:`append `,detail:`append <EventName>`,documentation:`Append an event when a condition matches`},{label:`nested`,insertText:`nested `,detail:`nested <property>`,documentation:`Create a nested mapping scope`},{label:`children`,insertText:`children `,detail:`children <collection> identified by <property>`,documentation:`Handle child collections independently`}].forEach(r=>{t.push({label:r.label,kind:e.CompletionItemKind.Keyword,insertText:r.insertText,documentation:r.documentation,detail:r.detail,range:this.getRangeForWord(n)})})}addAppendNameCompletions(t,n){t.push({label:`ItemChanged`,kind:e.CompletionItemKind.Class,insertText:`ItemChanged`,documentation:`A generic event name for the appended event`,detail:`Event name`,range:this.getRangeForWord(n)})}addWhenCompletions(t,n){[{label:`added`,insertText:`added`,detail:`when added`,documentation:`Append when a child item was added`},{label:`removed`,insertText:`removed`,detail:`when removed`,documentation:`Append when a child item was removed`},{label:`status`,insertText:`status`,detail:`when <property>`,documentation:`Append when a property changed`},{label:`status transition`,insertText:`status from inactive to active`,detail:`when <property> from <value> to <value>`,documentation:`Append when a property changed between two values`},{label:`quantity`,insertText:`quantity`,detail:`when <property>`,documentation:`Append when a property changed`},{label:`lineNumber`,insertText:`lineNumber`,detail:`when <property>`,documentation:`Append when a specific property changed`}].forEach(r=>{t.push({label:r.label,kind:e.CompletionItemKind.Keyword,insertText:r.insertText,documentation:r.documentation,detail:r.detail,range:this.getRangeForWord(n)})})}addFromValueCompletions(t,n){[{label:`*`,insertText:`*`,detail:`Wildcard`,documentation:`Match any previous value`},{label:`inactive`,insertText:`inactive`,detail:`Common value`,documentation:`A common previous state value`},{label:`active`,insertText:`active`,detail:`Common value`,documentation:`A common previous state value`},{label:`true`,insertText:`true`,detail:`Boolean value`,documentation:`Boolean true`},{label:`false`,insertText:`false`,detail:`Boolean value`,documentation:`Boolean false`}].forEach(r=>{t.push({label:r.label,kind:e.CompletionItemKind.Value,insertText:r.insertText,documentation:r.documentation,detail:r.detail,range:this.getRangeForWord(n)})})}addToValueCompletions(t,n){[`active`,`inactive`,`pending`,`true`,`false`].forEach(r=>{t.push({label:r,kind:e.CompletionItemKind.Value,insertText:r,documentation:`Common target value: ${r}`,detail:`Target value`,range:this.getRangeForWord(n)})})}addAssignmentValueCompletions(t,n){[{label:`$.`,insertText:`$.`,detail:`Current captured value`,documentation:`Reference the current captured payload`},{label:`$previous.`,insertText:`$previous.`,detail:`Previous captured value`,documentation:`Reference the previous state of the payload`},{label:`$context.occurred`,insertText:`$context.occurred`,detail:`Occurred timestamp`,documentation:`When the capture source produced the current data`},{label:`$context.eventSourceId`,insertText:`$context.eventSourceId`,detail:`Event source identifier`,documentation:`The resolved event source identifier for the append operation`},{label:`$env.`,insertText:`$env.`,detail:`Environment variable`,documentation:`Read an environment variable`}].forEach(r=>{t.push({label:r.label,kind:e.CompletionItemKind.Variable,insertText:r.insertText,documentation:r.documentation,detail:r.detail,range:this.getRangeForWord(n)})})}addPathCompletions(n,r,i){t.forEach(t=>{n.push({label:t,kind:e.CompletionItemKind.Property,insertText:`${i}${t}`,documentation:`Common property path: ${i}${t}`,detail:i===`$.`?`Current value path`:`Previous value path`,range:this.getRangeForWord(r)})})}addContextCompletions(t,n){[{label:`occurred`,insertText:`$context.occurred`,detail:`When the event occurred`,documentation:`Timestamp for when the append event happened`},{label:`eventSourceId`,insertText:`$context.eventSourceId`,detail:`Event source identifier`,documentation:`The event source identifier used for the appended event`}].forEach(r=>{t.push({label:r.label,kind:e.CompletionItemKind.Property,insertText:r.insertText,documentation:r.documentation,detail:r.detail,range:this.getRangeForWord(n)})})}addEnvironmentCompletions(t,n){t.push({label:`API_TOKEN`,kind:e.CompletionItemKind.Variable,insertText:`$env.API_TOKEN`,documentation:`Placeholder environment variable reference`,detail:`Environment variable`,range:this.getRangeForWord(n)})}getCurrentSourceType(e,t){for(let n=t;n>=1;n--){let t=e.getLineContent(n).trim().match(/^source\s+(api|webhook|message|events)\b/);if(t)return t[1]}return null}getRangeForWord(e){return{startLineNumber:e.lineNumber,endLineNumber:e.lineNumber,startColumn:e.wordStartColumn,endColumn:e.wordEndColumn}}};export{CompletionProvider};
|
|
2
|
+
//# sourceMappingURL=CompletionProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompletionProvider.js","names":["commonPropertyPaths","context","model","position","suggestions","textBeforeCursor","word","match","text","keyword","prefix","trimmed","languages","source","sourceType","option","statement","value","path","index","lineNumber"],"sources":["../../../../sub-languages/capture/CompletionProvider.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 { languages, type editor, type Position, type IRange } from 'monaco-editor';\n\ninterface CompletionContext {\n textBeforeCursor: string;\n currentWord: string;\n indentLevel: number;\n lineNumber: number;\n wordStartColumn: number;\n wordEndColumn: number;\n}\n\nconst commonPropertyPaths = [\n 'id',\n 'status',\n 'firstName',\n 'lastName',\n 'fullName',\n 'address.street',\n 'address.city',\n 'lineItems',\n 'lineItems.quantity',\n 'lineNumber',\n 'quantity',\n];\n\nexport class CompletionProvider implements languages.CompletionItemProvider {\n triggerCharacters = ['.', ' ', '=', '$'];\n\n provideCompletionItems(\n model: editor.ITextModel,\n position: Position,\n ): languages.ProviderResult<languages.CompletionList> {\n const context = this.buildContext(model, position);\n const suggestions: languages.CompletionItem[] = [];\n\n if (context.lineNumber === 1) {\n this.addCaptureLineCompletions(suggestions, context);\n } else if (this.isAfterKeyword(context, 'capture')) {\n this.addCaptureNameCompletions(suggestions, context);\n } else if (this.isAfterKeyword(context, 'source')) {\n this.addSourceTypeCompletions(suggestions, context);\n } else if (this.isAfterAppendKeyword(context)) {\n this.addAppendNameCompletions(suggestions, context);\n } else if (this.isAfterWhenKeyword(context)) {\n this.addWhenCompletions(suggestions, context);\n } else if (this.isAfterWhenFrom(context)) {\n this.addFromValueCompletions(suggestions, context);\n } else if (this.isAfterWhenTo(context)) {\n this.addToValueCompletions(suggestions, context);\n } else if (this.isAfterContextPrefix(context, '$.')) {\n this.addPathCompletions(suggestions, context, '$.');\n } else if (this.isAfterContextPrefix(context, '$previous.')) {\n this.addPathCompletions(suggestions, context, '$previous.');\n } else if (this.isAfterContextPrefix(context, '$context.')) {\n this.addContextCompletions(suggestions, context);\n } else if (this.isAfterContextPrefix(context, '$env.')) {\n this.addEnvironmentCompletions(suggestions, context);\n } else if (this.isAfterAssignment(context)) {\n this.addAssignmentValueCompletions(suggestions, context);\n } else if ((this.isStartOfLine(context) || this.isAfterIndent(context)) && context.indentLevel === 1) {\n this.addTopLevelStatementCompletions(suggestions, context);\n } else if ((this.isStartOfLine(context) || this.isAfterIndent(context)) && context.indentLevel >= 2) {\n this.addSourceBlockCompletions(suggestions, context, this.getCurrentSourceType(model, position.lineNumber));\n }\n\n return { suggestions };\n }\n\n private buildContext(model: editor.ITextModel, position: Position): CompletionContext {\n const lineContent = model.getLineContent(position.lineNumber);\n const textBeforeCursor = lineContent.substring(0, position.column - 1);\n const word = model.getWordUntilPosition(position);\n\n return {\n textBeforeCursor,\n currentWord: word.word || '',\n indentLevel: this.getIndentLevel(textBeforeCursor),\n lineNumber: position.lineNumber,\n wordStartColumn: word.startColumn,\n wordEndColumn: word.endColumn,\n };\n }\n\n private getIndentLevel(text: string): number {\n const match = text.match(/^(\\s*)/);\n return match ? Math.floor(match[1].length / 2) : 0;\n }\n\n private isStartOfLine(context: CompletionContext): boolean {\n return context.textBeforeCursor.trim() === '';\n }\n\n private isAfterIndent(context: CompletionContext): boolean {\n return /^\\s+$/.test(context.textBeforeCursor);\n }\n\n private isAfterKeyword(context: CompletionContext, keyword: string): boolean {\n const pattern = new RegExp(`\\\\b${keyword}\\\\s+\\\\w*$`);\n return pattern.test(context.textBeforeCursor);\n }\n\n private isAfterAppendKeyword(context: CompletionContext): boolean {\n return /\\bappend\\s+[\\w.]*$/.test(context.textBeforeCursor);\n }\n\n private isAfterWhenKeyword(context: CompletionContext): boolean {\n return /\\bwhen\\s+[\\w.]*$/.test(context.textBeforeCursor);\n }\n\n private isAfterWhenFrom(context: CompletionContext): boolean {\n return /\\bwhen\\s+[\\w.]+\\s+from\\s+[^\\s]*$/.test(context.textBeforeCursor);\n }\n\n private isAfterWhenTo(context: CompletionContext): boolean {\n return /\\bwhen\\s+[\\w.]+\\s+from\\s+\\S+\\s+to\\s+[^\\s]*$/.test(context.textBeforeCursor);\n }\n\n private isAfterAssignment(context: CompletionContext): boolean {\n return /=\\s*([$\\w.]*)$/.test(context.textBeforeCursor);\n }\n\n private isAfterContextPrefix(context: CompletionContext, prefix: string): boolean {\n return context.textBeforeCursor.endsWith(prefix);\n }\n\n private addCaptureLineCompletions(suggestions: languages.CompletionItem[], context: CompletionContext): void {\n const trimmed = context.textBeforeCursor.trim();\n if (trimmed === '' || 'capture'.startsWith(trimmed)) {\n suggestions.push({\n label: 'capture',\n kind: languages.CompletionItemKind.Keyword,\n insertText: 'capture ',\n documentation: 'Define a capture declaration',\n detail: 'capture <Name>',\n range: this.getRangeForWord(context),\n });\n }\n\n if (trimmed.startsWith('capture ')) {\n this.addCaptureNameCompletions(suggestions, context);\n }\n }\n\n private addCaptureNameCompletions(suggestions: languages.CompletionItem[], context: CompletionContext): void {\n suggestions.push({\n label: 'CaptureDefinition',\n kind: languages.CompletionItemKind.Class,\n insertText: 'CaptureDefinition',\n documentation: 'A descriptive name for this capture declaration',\n detail: 'Capture name',\n range: this.getRangeForWord(context),\n });\n }\n\n private addSourceTypeCompletions(suggestions: languages.CompletionItem[], context: CompletionContext): void {\n [\n { label: 'api', detail: 'source api', documentation: 'Capture data by polling an HTTP API' },\n { label: 'webhook', detail: 'source webhook', documentation: 'Capture data from incoming webhook requests' },\n { label: 'message', detail: 'source message', documentation: 'Capture data from a message topic' },\n { label: 'events', detail: 'source events', documentation: \"Capture another application's public events (inbound translation); each 'from <Event>' names one consumed event\" },\n ].forEach((source) => {\n suggestions.push({\n label: source.label,\n kind: languages.CompletionItemKind.Keyword,\n insertText: source.label,\n documentation: source.documentation,\n detail: source.detail,\n range: this.getRangeForWord(context),\n });\n });\n }\n\n // Per source type — no `auth`/`bearer`/`url`: an API source references a named\n // External Service (`api <ServiceName>`) for base URL and auth; a webhook source's\n // authentication is configured on the source builder, not in CDL text.\n private addSourceBlockCompletions(suggestions: languages.CompletionItem[], context: CompletionContext, sourceType: string | null): void {\n const options: Record<string, Array<{ label: string; detail: string; documentation: string }>> = {\n api: [\n { label: 'api', detail: 'api <ServiceName>', documentation: 'References a configured External Service by name for the base URL and authentication' },\n { label: 'route', detail: 'route <path>', documentation: 'Optional path appended to the External Service base URL; if omitted, the base URL is used as-is' },\n { label: 'poll', detail: 'poll <interval>', documentation: 'The polling interval, for example 5m' },\n ],\n webhook: [\n { label: 'path', detail: 'path <route>', documentation: 'The inbound path this webhook listens on' },\n ],\n events: [\n { label: 'from', detail: 'from <Event>', documentation: \"Names a public event of another application to consume; repeat for more events\" },\n ],\n message: [\n { label: 'topic', detail: 'topic <name>', documentation: 'The topic or subject to subscribe to' },\n ],\n };\n\n (sourceType ? options[sourceType] ?? [] : []).forEach((option) => {\n suggestions.push({\n label: option.label,\n kind: languages.CompletionItemKind.Keyword,\n insertText: `${option.label} `,\n documentation: option.documentation,\n detail: option.detail,\n range: this.getRangeForWord(context),\n });\n });\n }\n\n private addTopLevelStatementCompletions(suggestions: languages.CompletionItem[], context: CompletionContext): void {\n [\n { label: 'key', insertText: 'key ', detail: 'key <property>', documentation: 'Identify the captured entity' },\n { label: 'map', insertText: 'map', detail: 'map', documentation: 'Map captured fields into a normalized shape' },\n { label: 'append', insertText: 'append ', detail: 'append <EventName>', documentation: 'Append an event when a condition matches' },\n { label: 'nested', insertText: 'nested ', detail: 'nested <property>', documentation: 'Create a nested mapping scope' },\n { label: 'children', insertText: 'children ', detail: 'children <collection> identified by <property>', documentation: 'Handle child collections independently' },\n ].forEach((statement) => {\n suggestions.push({\n label: statement.label,\n kind: languages.CompletionItemKind.Keyword,\n insertText: statement.insertText,\n documentation: statement.documentation,\n detail: statement.detail,\n range: this.getRangeForWord(context),\n });\n });\n }\n\n private addAppendNameCompletions(suggestions: languages.CompletionItem[], context: CompletionContext): void {\n suggestions.push({\n label: 'ItemChanged',\n kind: languages.CompletionItemKind.Class,\n insertText: 'ItemChanged',\n documentation: 'A generic event name for the appended event',\n detail: 'Event name',\n range: this.getRangeForWord(context),\n });\n }\n\n private addWhenCompletions(suggestions: languages.CompletionItem[], context: CompletionContext): void {\n [\n { label: 'added', insertText: 'added', detail: 'when added', documentation: 'Append when a child item was added' },\n { label: 'removed', insertText: 'removed', detail: 'when removed', documentation: 'Append when a child item was removed' },\n { label: 'status', insertText: 'status', detail: 'when <property>', documentation: 'Append when a property changed' },\n { label: 'status transition', insertText: 'status from inactive to active', detail: 'when <property> from <value> to <value>', documentation: 'Append when a property changed between two values' },\n { label: 'quantity', insertText: 'quantity', detail: 'when <property>', documentation: 'Append when a property changed' },\n { label: 'lineNumber', insertText: 'lineNumber', detail: 'when <property>', documentation: 'Append when a specific property changed' },\n ].forEach((option) => {\n suggestions.push({\n label: option.label,\n kind: languages.CompletionItemKind.Keyword,\n insertText: option.insertText,\n documentation: option.documentation,\n detail: option.detail,\n range: this.getRangeForWord(context),\n });\n });\n }\n\n private addFromValueCompletions(suggestions: languages.CompletionItem[], context: CompletionContext): void {\n [\n { label: '*', insertText: '*', detail: 'Wildcard', documentation: 'Match any previous value' },\n { label: 'inactive', insertText: 'inactive', detail: 'Common value', documentation: 'A common previous state value' },\n { label: 'active', insertText: 'active', detail: 'Common value', documentation: 'A common previous state value' },\n { label: 'true', insertText: 'true', detail: 'Boolean value', documentation: 'Boolean true' },\n { label: 'false', insertText: 'false', detail: 'Boolean value', documentation: 'Boolean false' },\n ].forEach((option) => {\n suggestions.push({\n label: option.label,\n kind: languages.CompletionItemKind.Value,\n insertText: option.insertText,\n documentation: option.documentation,\n detail: option.detail,\n range: this.getRangeForWord(context),\n });\n });\n }\n\n private addToValueCompletions(suggestions: languages.CompletionItem[], context: CompletionContext): void {\n ['active', 'inactive', 'pending', 'true', 'false'].forEach((value) => {\n suggestions.push({\n label: value,\n kind: languages.CompletionItemKind.Value,\n insertText: value,\n documentation: `Common target value: ${value}`,\n detail: 'Target value',\n range: this.getRangeForWord(context),\n });\n });\n }\n\n private addAssignmentValueCompletions(suggestions: languages.CompletionItem[], context: CompletionContext): void {\n [\n { label: '$.', insertText: '$.', detail: 'Current captured value', documentation: 'Reference the current captured payload' },\n { label: '$previous.', insertText: '$previous.', detail: 'Previous captured value', documentation: 'Reference the previous state of the payload' },\n { label: '$context.occurred', insertText: '$context.occurred', detail: 'Occurred timestamp', documentation: 'When the capture source produced the current data' },\n { label: '$context.eventSourceId', insertText: '$context.eventSourceId', detail: 'Event source identifier', documentation: 'The resolved event source identifier for the append operation' },\n { label: '$env.', insertText: '$env.', detail: 'Environment variable', documentation: 'Read an environment variable' },\n ].forEach((option) => {\n suggestions.push({\n label: option.label,\n kind: languages.CompletionItemKind.Variable,\n insertText: option.insertText,\n documentation: option.documentation,\n detail: option.detail,\n range: this.getRangeForWord(context),\n });\n });\n }\n\n private addPathCompletions(suggestions: languages.CompletionItem[], context: CompletionContext, prefix: string): void {\n commonPropertyPaths.forEach((path) => {\n suggestions.push({\n label: path,\n kind: languages.CompletionItemKind.Property,\n insertText: `${prefix}${path}`,\n documentation: `Common property path: ${prefix}${path}`,\n detail: prefix === '$.' ? 'Current value path' : 'Previous value path',\n range: this.getRangeForWord(context),\n });\n });\n }\n\n private addContextCompletions(suggestions: languages.CompletionItem[], context: CompletionContext): void {\n [\n { label: 'occurred', insertText: '$context.occurred', detail: 'When the event occurred', documentation: 'Timestamp for when the append event happened' },\n { label: 'eventSourceId', insertText: '$context.eventSourceId', detail: 'Event source identifier', documentation: 'The event source identifier used for the appended event' },\n ].forEach((option) => {\n suggestions.push({\n label: option.label,\n kind: languages.CompletionItemKind.Property,\n insertText: option.insertText,\n documentation: option.documentation,\n detail: option.detail,\n range: this.getRangeForWord(context),\n });\n });\n }\n\n private addEnvironmentCompletions(suggestions: languages.CompletionItem[], context: CompletionContext): void {\n suggestions.push({\n label: 'API_TOKEN',\n kind: languages.CompletionItemKind.Variable,\n insertText: '$env.API_TOKEN',\n documentation: 'Placeholder environment variable reference',\n detail: 'Environment variable',\n range: this.getRangeForWord(context),\n });\n }\n\n private getCurrentSourceType(model: editor.ITextModel, lineNumber: number): string | null {\n for (let index = lineNumber; index >= 1; index--) {\n const line = model.getLineContent(index).trim();\n const match = line.match(/^source\\s+(api|webhook|message|events)\\b/);\n if (match) {\n return match[1];\n }\n }\n return null;\n }\n\n private getRangeForWord(context: CompletionContext): IRange {\n return {\n startLineNumber: context.lineNumber,\n endLineNumber: context.lineNumber,\n startColumn: context.wordStartColumn,\n endColumn: context.wordEndColumn,\n };\n }\n}\n"],"mappings":"+FAcA,MAAMA,EAAsB,CACxB,KACA,SACA,YACA,WACA,WACA,iBACA,eACA,YACA,qBACA,aACA,UACJ,EAEA,IAAa,mBAAb,KAA4E,CACxE,kBAAoB,CAAC,IAAK,IAAK,IAAK,GAAG,EAEvC,uBACI,EACA,EACkD,CAClD,IAAMC,EAAU,KAAK,aAAaC,EAAOC,CAAQ,EAC3CC,EAA0C,CAAC,EAgCjD,OA9BIH,EAAQ,aAAe,EACvB,KAAK,0BAA0BG,EAAaH,CAAO,EAC5C,KAAK,eAAeA,EAAS,SAAS,EAC7C,KAAK,0BAA0BG,EAAaH,CAAO,EAC5C,KAAK,eAAeA,EAAS,QAAQ,EAC5C,KAAK,yBAAyBG,EAAaH,CAAO,EAC3C,KAAK,qBAAqBA,CAAO,EACxC,KAAK,yBAAyBG,EAAaH,CAAO,EAC3C,KAAK,mBAAmBA,CAAO,EACtC,KAAK,mBAAmBG,EAAaH,CAAO,EACrC,KAAK,gBAAgBA,CAAO,EACnC,KAAK,wBAAwBG,EAAaH,CAAO,EAC1C,KAAK,cAAcA,CAAO,EACjC,KAAK,sBAAsBG,EAAaH,CAAO,EACxC,KAAK,qBAAqBA,EAAS,IAAI,EAC9C,KAAK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ACJ"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";var HoverProvider=class{provideHover(e,t){let n=this.getTokenAtPosition(e,t);if(!n)return null;let r=this.getKeywordInfo(n.word);if(r)return{contents:[{value:r}],range:n.range};let i=this.getExpressionInfo(n.word);return i?{contents:[{value:i}],range:n.range}:null}getTokenAtPosition(e,t){let n=[...e.getLineContent(t.lineNumber).matchAll(/\$context|\$identity|\$previous|\$env|[a-zA-Z_][\w-]*/g)],r=t.column-1;for(let e of n){let n=e.index??0,i=n+e[0].length;if(r>=n&&r<=i)return{word:e[0],range:{startLineNumber:t.lineNumber,endLineNumber:t.lineNumber,startColumn:n+1,endColumn:i+1}}}return null}getKeywordInfo(e){return{capture:`**capture** *<Name>*
|
|
2
|
+
|
|
3
|
+
Declares a capture and gives it a unique name.`,source:`**source** *<type>*
|
|
4
|
+
|
|
5
|
+
Defines where the capture reads input from.`,key:`**key** *<property>*
|
|
6
|
+
|
|
7
|
+
Selects the property used to identify each captured item.`,map:`**map**
|
|
8
|
+
|
|
9
|
+
Maps source fields into a normalized shape for later append blocks.`,append:`**append** *<EventName>*
|
|
10
|
+
|
|
11
|
+
Declares an event to append when the \`when\` clause matches.`,when:`**when** *<condition>*
|
|
12
|
+
|
|
13
|
+
Specifies when an append block should fire.`,nested:`**nested** *<property>*
|
|
14
|
+
|
|
15
|
+
Creates a nested mapping scope for an object property.`,children:`**children** *<collection>* **identified by** *<property>*
|
|
16
|
+
|
|
17
|
+
Creates a scope for child collection items.`,identified:`**identified**
|
|
18
|
+
|
|
19
|
+
Used with \`children\` to declare how child items are identified.`,by:"**by**\n\nUsed in `children ... identified by`, `split ... by`, and similar clauses.",api:`**api**
|
|
20
|
+
|
|
21
|
+
As a source type (\`source api\`): polls an HTTP API for changes.
|
|
22
|
+
|
|
23
|
+
As a source property (\`api <ServiceName>\`): references a configured External Service by name for the base URL and authentication.`,webhook:`**webhook**
|
|
24
|
+
|
|
25
|
+
A source type for receiving webhook payloads.`,message:`**message**
|
|
26
|
+
|
|
27
|
+
A source type for consuming messages from a topic.`,events:"**events**\n\nA source type for consuming the public events of another application: `source events` with one `from <Event>` line per event. Inbound Translate slices only; admitted by executable semantic model (ESM) v9. The reference runner reports a typed Unsupported outcome for `when capture` over it.",route:`**route** *<path>*
|
|
28
|
+
|
|
29
|
+
Optional path appended to an API source's External Service base URL. If omitted, the base URL is used as-is.`,poll:`**poll** *<interval>*
|
|
30
|
+
|
|
31
|
+
Sets the polling interval for an API source.`,path:`**path** *<route>*
|
|
32
|
+
|
|
33
|
+
The inbound path a webhook source listens on.`,topic:`**topic** *<name>*
|
|
34
|
+
|
|
35
|
+
Configures the topic for a message source.`,from:"**from** *<value>*\n\nUsed in a `when` clause to match the previous value, and under `source events` to name a consumed public event (`from <Event>`).",to:`**to** *<value>*
|
|
36
|
+
|
|
37
|
+
Used in a \`when\` clause to match the new value.`,or:`**or**
|
|
38
|
+
|
|
39
|
+
Combines multiple \`when\` conditions.`,and:`**and**
|
|
40
|
+
|
|
41
|
+
Combines multiple \`when\` conditions that must all match.`,added:`**added**
|
|
42
|
+
|
|
43
|
+
Matches when a child item was added.`,removed:`**removed**
|
|
44
|
+
|
|
45
|
+
Matches when a child item was removed.`,translate:`**translate**
|
|
46
|
+
|
|
47
|
+
Maps source values to new values inside a \`map\` block.`,split:`**split** *<value>* **by** *<separator>*
|
|
48
|
+
|
|
49
|
+
Splits a string into multiple mapped fields.`}[e]||null}getExpressionInfo(e){return{$context:`**$context**
|
|
50
|
+
|
|
51
|
+
Capture execution context.
|
|
52
|
+
|
|
53
|
+
**Properties:**
|
|
54
|
+
- \`occurred\` - When the current event should be considered to have occurred
|
|
55
|
+
- \`eventSourceId\` - The resolved event source identifier`,$identity:"**$identity**\n\nThe caller, equivalent to `$context.identity`. Properties: `id`, `name`, `userName`, `isAuthenticated`, `roles`, `claims`. Caller mappings are not portable capture inputs (PLAY0268).",$previous:`**$previous**
|
|
56
|
+
|
|
57
|
+
The previous state for the captured item. Use dot notation such as \`$previous.status\`.`,$env:`**$env**
|
|
58
|
+
|
|
59
|
+
Environment variables. Use dot notation such as \`$env.API_TOKEN\`.`}[e]||null}};export{HoverProvider};
|
|
60
|
+
//# sourceMappingURL=HoverProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HoverProvider.js","names":["token","model","position","keywordInfo","expressionInfo","tokens","column","startIndex","endIndex","word","\"$context\"","\"$identity\"","\"$previous\"","\"$env\""],"sources":["../../../../sub-languages/capture/HoverProvider.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 type { editor, languages, Position, IRange } from 'monaco-editor';\n\nexport class HoverProvider implements languages.HoverProvider {\n provideHover(model: editor.ITextModel, position: Position): languages.ProviderResult<languages.Hover> {\n const token = this.getTokenAtPosition(model, position);\n if (!token) {\n return null;\n }\n\n const keywordInfo = this.getKeywordInfo(token.word);\n if (keywordInfo) {\n return {\n contents: [{ value: keywordInfo }],\n range: token.range,\n };\n }\n\n const expressionInfo = this.getExpressionInfo(token.word);\n if (expressionInfo) {\n return {\n contents: [{ value: expressionInfo }],\n range: token.range,\n };\n }\n\n return null;\n }\n\n private getTokenAtPosition(model: editor.ITextModel, position: Position): { word: string; range: IRange } | null {\n const lineContent = model.getLineContent(position.lineNumber);\n const tokens = [...lineContent.matchAll(/\\$context|\\$identity|\\$previous|\\$env|[a-zA-Z_][\\w-]*/g)];\n const column = position.column - 1;\n\n for (const token of tokens) {\n const startIndex = token.index ?? 0;\n const endIndex = startIndex + token[0].length;\n if (column >= startIndex && column <= endIndex) {\n return {\n word: token[0],\n range: {\n startLineNumber: position.lineNumber,\n endLineNumber: position.lineNumber,\n startColumn: startIndex + 1,\n endColumn: endIndex + 1,\n },\n };\n }\n }\n\n return null;\n }\n\n // No `auth`/`bearer`/`url` — removed with the grammar. `api`, `route`, `path`, and\n // `topic` reflect the current source-property meanings (see grammar.md).\n private getKeywordInfo(word: string): string | null {\n const keywords: Record<string, string> = {\n capture: '**capture** *<Name>*\\n\\nDeclares a capture and gives it a unique name.',\n source: '**source** *<type>*\\n\\nDefines where the capture reads input from.',\n key: '**key** *<property>*\\n\\nSelects the property used to identify each captured item.',\n map: '**map**\\n\\nMaps source fields into a normalized shape for later append blocks.',\n append: '**append** *<EventName>*\\n\\nDeclares an event to append when the `when` clause matches.',\n when: '**when** *<condition>*\\n\\nSpecifies when an append block should fire.',\n nested: '**nested** *<property>*\\n\\nCreates a nested mapping scope for an object property.',\n children: '**children** *<collection>* **identified by** *<property>*\\n\\nCreates a scope for child collection items.',\n identified: '**identified**\\n\\nUsed with `children` to declare how child items are identified.',\n by: '**by**\\n\\nUsed in `children ... identified by`, `split ... by`, and similar clauses.',\n api: '**api**\\n\\nAs a source type (`source api`): polls an HTTP API for changes.\\n\\nAs a source property (`api <ServiceName>`): references a configured External Service by name for the base URL and authentication.',\n webhook: '**webhook**\\n\\nA source type for receiving webhook payloads.',\n message: '**message**\\n\\nA source type for consuming messages from a topic.',\n events: \"**events**\\n\\nA source type for consuming the public events of another application: `source events` with one `from <Event>` line per event. Inbound Translate slices only; admitted by executable semantic model (ESM) v9. The reference runner reports a typed Unsupported outcome for `when capture` over it.\",\n route: '**route** *<path>*\\n\\nOptional path appended to an API source\\'s External Service base URL. If omitted, the base URL is used as-is.',\n poll: '**poll** *<interval>*\\n\\nSets the polling interval for an API source.',\n path: '**path** *<route>*\\n\\nThe inbound path a webhook source listens on.',\n topic: '**topic** *<name>*\\n\\nConfigures the topic for a message source.',\n from: '**from** *<value>*\\n\\nUsed in a `when` clause to match the previous value, and under `source events` to name a consumed public event (`from <Event>`).',\n to: '**to** *<value>*\\n\\nUsed in a `when` clause to match the new value.',\n or: '**or**\\n\\nCombines multiple `when` conditions.',\n and: '**and**\\n\\nCombines multiple `when` conditions that must all match.',\n added: '**added**\\n\\nMatches when a child item was added.',\n removed: '**removed**\\n\\nMatches when a child item was removed.',\n translate: '**translate**\\n\\nMaps source values to new values inside a `map` block.',\n split: '**split** *<value>* **by** *<separator>*\\n\\nSplits a string into multiple mapped fields.',\n };\n\n return keywords[word] || null;\n }\n\n private getExpressionInfo(word: string): string | null {\n const expressions: Record<string, string> = {\n '$context': '**$context**\\n\\nCapture execution context.\\n\\n**Properties:**\\n- `occurred` - When the current event should be considered to have occurred\\n- `eventSourceId` - The resolved event source identifier',\n '$identity': '**$identity**\\n\\nThe caller, equivalent to `$context.identity`. Properties: `id`, `name`, `userName`, `isAuthenticated`, `roles`, `claims`. Caller mappings are not portable capture inputs (PLAY0268).',\n '$previous': '**$previous**\\n\\nThe previous state for the captured item. Use dot notation such as `$previous.status`.',\n '$env': '**$env**\\n\\nEnvironment variables. Use dot notation such as `$env.API_TOKEN`.',\n };\n\n return expressions[word] || null;\n }\n}\n"],"mappings":"qDAKA,IAAa,cAAb,KAA8D,CAC1D,aAAa,EAA0B,EAA+D,CAClG,IAAMA,EAAQ,KAAK,mBAAmBC,EAAOC,CAAQ,EACrD,GAAI,CAACF,EACD,OAAO,KAGX,IAAMG,EAAc,KAAK,eAAeH,EAAM,IAAI,EAClD,GAAIG,EACA,MAAO,CACH,SAAU,CAAC,CAAE,MAAOA,CAAY,CAAC,EACjC,MAAOH,EAAM,KACjB,EAGJ,IAAMI,EAAiB,KAAK,kBAAkBJ,EAAM,IAAI,EAQxD,OAPII,EACO,CACH,SAAU,CAAC,CAAE,MAAOA,CAAe,CAAC,EACpC,MAAOJ,EAAM,KACjB,EAGG,IACX,CAEA,mBAA2B,EAA0B,EAA4D,CAE7G,IAAMK,EAAS,CAAC,GADIJ,EAAM,eAAeC,EAAS,UACrB,CAAC,CAAC,SAAS,wDAAwD,CAAC,EAC3FI,EAASJ,EAAS,OAAS,EAEjC,IAAK,IAAMF,KAASK,EAAQ,CACxB,IAAME,EAAaP,EAAM,OAAS,EAC5BQ,EAAWD,EAAaP,EAAM,EAAE,CAAC,OACvC,GAAIM,GAAUC,GAAcD,GAAUE,EAClC,MAAO,CACH,KAAMR,EAAM,GACZ,MAAO,CACH,gBAAiBE,EAAS,WAC1B,cAAeA,EAAS,WACxB,YAAaK,EAAa,EAC1B,UAAWC,EAAW,CAC1B,CACJ,CAER,CAEA,OAAO,IACX,CAIA,eAAuB,EAA6B,CA8BhD,MAAO,CA5BH,QAAS;;gDACT,OAAQ;;6CACR,IAAK;;2DACL,IAAK;;qEACL,OAAQ;;+DACR,KAAM;;6CACN,OAAQ;;wDACR,SAAU;;6CACV,WAAY;;mEACZ,GAAI,uFACJ,IAAK;;;;qIACL,QAAS;;+CACT,QAAS;;oDACT,OAAQ,kTACR,MAAO;;8GACP,KAAM;;8CACN,KAAM;;+CACN,MAAO;;4CACP,KAAM,yJACN,GAAI;;mDACJ,GAAI;;wCACJ,IAAK;;4DACL,MAAO;;sCACP,QAAS;;wCACT,UAAW;;0DACX,MAAO;;6CAGG,EAAEC,IAAS,IAC7B,CAEA,kBAA0B,EAA6B,CAQnD,MAAO,CANHC,SAAY;;;;;;4DACZC,UAAa,0MACbC,UAAa;;0FACbC,KAAQ;;oEAGK,EAAEJ,IAAS,IAChC,CACJ"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";var Validator=class{validate(e){let t=[],n=-1,r=``;for(let t=0;t<e.length;t++){let i=e[t].trim();if(i&&!i.startsWith(`#`)){n=t,r=i;break}}if(!r)return t;if(!r.match(/^capture\s+([\w.]+)\s*$/))return t.push(this.error(n,1,r.length+1,`Capture definition must start with "capture <Name>"`)),t;let i=e.map((e,t)=>({line:e,trimmed:e.trim(),lineNumber:t,indent:e.search(/\S/)})).filter(e=>e.trimmed&&!e.trimmed.startsWith(`#`));i.some(e=>e.trimmed.startsWith(`source `))||t.push(this.error(n,1,r.length+1,`Capture definition must include a "source" block`)),i.some(e=>e.trimmed.startsWith(`key `))||t.push(this.error(n,1,r.length+1,`Capture definition must include a "key" declaration`));for(let e=0;e<i.length;e++){let n=i[e];if(!n.trimmed.startsWith(`append `))continue;let r=!1;for(let t=e+1;t<i.length;t++){let e=i[t];if(e.indent<=n.indent)break;if(e.trimmed.startsWith(`when `)){r=!0;break}}if(!r){let e=n.trimmed.substring(7).trim()||`unnamed append block`,r=n.line.indexOf(e)+1;t.push(this.error(n.lineNumber,r>0?r:1,r>0?r+e.length:n.line.length+1,`Append block '${e}' must include a "when" clause`))}}return t}error(e,t,n,r){return{severity:`error`,line:e,startColumn:t,endColumn:n,message:r}}};export{Validator};
|
|
2
|
+
//# sourceMappingURL=Validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Validator.js","names":["issues","firstNonEmptyLineIndex","firstLine","index","lines","trimmed","meaningfulLines","line","entry","current","hasWhenClause","next","candidate","eventName","startColumn"],"sources":["../../../../sub-languages/capture/Validator.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 { ValidationIssue } from '../../validation';\n\ninterface MeaningfulLine {\n line: string;\n trimmed: string;\n lineNumber: number;\n indent: number;\n}\n\n// Structural rules only, unaffected by the source-property grammar changes — the\n// grammar's own syntax (see grammar.md) is what the tokenizer enforces; these are\n// the compiler's semantic constraints on top of it. Takes plain lines rather than\n// a Monaco model so it stays usable outside an editor, matching ../../validation.ts.\nexport class Validator {\n validate(lines: string[]): ValidationIssue[] {\n const issues: ValidationIssue[] = [];\n\n let firstNonEmptyLineIndex = -1;\n let firstLine = '';\n for (let index = 0; index < lines.length; index++) {\n const trimmed = lines[index].trim();\n if (trimmed && !trimmed.startsWith('#')) {\n firstNonEmptyLineIndex = index;\n firstLine = trimmed;\n break;\n }\n }\n\n if (!firstLine) {\n return issues;\n }\n\n const captureMatch = firstLine.match(/^capture\\s+([\\w.]+)\\s*$/);\n if (!captureMatch) {\n issues.push(this.error(firstNonEmptyLineIndex, 1, firstLine.length + 1, 'Capture definition must start with \"capture <Name>\"'));\n return issues;\n }\n\n const meaningfulLines: MeaningfulLine[] = lines\n .map((line, index) => ({\n line,\n trimmed: line.trim(),\n lineNumber: index,\n indent: line.search(/\\S/),\n }))\n .filter((entry) => entry.trimmed && !entry.trimmed.startsWith('#'));\n\n const hasSource = meaningfulLines.some((entry) => entry.trimmed.startsWith('source '));\n if (!hasSource) {\n issues.push(this.error(firstNonEmptyLineIndex, 1, firstLine.length + 1, 'Capture definition must include a \"source\" block'));\n }\n\n const hasKey = meaningfulLines.some((entry) => entry.trimmed.startsWith('key '));\n if (!hasKey) {\n issues.push(this.error(firstNonEmptyLineIndex, 1, firstLine.length + 1, 'Capture definition must include a \"key\" declaration'));\n }\n\n for (let index = 0; index < meaningfulLines.length; index++) {\n const current = meaningfulLines[index];\n if (!current.trimmed.startsWith('append ')) {\n continue;\n }\n\n let hasWhenClause = false;\n for (let next = index + 1; next < meaningfulLines.length; next++) {\n const candidate = meaningfulLines[next];\n if (candidate.indent <= current.indent) {\n break;\n }\n if (candidate.trimmed.startsWith('when ')) {\n hasWhenClause = true;\n break;\n }\n }\n\n if (!hasWhenClause) {\n const eventName = current.trimmed.substring('append '.length).trim() || 'unnamed append block';\n const startColumn = current.line.indexOf(eventName) + 1;\n issues.push(this.error(\n current.lineNumber,\n startColumn > 0 ? startColumn : 1,\n startColumn > 0 ? startColumn + eventName.length : current.line.length + 1,\n `Append block '${eventName}' must include a \"when\" clause`,\n ));\n }\n }\n\n return issues;\n }\n\n private error(line: number, startColumn: number, endColumn: number, message: string): ValidationIssue {\n return { severity: 'error', line, startColumn, endColumn, message };\n }\n}\n"],"mappings":"qDAgBA,IAAa,UAAb,KAAuB,CACnB,SAAS,EAAoC,CACzC,IAAMA,EAA4B,CAAC,EAE/BC,EAAyB,GACzBC,EAAY,GAChB,IAAK,IAAIC,EAAQ,EAAGA,EAAQC,EAAM,OAAQ,IAAS,CAC/C,IAAMC,EAAUD,EAAMD,EAAM,CAAC,KAAK,EAClC,GAAIE,GAAW,CAACA,EAAQ,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EAAI,EACtDb,EAAO,KAAK,KAAK,MACbS,EAAQ,WACRK,EAAc,EAAIA,EAAc,EAChCA,EAAc,EAAIA,EAAcD,EAAU,OAASJ,EAAQ,KAAK,OAAS,EACzE,iBAAiBI,EAAU,+BAC/B,CAAC,CACL,CACJ,CAEA,OAAOb,CACX,CAEA,MAAc,EAAc,EAAqB,EAAmB,EAAkC,CAClG,MAAO,CAAE,SAAU,QAAS,OAAM,cAAa,YAAW,SAAQ,CACtE,CACJ"}
|
|
@@ -1,40 +1,2 @@
|
|
|
1
|
-
import{a as p}from"../../chunk-AYDF3IFZ.js";var u="cdl",I=["capture","source","key","map","append","when","nested","children","identified","by","api","webhook","message","events","route","poll","path","topic","from","to","or","and","added","removed","translate","split"],T=["$context","$identity","$previous","$env"],$=["=","=>","."],w={comments:{lineComment:"#"},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"`",close:"`"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"`",close:"`"}],indentationRules:{increaseIndentPattern:/^.*(\bcapture\b\s+\S+|\bsource\b(?:\s+\w+)?|\bmap\b|\bappend\b\s+\S+|\bnested\b\s+\S+|\bchildren\b\s+\S+.*|\btranslate\b|\bsplit\b.*)\s*$/,decreaseIndentPattern:/^.*\}.*$/},folding:{offSide:!0,markers:{start:/^\s*(capture|source|map|append|nested|children|translate|split)/,end:/^\s*$/}},wordPattern:/[$]?[a-zA-Z_][\w$-]*/},y={defaultToken:"",tokenPostfix:".cdl",keywords:I,builtins:T,operators:$,symbols:/[=><!~?:&|+\-*/^%]+/,escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,tokenizer:{root:[{include:"@whitespace"},[/`/,{token:"string.template",next:"@templateString"}],[/\$\.(?:[a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*)?/,"variable"],[/\$previous(?:\.[a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*)?/,"variable.predefined"],[/\$context(?:\.(?:occurred|eventSourceId))?/,"variable.predefined"],[/\$identity(?:\.\w+)*/,"variable.predefined"],[/\$env(?:\.[A-Z_][A-Z0-9_]*)?/,"variable.predefined"],[/@[a-zA-Z_$][\w$]*/,"identifier.escape"],[/[A-Z][a-zA-Z_$][\w$]*/,{cases:{"@keywords":"invalid","@default":"identifier"}}],[/[a-z_$][\w$]*/,{cases:{"@keywords":"keyword","@builtins":"variable.predefined","@default":"identifier"}}],[/[{}()[\]]/,"@brackets"],[/=>/,"operator.arrow"],[/@symbols/,{cases:{"@operators":"operator","@default":""}}],[/\d*\.\d+([eE][-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F]+/,"number.hex"],[/\d+/,"number"],[/[;,.]/,"delimiter"],[/"([^"\\]|\\.)*$/,"string.invalid"],[/"/,{token:"string.quote",next:"@string"}]],whitespace:[[/[ \t\r\n]+/,""],[/#.*$/,"comment"]],templateString:[[/\$\{/,{token:"delimiter.bracket",next:"@templateExpression"}],[/[^\\`$]+/,"string.template"],[/@escapes/,"string.template.escape"],[/\\./,"string.template.escape.invalid"],[/`/,{token:"string.template",next:"@pop"}]],templateExpression:[[/\}/,{token:"delimiter.bracket",next:"@pop"}],{include:"@root"}],string:[[/[^\\"]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,{token:"string.quote",next:"@pop"}]]}};import{languages as l}from"monaco-editor";var k=["id","status","firstName","lastName","fullName","address.street","address.city","lineItems","lineItems.quantity","lineNumber","quantity"],g=class{static{p(this,"CompletionProvider")}triggerCharacters=["."," ","=","$"];provideCompletionItems(t,n){let e=this.buildContext(t,n),o=[];return e.lineNumber===1?this.addCaptureLineCompletions(o,e):this.isAfterKeyword(e,"capture")?this.addCaptureNameCompletions(o,e):this.isAfterKeyword(e,"source")?this.addSourceTypeCompletions(o,e):this.isAfterAppendKeyword(e)?this.addAppendNameCompletions(o,e):this.isAfterWhenKeyword(e)?this.addWhenCompletions(o,e):this.isAfterWhenFrom(e)?this.addFromValueCompletions(o,e):this.isAfterWhenTo(e)?this.addToValueCompletions(o,e):this.isAfterContextPrefix(e,"$.")?this.addPathCompletions(o,e,"$."):this.isAfterContextPrefix(e,"$previous.")?this.addPathCompletions(o,e,"$previous."):this.isAfterContextPrefix(e,"$context.")?this.addContextCompletions(o,e):this.isAfterContextPrefix(e,"$env.")?this.addEnvironmentCompletions(o,e):this.isAfterAssignment(e)?this.addAssignmentValueCompletions(o,e):(this.isStartOfLine(e)||this.isAfterIndent(e))&&e.indentLevel===1?this.addTopLevelStatementCompletions(o,e):(this.isStartOfLine(e)||this.isAfterIndent(e))&&e.indentLevel>=2&&this.addSourceBlockCompletions(o,e,this.getCurrentSourceType(t,n.lineNumber)),{suggestions:o}}buildContext(t,n){let o=t.getLineContent(n.lineNumber).substring(0,n.column-1),r=t.getWordUntilPosition(n);return{textBeforeCursor:o,currentWord:r.word||"",indentLevel:this.getIndentLevel(o),lineNumber:n.lineNumber,wordStartColumn:r.startColumn,wordEndColumn:r.endColumn}}getIndentLevel(t){let n=t.match(/^(\s*)/);return n?Math.floor(n[1].length/2):0}isStartOfLine(t){return t.textBeforeCursor.trim()===""}isAfterIndent(t){return/^\s+$/.test(t.textBeforeCursor)}isAfterKeyword(t,n){return new RegExp(`\\b${n}\\s+\\w*$`).test(t.textBeforeCursor)}isAfterAppendKeyword(t){return/\bappend\s+[\w.]*$/.test(t.textBeforeCursor)}isAfterWhenKeyword(t){return/\bwhen\s+[\w.]*$/.test(t.textBeforeCursor)}isAfterWhenFrom(t){return/\bwhen\s+[\w.]+\s+from\s+[^\s]*$/.test(t.textBeforeCursor)}isAfterWhenTo(t){return/\bwhen\s+[\w.]+\s+from\s+\S+\s+to\s+[^\s]*$/.test(t.textBeforeCursor)}isAfterAssignment(t){return/=\s*([$\w.]*)$/.test(t.textBeforeCursor)}isAfterContextPrefix(t,n){return t.textBeforeCursor.endsWith(n)}addCaptureLineCompletions(t,n){let e=n.textBeforeCursor.trim();(e===""||"capture".startsWith(e))&&t.push({label:"capture",kind:l.CompletionItemKind.Keyword,insertText:"capture ",documentation:"Define a capture declaration",detail:"capture <Name>",range:this.getRangeForWord(n)}),e.startsWith("capture ")&&this.addCaptureNameCompletions(t,n)}addCaptureNameCompletions(t,n){t.push({label:"CaptureDefinition",kind:l.CompletionItemKind.Class,insertText:"CaptureDefinition",documentation:"A descriptive name for this capture declaration",detail:"Capture name",range:this.getRangeForWord(n)})}addSourceTypeCompletions(t,n){[{label:"api",detail:"source api",documentation:"Capture data by polling an HTTP API"},{label:"webhook",detail:"source webhook",documentation:"Capture data from incoming webhook requests"},{label:"message",detail:"source message",documentation:"Capture data from a message topic"},{label:"events",detail:"source events",documentation:"Capture another application's public events (inbound translation); each 'from <Event>' names one consumed event"}].forEach(e=>{t.push({label:e.label,kind:l.CompletionItemKind.Keyword,insertText:e.label,documentation:e.documentation,detail:e.detail,range:this.getRangeForWord(n)})})}addSourceBlockCompletions(t,n,e){(e?{api:[{label:"api",detail:"api <ServiceName>",documentation:"References a configured External Service by name for the base URL and authentication"},{label:"route",detail:"route <path>",documentation:"Optional path appended to the External Service base URL; if omitted, the base URL is used as-is"},{label:"poll",detail:"poll <interval>",documentation:"The polling interval, for example 5m"}],webhook:[{label:"path",detail:"path <route>",documentation:"The inbound path this webhook listens on"}],events:[{label:"from",detail:"from <Event>",documentation:"Names a public event of another application to consume; repeat for more events"}],message:[{label:"topic",detail:"topic <name>",documentation:"The topic or subject to subscribe to"}]}[e]??[]:[]).forEach(r=>{t.push({label:r.label,kind:l.CompletionItemKind.Keyword,insertText:`${r.label} `,documentation:r.documentation,detail:r.detail,range:this.getRangeForWord(n)})})}addTopLevelStatementCompletions(t,n){[{label:"key",insertText:"key ",detail:"key <property>",documentation:"Identify the captured entity"},{label:"map",insertText:"map",detail:"map",documentation:"Map captured fields into a normalized shape"},{label:"append",insertText:"append ",detail:"append <EventName>",documentation:"Append an event when a condition matches"},{label:"nested",insertText:"nested ",detail:"nested <property>",documentation:"Create a nested mapping scope"},{label:"children",insertText:"children ",detail:"children <collection> identified by <property>",documentation:"Handle child collections independently"}].forEach(e=>{t.push({label:e.label,kind:l.CompletionItemKind.Keyword,insertText:e.insertText,documentation:e.documentation,detail:e.detail,range:this.getRangeForWord(n)})})}addAppendNameCompletions(t,n){t.push({label:"ItemChanged",kind:l.CompletionItemKind.Class,insertText:"ItemChanged",documentation:"A generic event name for the appended event",detail:"Event name",range:this.getRangeForWord(n)})}addWhenCompletions(t,n){[{label:"added",insertText:"added",detail:"when added",documentation:"Append when a child item was added"},{label:"removed",insertText:"removed",detail:"when removed",documentation:"Append when a child item was removed"},{label:"status",insertText:"status",detail:"when <property>",documentation:"Append when a property changed"},{label:"status transition",insertText:"status from inactive to active",detail:"when <property> from <value> to <value>",documentation:"Append when a property changed between two values"},{label:"quantity",insertText:"quantity",detail:"when <property>",documentation:"Append when a property changed"},{label:"lineNumber",insertText:"lineNumber",detail:"when <property>",documentation:"Append when a specific property changed"}].forEach(e=>{t.push({label:e.label,kind:l.CompletionItemKind.Keyword,insertText:e.insertText,documentation:e.documentation,detail:e.detail,range:this.getRangeForWord(n)})})}addFromValueCompletions(t,n){[{label:"*",insertText:"*",detail:"Wildcard",documentation:"Match any previous value"},{label:"inactive",insertText:"inactive",detail:"Common value",documentation:"A common previous state value"},{label:"active",insertText:"active",detail:"Common value",documentation:"A common previous state value"},{label:"true",insertText:"true",detail:"Boolean value",documentation:"Boolean true"},{label:"false",insertText:"false",detail:"Boolean value",documentation:"Boolean false"}].forEach(e=>{t.push({label:e.label,kind:l.CompletionItemKind.Value,insertText:e.insertText,documentation:e.documentation,detail:e.detail,range:this.getRangeForWord(n)})})}addToValueCompletions(t,n){["active","inactive","pending","true","false"].forEach(e=>{t.push({label:e,kind:l.CompletionItemKind.Value,insertText:e,documentation:`Common target value: ${e}`,detail:"Target value",range:this.getRangeForWord(n)})})}addAssignmentValueCompletions(t,n){[{label:"$.",insertText:"$.",detail:"Current captured value",documentation:"Reference the current captured payload"},{label:"$previous.",insertText:"$previous.",detail:"Previous captured value",documentation:"Reference the previous state of the payload"},{label:"$context.occurred",insertText:"$context.occurred",detail:"Occurred timestamp",documentation:"When the capture source produced the current data"},{label:"$context.eventSourceId",insertText:"$context.eventSourceId",detail:"Event source identifier",documentation:"The resolved event source identifier for the append operation"},{label:"$env.",insertText:"$env.",detail:"Environment variable",documentation:"Read an environment variable"}].forEach(e=>{t.push({label:e.label,kind:l.CompletionItemKind.Variable,insertText:e.insertText,documentation:e.documentation,detail:e.detail,range:this.getRangeForWord(n)})})}addPathCompletions(t,n,e){k.forEach(o=>{t.push({label:o,kind:l.CompletionItemKind.Property,insertText:`${e}${o}`,documentation:`Common property path: ${e}${o}`,detail:e==="$."?"Current value path":"Previous value path",range:this.getRangeForWord(n)})})}addContextCompletions(t,n){[{label:"occurred",insertText:"$context.occurred",detail:"When the event occurred",documentation:"Timestamp for when the append event happened"},{label:"eventSourceId",insertText:"$context.eventSourceId",detail:"Event source identifier",documentation:"The event source identifier used for the appended event"}].forEach(e=>{t.push({label:e.label,kind:l.CompletionItemKind.Property,insertText:e.insertText,documentation:e.documentation,detail:e.detail,range:this.getRangeForWord(n)})})}addEnvironmentCompletions(t,n){t.push({label:"API_TOKEN",kind:l.CompletionItemKind.Variable,insertText:"$env.API_TOKEN",documentation:"Placeholder environment variable reference",detail:"Environment variable",range:this.getRangeForWord(n)})}getCurrentSourceType(t,n){for(let e=n;e>=1;e--){let r=t.getLineContent(e).trim().match(/^source\s+(api|webhook|message|events)\b/);if(r)return r[1]}return null}getRangeForWord(t){return{startLineNumber:t.lineNumber,endLineNumber:t.lineNumber,startColumn:t.wordStartColumn,endColumn:t.wordEndColumn}}};var v=class{static{p(this,"HoverProvider")}provideHover(t,n){let e=this.getTokenAtPosition(t,n);if(!e)return null;let o=this.getKeywordInfo(e.word);if(o)return{contents:[{value:o}],range:e.range};let r=this.getExpressionInfo(e.word);return r?{contents:[{value:r}],range:e.range}:null}getTokenAtPosition(t,n){let o=[...t.getLineContent(n.lineNumber).matchAll(/\$context|\$identity|\$previous|\$env|[a-zA-Z_][\w-]*/g)],r=n.column-1;for(let i of o){let h=i.index??0,b=h+i[0].length;if(r>=h&&r<=b)return{word:i[0],range:{startLineNumber:n.lineNumber,endLineNumber:n.lineNumber,startColumn:h+1,endColumn:b+1}}}return null}getKeywordInfo(t){return{capture:`**capture** *<Name>*
|
|
2
|
-
|
|
3
|
-
Declares a capture and gives it a unique name.`,source:`**source** *<type>*
|
|
4
|
-
|
|
5
|
-
Defines where the capture reads input from.`,key:`**key** *<property>*
|
|
6
|
-
|
|
7
|
-
Selects the property used to identify each captured item.`,map:`**map**
|
|
8
|
-
|
|
9
|
-
Maps source fields into a normalized shape for later append blocks.`,append:"**append** *<EventName>*\n\nDeclares an event to append when the `when` clause matches.",when:`**when** *<condition>*
|
|
10
|
-
|
|
11
|
-
Specifies when an append block should fire.`,nested:`**nested** *<property>*
|
|
12
|
-
|
|
13
|
-
Creates a nested mapping scope for an object property.`,children:`**children** *<collection>* **identified by** *<property>*
|
|
14
|
-
|
|
15
|
-
Creates a scope for child collection items.`,identified:"**identified**\n\nUsed with `children` to declare how child items are identified.",by:"**by**\n\nUsed in `children ... identified by`, `split ... by`, and similar clauses.",api:"**api**\n\nAs a source type (`source api`): polls an HTTP API for changes.\n\nAs a source property (`api <ServiceName>`): references a configured External Service by name for the base URL and authentication.",webhook:`**webhook**
|
|
16
|
-
|
|
17
|
-
A source type for receiving webhook payloads.`,message:`**message**
|
|
18
|
-
|
|
19
|
-
A source type for consuming messages from a topic.`,events:"**events**\n\nA source type for consuming the public events of another application: `source events` with one `from <Event>` line per event. Inbound Translate slices only; admitted by executable semantic model (ESM) v9. The reference runner reports a typed Unsupported outcome for `when capture` over it.",route:`**route** *<path>*
|
|
20
|
-
|
|
21
|
-
Optional path appended to an API source's External Service base URL. If omitted, the base URL is used as-is.`,poll:`**poll** *<interval>*
|
|
22
|
-
|
|
23
|
-
Sets the polling interval for an API source.`,path:`**path** *<route>*
|
|
24
|
-
|
|
25
|
-
The inbound path a webhook source listens on.`,topic:`**topic** *<name>*
|
|
26
|
-
|
|
27
|
-
Configures the topic for a message source.`,from:"**from** *<value>*\n\nUsed in a `when` clause to match the previous value, and under `source events` to name a consumed public event (`from <Event>`).",to:"**to** *<value>*\n\nUsed in a `when` clause to match the new value.",or:"**or**\n\nCombines multiple `when` conditions.",and:"**and**\n\nCombines multiple `when` conditions that must all match.",added:`**added**
|
|
28
|
-
|
|
29
|
-
Matches when a child item was added.`,removed:`**removed**
|
|
30
|
-
|
|
31
|
-
Matches when a child item was removed.`,translate:"**translate**\n\nMaps source values to new values inside a `map` block.",split:`**split** *<value>* **by** *<separator>*
|
|
32
|
-
|
|
33
|
-
Splits a string into multiple mapped fields.`}[t]||null}getExpressionInfo(t){return{$context:`**$context**
|
|
34
|
-
|
|
35
|
-
Capture execution context.
|
|
36
|
-
|
|
37
|
-
**Properties:**
|
|
38
|
-
- \`occurred\` - When the current event should be considered to have occurred
|
|
39
|
-
- \`eventSourceId\` - The resolved event source identifier`,$identity:"**$identity**\n\nThe caller, equivalent to `$context.identity`. Properties: `id`, `name`, `userName`, `isAuthenticated`, `roles`, `claims`. Caller mappings are not portable capture inputs (PLAY0268).",$previous:"**$previous**\n\nThe previous state for the captured item. Use dot notation such as `$previous.status`.",$env:"**$env**\n\nEnvironment variables. Use dot notation such as `$env.API_TOKEN`."}[t]||null}};var f=class{static{p(this,"Validator")}validate(t){let n=[],e=-1,o="";for(let a=0;a<t.length;a++){let d=t[a].trim();if(d&&!d.startsWith("#")){e=a,o=d;break}}if(!o)return n;if(!o.match(/^capture\s+([\w.]+)\s*$/))return n.push(this.error(e,1,o.length+1,'Capture definition must start with "capture <Name>"')),n;let i=t.map((a,d)=>({line:a,trimmed:a.trim(),lineNumber:d,indent:a.search(/\S/)})).filter(a=>a.trimmed&&!a.trimmed.startsWith("#"));i.some(a=>a.trimmed.startsWith("source "))||n.push(this.error(e,1,o.length+1,'Capture definition must include a "source" block')),i.some(a=>a.trimmed.startsWith("key "))||n.push(this.error(e,1,o.length+1,'Capture definition must include a "key" declaration'));for(let a=0;a<i.length;a++){let d=i[a];if(!d.trimmed.startsWith("append "))continue;let x=!1;for(let m=a+1;m<i.length;m++){let c=i[m];if(c.indent<=d.indent)break;if(c.trimmed.startsWith("when ")){x=!0;break}}if(!x){let m=d.trimmed.substring(7).trim()||"unnamed append block",c=d.line.indexOf(m)+1;n.push(this.error(d.lineNumber,c>0?c:1,c>0?c+m.length:d.line.length+1,`Append block '${m}' must include a "when" clause`))}}return n}error(t,n,e,o){return{severity:"error",line:t,startColumn:n,endColumn:e,message:o}}};var A="cdl-validator",C=new Map;function P(s,t,n){return t.validate(n.getLinesContent()).map(e=>({severity:e.severity==="error"?s.MarkerSeverity.Error:s.MarkerSeverity.Warning,message:e.message,startLineNumber:e.line+1,startColumn:e.startColumn,endLineNumber:e.line+1,endColumn:e.endColumn}))}p(P,"toMarkers");function _(s){let t=C.get(s);if(t)return{dispose:t};s.languages.register({id:"cdl"}),s.languages.setLanguageConfiguration("cdl",w),s.languages.setMonarchTokensProvider("cdl",y);let n=new f,e=[];e.push(s.languages.registerCompletionItemProvider("cdl",new g)),e.push(s.languages.registerHoverProvider("cdl",new v));let o=p(i=>{i.isDisposed()||i.getLanguageId()!=="cdl"||s.editor.setModelMarkers(i,A,P(s,n,i))},"validateModel");e.push(s.editor.onDidCreateModel(i=>{i.getLanguageId()==="cdl"&&(o(i),e.push(i.onDidChangeContent(()=>o(i))))})),s.editor.getModels().forEach(i=>o(i));let r=p(()=>{e.forEach(i=>i.dispose()),e.length=0,C.delete(s)},"dispose");return C.set(s,r),{dispose:r}}p(_,"registerCaptureLanguage");export{u as languageId,_ as registerCaptureLanguage};
|
|
40
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{languageConfiguration as e,languageId as t,monarchLanguage as n}from"./language.js";import{CompletionProvider as r}from"./CompletionProvider.js";import{HoverProvider as i}from"./HoverProvider.js";import{Validator as a}from"./Validator.js";const o=/* @__PURE__ */ new Map;function toMarkers(e,t,n){return t.validate(n.getLinesContent()).map(t=>({severity:t.severity===`error`?e.MarkerSeverity.Error:e.MarkerSeverity.Warning,message:t.message,startLineNumber:t.line+1,startColumn:t.startColumn,endLineNumber:t.line+1,endColumn:t.endColumn}))}function registerCaptureLanguage(t){let s=o.get(t);if(s)return{dispose:s};t.languages.register({id:`cdl`}),t.languages.setLanguageConfiguration(`cdl`,e),t.languages.setMonarchTokensProvider(`cdl`,n);let c=new a,l=[];l.push(t.languages.registerCompletionItemProvider(`cdl`,new r)),l.push(t.languages.registerHoverProvider(`cdl`,new i));let validateModel=e=>{e.isDisposed()||e.getLanguageId()!==`cdl`||t.editor.setModelMarkers(e,`cdl-validator`,toMarkers(t,c,e))};l.push(t.editor.onDidCreateModel(e=>{e.getLanguageId()===`cdl`&&(validateModel(e),l.push(e.onDidChangeContent(()=>validateModel(e))))})),t.editor.getModels().forEach(e=>validateModel(e));let dispose=()=>{l.forEach(e=>e.dispose()),l.length=0,o.delete(t)};return o.set(t,dispose),{dispose}}export{t as languageId,registerCaptureLanguage};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|