@domainlang/language 0.1.81
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 +32 -0
- package/out/ast-augmentation.d.ts +6 -0
- package/out/ast-augmentation.js +2 -0
- package/out/ast-augmentation.js.map +1 -0
- package/out/domain-lang-module.d.ts +55 -0
- package/out/domain-lang-module.js +59 -0
- package/out/domain-lang-module.js.map +1 -0
- package/out/generated/ast.d.ts +770 -0
- package/out/generated/ast.js +565 -0
- package/out/generated/ast.js.map +1 -0
- package/out/generated/grammar.d.ts +6 -0
- package/out/generated/grammar.js +2502 -0
- package/out/generated/grammar.js.map +1 -0
- package/out/generated/module.d.ts +13 -0
- package/out/generated/module.js +21 -0
- package/out/generated/module.js.map +1 -0
- package/out/index.d.ts +13 -0
- package/out/index.js +17 -0
- package/out/index.js.map +1 -0
- package/out/lsp/domain-lang-completion.d.ts +37 -0
- package/out/lsp/domain-lang-completion.js +452 -0
- package/out/lsp/domain-lang-completion.js.map +1 -0
- package/out/lsp/domain-lang-formatter.d.ts +15 -0
- package/out/lsp/domain-lang-formatter.js +43 -0
- package/out/lsp/domain-lang-formatter.js.map +1 -0
- package/out/lsp/domain-lang-naming.d.ts +34 -0
- package/out/lsp/domain-lang-naming.js +49 -0
- package/out/lsp/domain-lang-naming.js.map +1 -0
- package/out/lsp/domain-lang-scope.d.ts +59 -0
- package/out/lsp/domain-lang-scope.js +102 -0
- package/out/lsp/domain-lang-scope.js.map +1 -0
- package/out/lsp/hover/ddd-pattern-explanations.d.ts +50 -0
- package/out/lsp/hover/ddd-pattern-explanations.js +196 -0
- package/out/lsp/hover/ddd-pattern-explanations.js.map +1 -0
- package/out/lsp/hover/domain-lang-hover.d.ts +19 -0
- package/out/lsp/hover/domain-lang-hover.js +306 -0
- package/out/lsp/hover/domain-lang-hover.js.map +1 -0
- package/out/lsp/hover/domain-lang-keywords.d.ts +13 -0
- package/out/lsp/hover/domain-lang-keywords.js +47 -0
- package/out/lsp/hover/domain-lang-keywords.js.map +1 -0
- package/out/main-browser.d.ts +1 -0
- package/out/main-browser.js +11 -0
- package/out/main-browser.js.map +1 -0
- package/out/main.d.ts +1 -0
- package/out/main.js +74 -0
- package/out/main.js.map +1 -0
- package/out/sdk/ast-augmentation.d.ts +136 -0
- package/out/sdk/ast-augmentation.js +62 -0
- package/out/sdk/ast-augmentation.js.map +1 -0
- package/out/sdk/index.d.ts +94 -0
- package/out/sdk/index.js +97 -0
- package/out/sdk/index.js.map +1 -0
- package/out/sdk/indexes.d.ts +16 -0
- package/out/sdk/indexes.js +97 -0
- package/out/sdk/indexes.js.map +1 -0
- package/out/sdk/loader-node.d.ts +47 -0
- package/out/sdk/loader-node.js +104 -0
- package/out/sdk/loader-node.js.map +1 -0
- package/out/sdk/loader.d.ts +49 -0
- package/out/sdk/loader.js +85 -0
- package/out/sdk/loader.js.map +1 -0
- package/out/sdk/patterns.d.ts +93 -0
- package/out/sdk/patterns.js +123 -0
- package/out/sdk/patterns.js.map +1 -0
- package/out/sdk/query.d.ts +90 -0
- package/out/sdk/query.js +679 -0
- package/out/sdk/query.js.map +1 -0
- package/out/sdk/resolution.d.ts +52 -0
- package/out/sdk/resolution.js +68 -0
- package/out/sdk/resolution.js.map +1 -0
- package/out/sdk/types.d.ts +301 -0
- package/out/sdk/types.js +8 -0
- package/out/sdk/types.js.map +1 -0
- package/out/services/dependency-analyzer.d.ts +94 -0
- package/out/services/dependency-analyzer.js +279 -0
- package/out/services/dependency-analyzer.js.map +1 -0
- package/out/services/dependency-resolver.d.ts +123 -0
- package/out/services/dependency-resolver.js +252 -0
- package/out/services/dependency-resolver.js.map +1 -0
- package/out/services/git-url-resolver.browser.d.ts +18 -0
- package/out/services/git-url-resolver.browser.js +15 -0
- package/out/services/git-url-resolver.browser.js.map +1 -0
- package/out/services/git-url-resolver.d.ts +192 -0
- package/out/services/git-url-resolver.js +382 -0
- package/out/services/git-url-resolver.js.map +1 -0
- package/out/services/governance-validator.d.ts +80 -0
- package/out/services/governance-validator.js +159 -0
- package/out/services/governance-validator.js.map +1 -0
- package/out/services/import-resolver.d.ts +18 -0
- package/out/services/import-resolver.js +22 -0
- package/out/services/import-resolver.js.map +1 -0
- package/out/services/performance-optimizer.d.ts +60 -0
- package/out/services/performance-optimizer.js +140 -0
- package/out/services/performance-optimizer.js.map +1 -0
- package/out/services/relationship-inference.d.ts +11 -0
- package/out/services/relationship-inference.js +98 -0
- package/out/services/relationship-inference.js.map +1 -0
- package/out/services/workspace-manager.d.ts +76 -0
- package/out/services/workspace-manager.js +323 -0
- package/out/services/workspace-manager.js.map +1 -0
- package/out/syntaxes/domain-lang.monarch.d.ts +76 -0
- package/out/syntaxes/domain-lang.monarch.js +29 -0
- package/out/syntaxes/domain-lang.monarch.js.map +1 -0
- package/out/utils/import-utils.d.ts +57 -0
- package/out/utils/import-utils.js +228 -0
- package/out/utils/import-utils.js.map +1 -0
- package/out/validation/bounded-context.d.ts +11 -0
- package/out/validation/bounded-context.js +79 -0
- package/out/validation/bounded-context.js.map +1 -0
- package/out/validation/classification.d.ts +3 -0
- package/out/validation/classification.js +3 -0
- package/out/validation/classification.js.map +1 -0
- package/out/validation/constants.d.ts +77 -0
- package/out/validation/constants.js +96 -0
- package/out/validation/constants.js.map +1 -0
- package/out/validation/domain-lang-validator.d.ts +2 -0
- package/out/validation/domain-lang-validator.js +27 -0
- package/out/validation/domain-lang-validator.js.map +1 -0
- package/out/validation/domain.d.ts +11 -0
- package/out/validation/domain.js +18 -0
- package/out/validation/domain.js.map +1 -0
- package/out/validation/import.d.ts +44 -0
- package/out/validation/import.js +135 -0
- package/out/validation/import.js.map +1 -0
- package/out/validation/maps.d.ts +21 -0
- package/out/validation/maps.js +56 -0
- package/out/validation/maps.js.map +1 -0
- package/out/validation/metadata.d.ts +7 -0
- package/out/validation/metadata.js +12 -0
- package/out/validation/metadata.js.map +1 -0
- package/out/validation/model.d.ts +12 -0
- package/out/validation/model.js +29 -0
- package/out/validation/model.js.map +1 -0
- package/out/validation/relationships.d.ts +12 -0
- package/out/validation/relationships.js +94 -0
- package/out/validation/relationships.js.map +1 -0
- package/out/validation/shared.d.ts +6 -0
- package/out/validation/shared.js +12 -0
- package/out/validation/shared.js.map +1 -0
- package/package.json +97 -0
- package/src/ast-augmentation.ts +5 -0
- package/src/domain-lang-module.ts +100 -0
- package/src/domain-lang.langium +356 -0
- package/src/generated/ast.ts +999 -0
- package/src/generated/grammar.ts +2504 -0
- package/src/generated/module.ts +25 -0
- package/src/index.ts +17 -0
- package/src/lsp/domain-lang-completion.ts +514 -0
- package/src/lsp/domain-lang-formatter.ts +51 -0
- package/src/lsp/domain-lang-naming.ts +56 -0
- package/src/lsp/domain-lang-scope.ts +137 -0
- package/src/lsp/hover/ddd-pattern-explanations.ts +237 -0
- package/src/lsp/hover/domain-lang-hover.ts +340 -0
- package/src/lsp/hover/domain-lang-keywords.ts +50 -0
- package/src/main-browser.ts +15 -0
- package/src/main.ts +85 -0
- package/src/sdk/README.md +297 -0
- package/src/sdk/ast-augmentation.ts +157 -0
- package/src/sdk/index.ts +128 -0
- package/src/sdk/indexes.ts +155 -0
- package/src/sdk/loader-node.ts +126 -0
- package/src/sdk/loader.ts +99 -0
- package/src/sdk/patterns.ts +147 -0
- package/src/sdk/query.ts +802 -0
- package/src/sdk/resolution.ts +78 -0
- package/src/sdk/types.ts +346 -0
- package/src/services/dependency-analyzer.ts +381 -0
- package/src/services/dependency-resolver.ts +334 -0
- package/src/services/git-url-resolver.browser.ts +31 -0
- package/src/services/git-url-resolver.ts +524 -0
- package/src/services/governance-validator.ts +219 -0
- package/src/services/import-resolver.ts +30 -0
- package/src/services/performance-optimizer.ts +170 -0
- package/src/services/relationship-inference.ts +121 -0
- package/src/services/workspace-manager.ts +416 -0
- package/src/syntaxes/domain-lang.monarch.ts +29 -0
- package/src/utils/import-utils.ts +274 -0
- package/src/validation/bounded-context.ts +99 -0
- package/src/validation/classification.ts +5 -0
- package/src/validation/constants.ts +124 -0
- package/src/validation/domain-lang-validator.ts +33 -0
- package/src/validation/domain.ts +24 -0
- package/src/validation/import.ts +171 -0
- package/src/validation/maps.ts +72 -0
- package/src/validation/metadata.ts +14 -0
- package/src/validation/model.ts +37 -0
- package/src/validation/relationships.ts +154 -0
- package/src/validation/shared.ts +14 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
* Copyright 2021 TypeFox GmbH
|
|
3
|
+
* This program and the accompanying materials are made available under the
|
|
4
|
+
* terms of the MIT License, which is available in the project root.
|
|
5
|
+
******************************************************************************/
|
|
6
|
+
import type { Container, NamespaceDeclaration } from '../generated/ast.js';
|
|
7
|
+
/**
|
|
8
|
+
* Joins parent and child names into a fully qualified name, using '.' as a separator.
|
|
9
|
+
* Ensures no leading or trailing dots and supports arbitrary nesting.
|
|
10
|
+
* @param parent - The parent name or empty string
|
|
11
|
+
* @param child - The child name
|
|
12
|
+
* @returns The fully qualified name
|
|
13
|
+
*/
|
|
14
|
+
export declare function joinQualifiedName(parent: string, child: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Recursively computes the fully qualified name for a child element within nested namespaces.
|
|
17
|
+
* @param namespace - The current namespace declaration
|
|
18
|
+
* @param childName - The name of the child element
|
|
19
|
+
* @returns The fully qualified name as a string
|
|
20
|
+
*/
|
|
21
|
+
export declare function toQualifiedName(namespace: NamespaceDeclaration, childName: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Provides qualified name computation for domain language elements, supporting nested namespaces and models.
|
|
24
|
+
* Used for FQN disambiguation and reference resolution.
|
|
25
|
+
*/
|
|
26
|
+
export declare class QualifiedNameProvider {
|
|
27
|
+
/**
|
|
28
|
+
* Computes the qualified name for a given qualifier and name.
|
|
29
|
+
* @param qualifier - The parent container (Model, NamespaceDeclaration, or string)
|
|
30
|
+
* @param name - The simple name of the element
|
|
31
|
+
* @returns The fully qualified name as a string
|
|
32
|
+
*/
|
|
33
|
+
getQualifiedName(qualifier: Container | string, name: string): string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
* Copyright 2021 TypeFox GmbH
|
|
3
|
+
* This program and the accompanying materials are made available under the
|
|
4
|
+
* terms of the MIT License, which is available in the project root.
|
|
5
|
+
******************************************************************************/
|
|
6
|
+
import { isModel, isNamespaceDeclaration } from '../generated/ast.js';
|
|
7
|
+
/**
|
|
8
|
+
* Joins parent and child names into a fully qualified name, using '.' as a separator.
|
|
9
|
+
* Ensures no leading or trailing dots and supports arbitrary nesting.
|
|
10
|
+
* @param parent - The parent name or empty string
|
|
11
|
+
* @param child - The child name
|
|
12
|
+
* @returns The fully qualified name
|
|
13
|
+
*/
|
|
14
|
+
export function joinQualifiedName(parent, child) {
|
|
15
|
+
return parent ? `${parent}.${child}` : child;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Recursively computes the fully qualified name for a child element within nested namespaces.
|
|
19
|
+
* @param namespace - The current namespace declaration
|
|
20
|
+
* @param childName - The name of the child element
|
|
21
|
+
* @returns The fully qualified name as a string
|
|
22
|
+
*/
|
|
23
|
+
export function toQualifiedName(namespace, childName) {
|
|
24
|
+
return isNamespaceDeclaration(namespace.$container)
|
|
25
|
+
? joinQualifiedName(toQualifiedName(namespace.$container, namespace.name), childName)
|
|
26
|
+
: joinQualifiedName(namespace.name, childName);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Provides qualified name computation for domain language elements, supporting nested namespaces and models.
|
|
30
|
+
* Used for FQN disambiguation and reference resolution.
|
|
31
|
+
*/
|
|
32
|
+
export class QualifiedNameProvider {
|
|
33
|
+
/**
|
|
34
|
+
* Computes the qualified name for a given qualifier and name.
|
|
35
|
+
* @param qualifier - The parent container (Model, NamespaceDeclaration, or string)
|
|
36
|
+
* @param name - The simple name of the element
|
|
37
|
+
* @returns The fully qualified name as a string
|
|
38
|
+
*/
|
|
39
|
+
getQualifiedName(qualifier, name) {
|
|
40
|
+
let prefix = isModel(qualifier) ? '' : qualifier;
|
|
41
|
+
if (isNamespaceDeclaration(prefix)) {
|
|
42
|
+
prefix = isNamespaceDeclaration(prefix.$container)
|
|
43
|
+
? this.getQualifiedName(prefix.$container, prefix.name)
|
|
44
|
+
: prefix.name;
|
|
45
|
+
}
|
|
46
|
+
return prefix ? `${prefix}.${name}` : name;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=domain-lang-naming.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain-lang-naming.js","sourceRoot":"","sources":["../../src/lsp/domain-lang-naming.ts"],"names":[],"mappings":"AAAA;;;;gFAIgF;AAMhF,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAEtE;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAc,EAAE,KAAa;IAC3D,OAAO,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AACjD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,SAA+B,EAAE,SAAiB;IAC9E,OAAO,sBAAsB,CAAC,SAAS,CAAC,UAAU,CAAC;QAC/C,CAAC,CAAC,iBAAiB,CAAC,eAAe,CAAC,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC;QACrF,CAAC,CAAC,iBAAiB,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AACvD,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,qBAAqB;IAC9B;;;;;OAKG;IACH,gBAAgB,CAAC,SAA6B,EAAE,IAAY;QACxD,IAAI,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QACjD,IAAI,sBAAsB,CAAC,MAAM,CAAC,EAAE,CAAC;YACjC,MAAM,GAAG,sBAAsB,CAAC,MAAM,CAAC,UAAU,CAAC;gBAC9C,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC;gBACvD,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;QACtB,CAAC;QACD,OAAO,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC/C,CAAC;CACJ"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/****************************************************************************
|
|
2
|
+
* Copyright 2021 TypeFox GmbH
|
|
3
|
+
* This program and the accompanying materials are made available under the
|
|
4
|
+
* terms of the MIT License, which is available in the project root.
|
|
5
|
+
***************************************************************************/
|
|
6
|
+
import type { AstNodeDescription, LangiumDocument, LocalSymbols } from 'langium';
|
|
7
|
+
import { DefaultScopeComputation } from 'langium';
|
|
8
|
+
import { CancellationToken } from 'vscode-jsonrpc';
|
|
9
|
+
import type { NamespaceDeclaration, Container } from '../generated/ast.js';
|
|
10
|
+
import { QualifiedNameProvider } from './domain-lang-naming.js';
|
|
11
|
+
import type { DomainLangServices } from '../domain-lang-module.js';
|
|
12
|
+
/**
|
|
13
|
+
* Computes the scope for DomainLang elements, supporting nested namespaces, FQN disambiguation, and cross-file references.
|
|
14
|
+
* Extends Langium's DefaultScopeComputation to provide custom export and local scope logic.
|
|
15
|
+
*/
|
|
16
|
+
export declare class DomainLangScopeComputation extends DefaultScopeComputation {
|
|
17
|
+
qualifiedNameProvider: QualifiedNameProvider;
|
|
18
|
+
/**
|
|
19
|
+
* Constructs a new DomainLangScopeComputation with injected services.
|
|
20
|
+
* @param services - The DomainLangServices instance
|
|
21
|
+
*/
|
|
22
|
+
constructor(services: DomainLangServices);
|
|
23
|
+
/**
|
|
24
|
+
* Computes exported node descriptions for types, using fully qualified names for nested namespaces.
|
|
25
|
+
* @param document - The LangiumDocument to process
|
|
26
|
+
* @param cancelToken - Optional cancellation token
|
|
27
|
+
* @returns A promise resolving to an array of AstNodeDescription
|
|
28
|
+
*/
|
|
29
|
+
collectExportedSymbols(document: LangiumDocument, cancelToken?: CancellationToken): Promise<AstNodeDescription[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Computes local scopes for all containers, recursively processing nested namespaces.
|
|
32
|
+
* @param document - The LangiumDocument to process
|
|
33
|
+
* @param cancelToken - Optional cancellation token
|
|
34
|
+
* @returns A promise resolving to a LocalSymbols map
|
|
35
|
+
*/
|
|
36
|
+
collectLocalSymbols(document: LangiumDocument, cancelToken?: CancellationToken): Promise<LocalSymbols>;
|
|
37
|
+
/**
|
|
38
|
+
* Recursively processes a container and its children, adding local descriptions and qualified names.
|
|
39
|
+
* @param container - The container node (Model or NamespaceDeclaration)
|
|
40
|
+
* @param scopes - The LocalSymbols map to populate
|
|
41
|
+
* @param document - The LangiumDocument being processed
|
|
42
|
+
* @param cancelToken - Optional cancellation token
|
|
43
|
+
* @returns A promise resolving to an array of AstNodeDescription
|
|
44
|
+
*/
|
|
45
|
+
protected processContainer(container: Container, scopes: LocalSymbols, document: LangiumDocument, cancelToken: CancellationToken): Promise<AstNodeDescription[]>;
|
|
46
|
+
/**
|
|
47
|
+
* Creates a qualified AstNodeDescription for a node within a namespace.
|
|
48
|
+
*
|
|
49
|
+
* @param namespace - The NamespaceDeclaration containing the node
|
|
50
|
+
* @param description - The AstNodeDescription to qualify
|
|
51
|
+
* @param document - The LangiumDocument being processed
|
|
52
|
+
* @returns A new AstNodeDescription with a fully qualified name
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* // For a Domain "Sales" in namespace "Shared"
|
|
56
|
+
* // Returns description with name "Shared.Sales"
|
|
57
|
+
*/
|
|
58
|
+
protected createQualifiedDescription(namespace: NamespaceDeclaration, description: AstNodeDescription, document: LangiumDocument): AstNodeDescription;
|
|
59
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// domain-lang-scope.ts
|
|
2
|
+
// Implements custom scope computation for the DomainLang DSL, supporting FQN disambiguation, nested groups, and cross-file references.
|
|
3
|
+
import { DefaultScopeComputation, interruptAndCheck, MultiMap, AstUtils } from 'langium';
|
|
4
|
+
import { CancellationToken } from 'vscode-jsonrpc';
|
|
5
|
+
import { isType, isNamespaceDeclaration } from '../generated/ast.js';
|
|
6
|
+
/**
|
|
7
|
+
* Computes the scope for DomainLang elements, supporting nested namespaces, FQN disambiguation, and cross-file references.
|
|
8
|
+
* Extends Langium's DefaultScopeComputation to provide custom export and local scope logic.
|
|
9
|
+
*/
|
|
10
|
+
export class DomainLangScopeComputation extends DefaultScopeComputation {
|
|
11
|
+
/**
|
|
12
|
+
* Constructs a new DomainLangScopeComputation with injected services.
|
|
13
|
+
* @param services - The DomainLangServices instance
|
|
14
|
+
*/
|
|
15
|
+
constructor(services) {
|
|
16
|
+
super(services);
|
|
17
|
+
this.qualifiedNameProvider = services.references.QualifiedNameProvider;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Computes exported node descriptions for types, using fully qualified names for nested namespaces.
|
|
21
|
+
* @param document - The LangiumDocument to process
|
|
22
|
+
* @param cancelToken - Optional cancellation token
|
|
23
|
+
* @returns A promise resolving to an array of AstNodeDescription
|
|
24
|
+
*/
|
|
25
|
+
async collectExportedSymbols(document, cancelToken = CancellationToken.None) {
|
|
26
|
+
const descr = [];
|
|
27
|
+
for (const modelNode of AstUtils.streamAllContents(document.parseResult.value)) {
|
|
28
|
+
await interruptAndCheck(cancelToken);
|
|
29
|
+
if (isType(modelNode)) {
|
|
30
|
+
let name = this.nameProvider.getName(modelNode);
|
|
31
|
+
if (!name) {
|
|
32
|
+
// Defensive: skip unnamed types
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (isNamespaceDeclaration(modelNode.$container)) {
|
|
36
|
+
name = this.qualifiedNameProvider.getQualifiedName(modelNode.$container, name);
|
|
37
|
+
}
|
|
38
|
+
descr.push(this.descriptions.createDescription(modelNode, name, document));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return descr;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Computes local scopes for all containers, recursively processing nested namespaces.
|
|
45
|
+
* @param document - The LangiumDocument to process
|
|
46
|
+
* @param cancelToken - Optional cancellation token
|
|
47
|
+
* @returns A promise resolving to a LocalSymbols map
|
|
48
|
+
*/
|
|
49
|
+
async collectLocalSymbols(document, cancelToken = CancellationToken.None) {
|
|
50
|
+
const model = document.parseResult.value;
|
|
51
|
+
const scopes = new MultiMap();
|
|
52
|
+
await this.processContainer(model, scopes, document, cancelToken);
|
|
53
|
+
return scopes;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Recursively processes a container and its children, adding local descriptions and qualified names.
|
|
57
|
+
* @param container - The container node (Model or NamespaceDeclaration)
|
|
58
|
+
* @param scopes - The LocalSymbols map to populate
|
|
59
|
+
* @param document - The LangiumDocument being processed
|
|
60
|
+
* @param cancelToken - Optional cancellation token
|
|
61
|
+
* @returns A promise resolving to an array of AstNodeDescription
|
|
62
|
+
*/
|
|
63
|
+
async processContainer(container, scopes, document, cancelToken) {
|
|
64
|
+
const localDescriptions = [];
|
|
65
|
+
for (const element of container.children) {
|
|
66
|
+
await interruptAndCheck(cancelToken);
|
|
67
|
+
if (isType(element) && element.name) {
|
|
68
|
+
const description = this.descriptions.createDescription(element, element.name, document);
|
|
69
|
+
localDescriptions.push(description);
|
|
70
|
+
}
|
|
71
|
+
else if (isNamespaceDeclaration(element)) {
|
|
72
|
+
const nestedDescriptions = await this.processContainer(element, scopes, document, cancelToken);
|
|
73
|
+
for (const description of nestedDescriptions) {
|
|
74
|
+
// Add qualified names to the container
|
|
75
|
+
const qualified = this.createQualifiedDescription(element, description, document);
|
|
76
|
+
localDescriptions.push(qualified);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// MultiMap implements LocalSymbols interface with add/addAll methods
|
|
81
|
+
scopes.addAll(container, localDescriptions);
|
|
82
|
+
return localDescriptions;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Creates a qualified AstNodeDescription for a node within a namespace.
|
|
86
|
+
*
|
|
87
|
+
* @param namespace - The NamespaceDeclaration containing the node
|
|
88
|
+
* @param description - The AstNodeDescription to qualify
|
|
89
|
+
* @param document - The LangiumDocument being processed
|
|
90
|
+
* @returns A new AstNodeDescription with a fully qualified name
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* // For a Domain "Sales" in namespace "Shared"
|
|
94
|
+
* // Returns description with name "Shared.Sales"
|
|
95
|
+
*/
|
|
96
|
+
createQualifiedDescription(namespace, description, document) {
|
|
97
|
+
const name = this.qualifiedNameProvider.getQualifiedName(namespace.name, description.name);
|
|
98
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
99
|
+
return this.descriptions.createDescription(description.node, name, document);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=domain-lang-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain-lang-scope.js","sourceRoot":"","sources":["../../src/lsp/domain-lang-scope.ts"],"names":[],"mappings":"AAAA,uBAAuB;AACvB,uIAAuI;AAcvI,OAAO,EACH,uBAAuB,EACvB,iBAAiB,EACjB,QAAQ,EACR,QAAQ,EACX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAIrE;;;GAGG;AACH,MAAM,OAAO,0BAA2B,SAAQ,uBAAuB;IAGnE;;;OAGG;IACH,YAAY,QAA4B;QACpC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IAAI,CAAC,qBAAqB,GAAG,QAAQ,CAAC,UAAU,CAAC,qBAAqB,CAAC;IAC3E,CAAC;IAED;;;;;OAKG;IACM,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AW,CAAC,IAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IAClF,CAAC;CACJ"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DDD Pattern Explanations for Hover Documentation
|
|
3
|
+
*
|
|
4
|
+
* Provides plain-English explanations for DDD integration patterns,
|
|
5
|
+
* relationship types, and decision categories.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Explanations for DDD integration role patterns (e.g., PL, ACL, SK).
|
|
9
|
+
*/
|
|
10
|
+
export declare const rolePatternExplanations: Record<string, string>;
|
|
11
|
+
/**
|
|
12
|
+
* Explanations for relationship types (e.g., Partnership, CustomerSupplier).
|
|
13
|
+
*/
|
|
14
|
+
export declare const relationshipTypeExplanations: Record<string, string>;
|
|
15
|
+
/**
|
|
16
|
+
* Explanations for relationship arrows.
|
|
17
|
+
*/
|
|
18
|
+
export declare const arrowExplanations: Record<string, string>;
|
|
19
|
+
/**
|
|
20
|
+
* Explanations for decision categories.
|
|
21
|
+
*/
|
|
22
|
+
export declare const decisionCategoryExplanations: Record<string, string>;
|
|
23
|
+
/**
|
|
24
|
+
* Explanations for common DDD classifications.
|
|
25
|
+
*/
|
|
26
|
+
export declare const classificationExplanations: Record<string, string>;
|
|
27
|
+
/**
|
|
28
|
+
* Get explanation for a role pattern.
|
|
29
|
+
*/
|
|
30
|
+
export declare function explainRolePattern(role: string): string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Get explanation for a relationship type.
|
|
33
|
+
*/
|
|
34
|
+
export declare function explainRelationshipType(type: string): string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Get explanation for an arrow symbol.
|
|
37
|
+
*/
|
|
38
|
+
export declare function explainArrow(arrow: string): string | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Get explanation for a decision category.
|
|
41
|
+
*/
|
|
42
|
+
export declare function explainDecisionCategory(category: string): string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Get explanation for a classification.
|
|
45
|
+
*/
|
|
46
|
+
export declare function explainClassification(name: string): string | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Generate relationship explanation from roles and type.
|
|
49
|
+
*/
|
|
50
|
+
export declare function generateRelationshipExplanation(leftRoles: string[] | undefined, arrow: string | undefined, rightRoles: string[] | undefined, type: string | undefined): string;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DDD Pattern Explanations for Hover Documentation
|
|
3
|
+
*
|
|
4
|
+
* Provides plain-English explanations for DDD integration patterns,
|
|
5
|
+
* relationship types, and decision categories.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Explanations for DDD integration role patterns (e.g., PL, ACL, SK).
|
|
9
|
+
*/
|
|
10
|
+
export const rolePatternExplanations = {
|
|
11
|
+
'PL': `**Published Language (PL)**
|
|
12
|
+
|
|
13
|
+
The upstream context provides a well-documented, stable API/model that downstream contexts consume.
|
|
14
|
+
|
|
15
|
+
\`\`\`domain-lang
|
|
16
|
+
[PL] UpstreamContext -> DownstreamContext
|
|
17
|
+
\`\`\`
|
|
18
|
+
|
|
19
|
+
*Use when:* Multiple consumers need a shared, stable interface.`,
|
|
20
|
+
'ACL': `**Anti-Corruption Layer (ACL)**
|
|
21
|
+
|
|
22
|
+
Protects downstream from upstream changes by translating between models.
|
|
23
|
+
|
|
24
|
+
\`\`\`domain-lang
|
|
25
|
+
UpstreamContext -> [ACL] DownstreamContext
|
|
26
|
+
\`\`\`
|
|
27
|
+
|
|
28
|
+
*Use when:* You don't trust upstream stability or want isolation.`,
|
|
29
|
+
'SK': `**Shared Kernel (SK)**
|
|
30
|
+
|
|
31
|
+
Both contexts share common domain model code requiring coordination.
|
|
32
|
+
|
|
33
|
+
\`\`\`domain-lang
|
|
34
|
+
[SK] Context1 <-> [SK] Context2 : SharedKernel
|
|
35
|
+
\`\`\`
|
|
36
|
+
|
|
37
|
+
*Use when:* Contexts are tightly coupled and teams can coordinate.`,
|
|
38
|
+
'CF': `**Conformist (CF)**
|
|
39
|
+
|
|
40
|
+
Downstream accepts upstream model without translation.
|
|
41
|
+
|
|
42
|
+
\`\`\`domain-lang
|
|
43
|
+
UpstreamContext -> [CF] DownstreamContext
|
|
44
|
+
\`\`\`
|
|
45
|
+
|
|
46
|
+
*Use when:* Upstream model is acceptable and translation isn't worth it.`,
|
|
47
|
+
'OHS': `**Open Host Service (OHS)**
|
|
48
|
+
|
|
49
|
+
Upstream defines a protocol/API for easy integration.
|
|
50
|
+
|
|
51
|
+
\`\`\`domain-lang
|
|
52
|
+
[OHS, PL] ApiContext -> ConsumerContext
|
|
53
|
+
\`\`\`
|
|
54
|
+
|
|
55
|
+
*Use when:* Multiple downstream contexts need integration.`,
|
|
56
|
+
'P': `**Partnership (P)**
|
|
57
|
+
|
|
58
|
+
Teams coordinate development and align releases.
|
|
59
|
+
|
|
60
|
+
\`\`\`domain-lang
|
|
61
|
+
Context1 <-> Context2 : Partnership
|
|
62
|
+
\`\`\`
|
|
63
|
+
|
|
64
|
+
*Use when:* Mutual success dependency exists.`,
|
|
65
|
+
'BBoM': `**Big Ball of Mud (BBoM)**
|
|
66
|
+
|
|
67
|
+
No clear boundaries - tangled models needing refactoring.
|
|
68
|
+
|
|
69
|
+
\`\`\`domain-lang
|
|
70
|
+
[BBoM] LegacySystem -> ModernContext
|
|
71
|
+
\`\`\`
|
|
72
|
+
|
|
73
|
+
*Use when:* Documenting legacy systems.`
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Explanations for relationship types (e.g., Partnership, CustomerSupplier).
|
|
77
|
+
*/
|
|
78
|
+
export const relationshipTypeExplanations = {
|
|
79
|
+
'Partnership': '**Partnership**\n\nTwo contexts with mutual success dependency. Teams plan together and coordinate releases.\n\n*Example:* Sales and Order Fulfillment contexts that must evolve in sync.',
|
|
80
|
+
'SharedKernel': '**Shared Kernel**\n\nTwo contexts share a subset of code/model. Changes require agreement from both teams.\n\n*Example:* Two closely related contexts sharing common domain entities.',
|
|
81
|
+
'CustomerSupplier': '**Customer/Supplier**\n\nDownstream (customer) context depends on upstream (supplier) context. Supplier meets customer\'s needs through negotiation.\n\n*Example:* Payment context (customer) depends on Billing context (supplier).',
|
|
82
|
+
'UpstreamDownstream': '**Upstream/Downstream**\n\nUpstream context influences downstream context, but not vice versa. Downstream adapts to upstream changes.\n\n*Example:* Inventory (upstream) provides data to Reporting (downstream).',
|
|
83
|
+
'SeparateWays': '**Separate Ways**\n\nNo connection between contexts - they duplicate functionality rather than integrate.\n\n*Use when:* Integration cost exceeds benefit of sharing.'
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Explanations for relationship arrows.
|
|
87
|
+
*/
|
|
88
|
+
export const arrowExplanations = {
|
|
89
|
+
'<->': 'Bidirectional relationship - both contexts influence each other',
|
|
90
|
+
'->': 'Downstream dependency - right depends on left (left is upstream)',
|
|
91
|
+
'<-': 'Upstream dependency - left depends on right (right is upstream)',
|
|
92
|
+
'><': 'Separate Ways - no integration between contexts',
|
|
93
|
+
'U/D': 'Upstream/Downstream - shorthand for upstream → downstream flow',
|
|
94
|
+
'u/d': 'Upstream/Downstream - shorthand for upstream → downstream flow',
|
|
95
|
+
'C/S': 'Customer/Supplier - shorthand for customer ← supplier relationship',
|
|
96
|
+
'c/s': 'Customer/Supplier - shorthand for customer ← supplier relationship'
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Explanations for decision categories.
|
|
100
|
+
*/
|
|
101
|
+
export const decisionCategoryExplanations = {
|
|
102
|
+
'architectural': '**Architectural Decision**\n\nConcerns system structure, technology choices, or cross-cutting patterns.\n\n*Examples:* Microservices vs monolith, event sourcing, CQRS',
|
|
103
|
+
'arch': 'Short for "architectural" - concerns system structure and technology choices',
|
|
104
|
+
'business': '**Business Decision**\n\nConcerns business rules, policies, or domain logic.\n\n*Examples:* Pricing rules, refund policies, eligibility criteria',
|
|
105
|
+
'biz': 'Short for "business" - concerns business rules and domain logic',
|
|
106
|
+
'technical': '**Technical Decision**\n\nConcerns implementation details, algorithms, or technical constraints.\n\n*Examples:* Caching strategy, data structures, optimization approach',
|
|
107
|
+
'tech': 'Short for "technical" - concerns implementation details',
|
|
108
|
+
'compliance': '**Compliance Decision**\n\nConcerns legal, regulatory, or compliance requirements.\n\n*Examples:* GDPR data retention, SOX audit trails, HIPAA privacy',
|
|
109
|
+
'security': '**Security Decision**\n\nConcerns security, authentication, authorization, or data protection.\n\n*Examples:* OAuth vs JWT, encryption at rest, access control',
|
|
110
|
+
'operational': '**Operational Decision**\n\nConcerns deployment, monitoring, or operational procedures.\n\n*Examples:* Blue/green deployment, monitoring strategy, backup policy',
|
|
111
|
+
'ops': 'Short for "operational" - concerns deployment and operations'
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Explanations for common DDD classifications.
|
|
115
|
+
*/
|
|
116
|
+
export const classificationExplanations = {
|
|
117
|
+
'Core': '**Core Domain**\n\nThe primary differentiator for your business - this is where you create unique value.\n\n*Invest heavily:* Best team, careful design, deep modeling.\n\n*Example:* Recommendation engine for Netflix, search for Google',
|
|
118
|
+
'Supporting': '**Supporting Subdomain**\n\nNecessary for the business but not a differentiator. Custom implementation needed but not the main focus.\n\n*Invest moderately:* Good team, solid implementation.\n\n*Example:* Inventory management, invoicing',
|
|
119
|
+
'Generic': '**Generic Subdomain**\n\nSolved problem - could use off-the-shelf solution. No competitive advantage.\n\n*Buy or reuse:* Use existing solutions when possible.\n\n*Example:* User authentication, email sending, payment processing',
|
|
120
|
+
'Strategic': '**Strategic** (Wardley Evolution)\n\nNovel, custom-built, competitive advantage. High value, low maturity.\n\n*Similar to Core Domain.*',
|
|
121
|
+
'Custom': '**Custom-Built** (Wardley Evolution)\n\nSpecialized solution, some precedent exists. Medium-high value, medium maturity.',
|
|
122
|
+
'Product': '**Product/Rental** (Wardley Evolution)\n\nStandardized product with features. Medium value, medium-high maturity.\n\n*Example:* SaaS tools, commercial software',
|
|
123
|
+
'Commodity': '**Commodity/Utility** (Wardley Evolution)\n\nUbiquitous, interchangeable, fully standardized. Low value, high maturity.\n\n*Example:* Cloud compute, email services'
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Get explanation for a role pattern.
|
|
127
|
+
*/
|
|
128
|
+
export function explainRolePattern(role) {
|
|
129
|
+
return rolePatternExplanations[role];
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Get explanation for a relationship type.
|
|
133
|
+
*/
|
|
134
|
+
export function explainRelationshipType(type) {
|
|
135
|
+
return relationshipTypeExplanations[type];
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Get explanation for an arrow symbol.
|
|
139
|
+
*/
|
|
140
|
+
export function explainArrow(arrow) {
|
|
141
|
+
return arrowExplanations[arrow];
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Get explanation for a decision category.
|
|
145
|
+
*/
|
|
146
|
+
export function explainDecisionCategory(category) {
|
|
147
|
+
return decisionCategoryExplanations[category];
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Get explanation for a classification.
|
|
151
|
+
*/
|
|
152
|
+
export function explainClassification(name) {
|
|
153
|
+
return classificationExplanations[name];
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Generate relationship explanation from roles and type.
|
|
157
|
+
*/
|
|
158
|
+
export function generateRelationshipExplanation(leftRoles, arrow, rightRoles, type) {
|
|
159
|
+
const parts = [];
|
|
160
|
+
// Arrow explanation
|
|
161
|
+
if (arrow) {
|
|
162
|
+
const arrowExp = explainArrow(arrow);
|
|
163
|
+
if (arrowExp) {
|
|
164
|
+
parts.push(`**Arrow:** ${arrowExp}`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// Left roles
|
|
168
|
+
if (leftRoles && leftRoles.length > 0) {
|
|
169
|
+
parts.push('**Left Context Patterns:**');
|
|
170
|
+
leftRoles.forEach(role => {
|
|
171
|
+
const exp = explainRolePattern(role);
|
|
172
|
+
if (exp) {
|
|
173
|
+
parts.push(exp);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
// Right roles
|
|
178
|
+
if (rightRoles && rightRoles.length > 0) {
|
|
179
|
+
parts.push('**Right Context Patterns:**');
|
|
180
|
+
rightRoles.forEach(role => {
|
|
181
|
+
const exp = explainRolePattern(role);
|
|
182
|
+
if (exp) {
|
|
183
|
+
parts.push(exp);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
// Relationship type
|
|
188
|
+
if (type) {
|
|
189
|
+
const typeExp = explainRelationshipType(type);
|
|
190
|
+
if (typeExp) {
|
|
191
|
+
parts.push(typeExp);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return parts.join('\n\n---\n\n');
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=ddd-pattern-explanations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ddd-pattern-explanations.js","sourceRoot":"","sources":["../../../src/lsp/hover/ddd-pattern-explanations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAA2B;IAC3D,IAAI,EAAE;;;;;;;;gEAQsD;IAE5D,KAAK,EAAE;;;;;;;;kEAQuD;IAE9D,IAAI,EAAE;;;;;;;;mEAQyD;IAE/D,IAAI,EAAE;;;;;;;;yEAQ+D;IAErE,KAAK,EAAE;;;;;;;;2DAQgD;IAEvD,GAAG,EAAE;;;;;;;;8CAQqC;IAE1C,MAAM,EAAE;;;;;;;;wCAQ4B;CACvC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAA2B;IAChE,aAAa,EAAE,2LAA2L;IAE1M,cAAc,EAAE,uLAAuL;IAEvM,kBAAkB,EAAE,sOAAsO;IAE1P,oBAAoB,EAAE,mNAAmN;IAEzO,cAAc,EAAE,uKAAuK;CAC1L,CAAC;AAEF;;GAEG;AACH,MAAM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I,IAAI,EAAE,CAAC;QACP,MAAM,OAAO,GAAG,uBAAuB,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,OAAO,EAAE,CAAC;YACV,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC;IACL,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AstNode, CommentProvider, DocumentationProvider, LangiumDocument, MaybePromise } from 'langium';
|
|
2
|
+
import type { LangiumServices } from 'langium/lsp';
|
|
3
|
+
import { AstNodeHoverProvider } from 'langium/lsp';
|
|
4
|
+
import type { Hover, HoverParams } from 'vscode-languageserver';
|
|
5
|
+
import { QualifiedNameProvider } from '../domain-lang-naming.js';
|
|
6
|
+
/**
|
|
7
|
+
* Provides hover information for DomainLang elements.
|
|
8
|
+
*/
|
|
9
|
+
export declare class DomainLangHoverProvider extends AstNodeHoverProvider {
|
|
10
|
+
protected readonly documentationProvider: DocumentationProvider;
|
|
11
|
+
protected readonly commentProvider: CommentProvider;
|
|
12
|
+
protected readonly qualifiedNameProvider: QualifiedNameProvider;
|
|
13
|
+
constructor(services: LangiumServices);
|
|
14
|
+
getHoverContent(document: LangiumDocument, params: HoverParams): Promise<Hover | undefined>;
|
|
15
|
+
protected getAstNodeHoverContent(node: AstNode): MaybePromise<string | undefined>;
|
|
16
|
+
private getRefName;
|
|
17
|
+
private refLink;
|
|
18
|
+
protected getKeywordHoverContent(node: AstNode): MaybePromise<Hover | undefined>;
|
|
19
|
+
}
|