@domainlang/language 0.1.20
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 +163 -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 +57 -0
- package/out/domain-lang-module.js +67 -0
- package/out/domain-lang-module.js.map +1 -0
- package/out/generated/ast.d.ts +759 -0
- package/out/generated/ast.js +556 -0
- package/out/generated/ast.js.map +1 -0
- package/out/generated/grammar.d.ts +6 -0
- package/out/generated/grammar.js +2407 -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 +16 -0
- package/out/index.js +22 -0
- package/out/index.js.map +1 -0
- package/out/lsp/domain-lang-code-actions.d.ts +55 -0
- package/out/lsp/domain-lang-code-actions.js +143 -0
- package/out/lsp/domain-lang-code-actions.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/domain-lang-workspace-manager.d.ts +21 -0
- package/out/lsp/domain-lang-workspace-manager.js +93 -0
- package/out/lsp/domain-lang-workspace-manager.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 +302 -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/lsp/manifest-diagnostics.d.ts +82 -0
- package/out/lsp/manifest-diagnostics.js +230 -0
- package/out/lsp/manifest-diagnostics.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 +51 -0
- package/out/sdk/loader-node.js +119 -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 +280 -0
- package/out/sdk/types.js +8 -0
- package/out/sdk/types.js.map +1 -0
- package/out/services/dependency-analyzer.d.ts +58 -0
- package/out/services/dependency-analyzer.js +254 -0
- package/out/services/dependency-analyzer.js.map +1 -0
- package/out/services/dependency-resolver.d.ts +146 -0
- package/out/services/dependency-resolver.js +452 -0
- package/out/services/dependency-resolver.js.map +1 -0
- package/out/services/git-url-resolver.browser.d.ts +10 -0
- package/out/services/git-url-resolver.browser.js +19 -0
- package/out/services/git-url-resolver.browser.js.map +1 -0
- package/out/services/git-url-resolver.d.ts +158 -0
- package/out/services/git-url-resolver.js +416 -0
- package/out/services/git-url-resolver.js.map +1 -0
- package/out/services/governance-validator.d.ts +44 -0
- package/out/services/governance-validator.js +153 -0
- package/out/services/governance-validator.js.map +1 -0
- package/out/services/import-resolver.d.ts +77 -0
- package/out/services/import-resolver.js +240 -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/semver.d.ts +98 -0
- package/out/services/semver.js +195 -0
- package/out/services/semver.js.map +1 -0
- package/out/services/types.d.ts +340 -0
- package/out/services/types.js +46 -0
- package/out/services/types.js.map +1 -0
- package/out/services/workspace-manager.d.ts +123 -0
- package/out/services/workspace-manager.js +489 -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 +49 -0
- package/out/utils/import-utils.js +128 -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 +180 -0
- package/out/validation/constants.js +235 -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 +63 -0
- package/out/validation/domain.js.map +1 -0
- package/out/validation/import.d.ts +68 -0
- package/out/validation/import.js +237 -0
- package/out/validation/import.js.map +1 -0
- package/out/validation/manifest.d.ts +144 -0
- package/out/validation/manifest.js +327 -0
- package/out/validation/manifest.js.map +1 -0
- package/out/validation/maps.d.ts +21 -0
- package/out/validation/maps.js +60 -0
- package/out/validation/maps.js.map +1 -0
- package/out/validation/metadata.d.ts +7 -0
- package/out/validation/metadata.js +16 -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 +110 -0
- package/src/ast-augmentation.ts +5 -0
- package/src/domain-lang-module.ts +112 -0
- package/src/domain-lang.langium +351 -0
- package/src/generated/ast.ts +986 -0
- package/src/generated/grammar.ts +2409 -0
- package/src/generated/module.ts +25 -0
- package/src/index.ts +24 -0
- package/src/lsp/domain-lang-code-actions.ts +189 -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/domain-lang-workspace-manager.ts +104 -0
- package/src/lsp/hover/ddd-pattern-explanations.ts +237 -0
- package/src/lsp/hover/domain-lang-hover.ts +338 -0
- package/src/lsp/hover/domain-lang-keywords.ts +50 -0
- package/src/lsp/manifest-diagnostics.ts +290 -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 +126 -0
- package/src/sdk/indexes.ts +155 -0
- package/src/sdk/loader-node.ts +146 -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 +323 -0
- package/src/services/dependency-analyzer.ts +321 -0
- package/src/services/dependency-resolver.ts +551 -0
- package/src/services/git-url-resolver.browser.ts +26 -0
- package/src/services/git-url-resolver.ts +517 -0
- package/src/services/governance-validator.ts +177 -0
- package/src/services/import-resolver.ts +292 -0
- package/src/services/performance-optimizer.ts +170 -0
- package/src/services/relationship-inference.ts +121 -0
- package/src/services/semver.ts +213 -0
- package/src/services/types.ts +415 -0
- package/src/services/workspace-manager.ts +607 -0
- package/src/syntaxes/domain-lang.monarch.ts +29 -0
- package/src/utils/import-utils.ts +152 -0
- package/src/validation/bounded-context.ts +99 -0
- package/src/validation/classification.ts +5 -0
- package/src/validation/constants.ts +304 -0
- package/src/validation/domain-lang-validator.ts +33 -0
- package/src/validation/domain.ts +77 -0
- package/src/validation/import.ts +295 -0
- package/src/validation/manifest.ts +439 -0
- package/src/validation/maps.ts +76 -0
- package/src/validation/metadata.ts +18 -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,25 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
* This file was generated by langium-cli 4.2.0.
|
|
3
|
+
* DO NOT EDIT MANUALLY!
|
|
4
|
+
******************************************************************************/
|
|
5
|
+
|
|
6
|
+
import type { LangiumSharedCoreServices, LangiumCoreServices, LangiumGeneratedCoreServices, LangiumGeneratedSharedCoreServices, LanguageMetaData, Module } from 'langium';
|
|
7
|
+
import { DomainLangAstReflection } from './ast.js';
|
|
8
|
+
import { DomainLangGrammar } from './grammar.js';
|
|
9
|
+
|
|
10
|
+
export const DomainLangLanguageMetaData = {
|
|
11
|
+
languageId: 'domain-lang',
|
|
12
|
+
fileExtensions: ['.dlang'],
|
|
13
|
+
caseInsensitive: false,
|
|
14
|
+
mode: 'development'
|
|
15
|
+
} as const satisfies LanguageMetaData;
|
|
16
|
+
|
|
17
|
+
export const DomainLangGeneratedSharedModule: Module<LangiumSharedCoreServices, LangiumGeneratedSharedCoreServices> = {
|
|
18
|
+
AstReflection: () => new DomainLangAstReflection()
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const DomainLangGeneratedModule: Module<LangiumCoreServices, LangiumGeneratedCoreServices> = {
|
|
22
|
+
Grammar: () => DomainLangGrammar(),
|
|
23
|
+
LanguageMetaData: () => DomainLangLanguageMetaData,
|
|
24
|
+
parser: {}
|
|
25
|
+
};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export * from './domain-lang-module.js';
|
|
2
|
+
export * from './generated/ast.js';
|
|
3
|
+
export * from './generated/grammar.js';
|
|
4
|
+
export * from './generated/module.js';
|
|
5
|
+
// Note: main.js is intentionally NOT exported here - it's the LSP entry point
|
|
6
|
+
// and creates a connection when imported, which breaks CLI/SDK standalone usage
|
|
7
|
+
export * from './ast-augmentation.js';
|
|
8
|
+
|
|
9
|
+
// Export centralized types (canonical source for all service types)
|
|
10
|
+
export * from './services/types.js';
|
|
11
|
+
|
|
12
|
+
// Export services
|
|
13
|
+
export * from './services/workspace-manager.js';
|
|
14
|
+
export * from './services/dependency-resolver.js';
|
|
15
|
+
export * from './services/dependency-analyzer.js';
|
|
16
|
+
export * from './services/governance-validator.js';
|
|
17
|
+
export * from './services/import-resolver.js';
|
|
18
|
+
export * from './services/relationship-inference.js';
|
|
19
|
+
export * from './services/git-url-resolver.js';
|
|
20
|
+
export * from './services/performance-optimizer.js';
|
|
21
|
+
export * from './services/semver.js';
|
|
22
|
+
|
|
23
|
+
// Export LSP services
|
|
24
|
+
export * from './lsp/manifest-diagnostics.js';
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code Action Provider for DomainLang.
|
|
3
|
+
*
|
|
4
|
+
* Provides quick-fix code actions for validation diagnostics.
|
|
5
|
+
*
|
|
6
|
+
* Key Features:
|
|
7
|
+
* - "Add dependency to model.yaml" for unknown import aliases
|
|
8
|
+
* - "Run dlang install" for uninstalled dependencies
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import type { CodeAction, CodeActionParams, Command, Diagnostic } from 'vscode-languageserver';
|
|
14
|
+
import { CodeActionKind } from 'vscode-languageserver';
|
|
15
|
+
import type { MaybePromise, LangiumDocument } from 'langium';
|
|
16
|
+
import type { CodeActionProvider } from 'langium/lsp';
|
|
17
|
+
import { IssueCodes } from '../validation/constants.js';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Shape of diagnostic data used for code action matching.
|
|
21
|
+
* Must match the data structure used in validators.
|
|
22
|
+
*/
|
|
23
|
+
interface ImportDiagnosticData {
|
|
24
|
+
code: string;
|
|
25
|
+
alias?: string;
|
|
26
|
+
specifier?: string;
|
|
27
|
+
path?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Code action provider for DomainLang LSP features.
|
|
32
|
+
*
|
|
33
|
+
* Implements quick fixes for:
|
|
34
|
+
* - Import validation errors (add to model.yaml, run install)
|
|
35
|
+
*/
|
|
36
|
+
export class DomainLangCodeActionProvider implements CodeActionProvider {
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Generates code actions for the given diagnostics.
|
|
40
|
+
*
|
|
41
|
+
* @param document - The document containing the diagnostics
|
|
42
|
+
* @param params - Code action request parameters including diagnostics
|
|
43
|
+
* @returns Array of code actions, or undefined if none applicable
|
|
44
|
+
*/
|
|
45
|
+
getCodeActions(
|
|
46
|
+
document: LangiumDocument,
|
|
47
|
+
params: CodeActionParams
|
|
48
|
+
): MaybePromise<Array<Command | CodeAction> | undefined> {
|
|
49
|
+
const result: CodeAction[] = [];
|
|
50
|
+
const acceptor = (ca: CodeAction | undefined): void => {
|
|
51
|
+
if (ca) result.push(ca);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
for (const diagnostic of params.context.diagnostics) {
|
|
55
|
+
this.createCodeActions(diagnostic, document, acceptor);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return result.length > 0 ? result : undefined;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Creates code actions for a specific diagnostic.
|
|
63
|
+
*
|
|
64
|
+
* Matches on diagnostic.data.code to determine which quick fix to offer.
|
|
65
|
+
*/
|
|
66
|
+
private createCodeActions(
|
|
67
|
+
diagnostic: Diagnostic,
|
|
68
|
+
document: LangiumDocument,
|
|
69
|
+
accept: (ca: CodeAction | undefined) => void
|
|
70
|
+
): void {
|
|
71
|
+
const data = diagnostic.data as ImportDiagnosticData | undefined;
|
|
72
|
+
if (!data?.code) return;
|
|
73
|
+
|
|
74
|
+
switch (data.code) {
|
|
75
|
+
case IssueCodes.ImportNotInManifest:
|
|
76
|
+
if (data.alias) {
|
|
77
|
+
accept(this.createAddToManifestAction(diagnostic, document, data.alias));
|
|
78
|
+
}
|
|
79
|
+
break;
|
|
80
|
+
|
|
81
|
+
case IssueCodes.ImportRequiresManifest:
|
|
82
|
+
if (data.specifier) {
|
|
83
|
+
accept(this.createCreateManifestAction(diagnostic, document, data.specifier));
|
|
84
|
+
}
|
|
85
|
+
break;
|
|
86
|
+
|
|
87
|
+
case IssueCodes.ImportNotInstalled:
|
|
88
|
+
if (data.alias) {
|
|
89
|
+
accept(this.createRunInstallAction(diagnostic, data.alias));
|
|
90
|
+
}
|
|
91
|
+
break;
|
|
92
|
+
|
|
93
|
+
case IssueCodes.ImportMissingRef:
|
|
94
|
+
if (data.alias) {
|
|
95
|
+
accept(this.createAddRefAction(diagnostic, data.alias));
|
|
96
|
+
}
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Creates a code action to add a dependency to model.yaml.
|
|
103
|
+
*
|
|
104
|
+
* This generates a WorkspaceEdit that modifies model.yaml to add
|
|
105
|
+
* the missing dependency with a placeholder version.
|
|
106
|
+
*/
|
|
107
|
+
private createAddToManifestAction(
|
|
108
|
+
diagnostic: Diagnostic,
|
|
109
|
+
_document: LangiumDocument,
|
|
110
|
+
alias: string
|
|
111
|
+
): CodeAction {
|
|
112
|
+
// Create a command that will be executed to add the dependency
|
|
113
|
+
// Since we can't directly edit model.yaml from here (it's not the current document),
|
|
114
|
+
// we provide a command that the extension can handle
|
|
115
|
+
return {
|
|
116
|
+
title: `Add '${alias}' to model.yaml`,
|
|
117
|
+
kind: CodeActionKind.QuickFix,
|
|
118
|
+
diagnostics: [diagnostic],
|
|
119
|
+
isPreferred: true,
|
|
120
|
+
command: {
|
|
121
|
+
title: `Add '${alias}' to model.yaml`,
|
|
122
|
+
command: 'domainlang.addDependency',
|
|
123
|
+
arguments: [alias]
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Creates a code action to create model.yaml with the dependency.
|
|
130
|
+
*/
|
|
131
|
+
private createCreateManifestAction(
|
|
132
|
+
diagnostic: Diagnostic,
|
|
133
|
+
_document: LangiumDocument,
|
|
134
|
+
specifier: string
|
|
135
|
+
): CodeAction {
|
|
136
|
+
const alias = specifier.split('/')[0];
|
|
137
|
+
return {
|
|
138
|
+
title: `Create model.yaml with '${alias}' dependency`,
|
|
139
|
+
kind: CodeActionKind.QuickFix,
|
|
140
|
+
diagnostics: [diagnostic],
|
|
141
|
+
isPreferred: true,
|
|
142
|
+
command: {
|
|
143
|
+
title: `Create model.yaml`,
|
|
144
|
+
command: 'domainlang.createManifest',
|
|
145
|
+
arguments: [alias, specifier]
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Creates a code action to run dlang install.
|
|
152
|
+
*/
|
|
153
|
+
private createRunInstallAction(
|
|
154
|
+
diagnostic: Diagnostic,
|
|
155
|
+
alias: string
|
|
156
|
+
): CodeAction {
|
|
157
|
+
return {
|
|
158
|
+
title: `Run 'dlang install' to fetch '${alias}'`,
|
|
159
|
+
kind: CodeActionKind.QuickFix,
|
|
160
|
+
diagnostics: [diagnostic],
|
|
161
|
+
isPreferred: true,
|
|
162
|
+
command: {
|
|
163
|
+
title: 'Install dependencies',
|
|
164
|
+
command: 'domainlang.install',
|
|
165
|
+
arguments: []
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Creates a code action to add ref to dependency.
|
|
172
|
+
*/
|
|
173
|
+
private createAddRefAction(
|
|
174
|
+
diagnostic: Diagnostic,
|
|
175
|
+
alias: string
|
|
176
|
+
): CodeAction {
|
|
177
|
+
return {
|
|
178
|
+
title: `Add git ref to '${alias}' in model.yaml`,
|
|
179
|
+
kind: CodeActionKind.QuickFix,
|
|
180
|
+
diagnostics: [diagnostic],
|
|
181
|
+
isPreferred: false,
|
|
182
|
+
command: {
|
|
183
|
+
title: 'Add ref',
|
|
184
|
+
command: 'domainlang.addRef',
|
|
185
|
+
arguments: [alias]
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
}
|