@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.
Files changed (212) hide show
  1. package/README.md +163 -0
  2. package/out/ast-augmentation.d.ts +6 -0
  3. package/out/ast-augmentation.js +2 -0
  4. package/out/ast-augmentation.js.map +1 -0
  5. package/out/domain-lang-module.d.ts +57 -0
  6. package/out/domain-lang-module.js +67 -0
  7. package/out/domain-lang-module.js.map +1 -0
  8. package/out/generated/ast.d.ts +759 -0
  9. package/out/generated/ast.js +556 -0
  10. package/out/generated/ast.js.map +1 -0
  11. package/out/generated/grammar.d.ts +6 -0
  12. package/out/generated/grammar.js +2407 -0
  13. package/out/generated/grammar.js.map +1 -0
  14. package/out/generated/module.d.ts +13 -0
  15. package/out/generated/module.js +21 -0
  16. package/out/generated/module.js.map +1 -0
  17. package/out/index.d.ts +16 -0
  18. package/out/index.js +22 -0
  19. package/out/index.js.map +1 -0
  20. package/out/lsp/domain-lang-code-actions.d.ts +55 -0
  21. package/out/lsp/domain-lang-code-actions.js +143 -0
  22. package/out/lsp/domain-lang-code-actions.js.map +1 -0
  23. package/out/lsp/domain-lang-completion.d.ts +37 -0
  24. package/out/lsp/domain-lang-completion.js +452 -0
  25. package/out/lsp/domain-lang-completion.js.map +1 -0
  26. package/out/lsp/domain-lang-formatter.d.ts +15 -0
  27. package/out/lsp/domain-lang-formatter.js +43 -0
  28. package/out/lsp/domain-lang-formatter.js.map +1 -0
  29. package/out/lsp/domain-lang-naming.d.ts +34 -0
  30. package/out/lsp/domain-lang-naming.js +49 -0
  31. package/out/lsp/domain-lang-naming.js.map +1 -0
  32. package/out/lsp/domain-lang-scope.d.ts +59 -0
  33. package/out/lsp/domain-lang-scope.js +102 -0
  34. package/out/lsp/domain-lang-scope.js.map +1 -0
  35. package/out/lsp/domain-lang-workspace-manager.d.ts +21 -0
  36. package/out/lsp/domain-lang-workspace-manager.js +93 -0
  37. package/out/lsp/domain-lang-workspace-manager.js.map +1 -0
  38. package/out/lsp/hover/ddd-pattern-explanations.d.ts +50 -0
  39. package/out/lsp/hover/ddd-pattern-explanations.js +196 -0
  40. package/out/lsp/hover/ddd-pattern-explanations.js.map +1 -0
  41. package/out/lsp/hover/domain-lang-hover.d.ts +19 -0
  42. package/out/lsp/hover/domain-lang-hover.js +302 -0
  43. package/out/lsp/hover/domain-lang-hover.js.map +1 -0
  44. package/out/lsp/hover/domain-lang-keywords.d.ts +13 -0
  45. package/out/lsp/hover/domain-lang-keywords.js +47 -0
  46. package/out/lsp/hover/domain-lang-keywords.js.map +1 -0
  47. package/out/lsp/manifest-diagnostics.d.ts +82 -0
  48. package/out/lsp/manifest-diagnostics.js +230 -0
  49. package/out/lsp/manifest-diagnostics.js.map +1 -0
  50. package/out/main-browser.d.ts +1 -0
  51. package/out/main-browser.js +11 -0
  52. package/out/main-browser.js.map +1 -0
  53. package/out/main.d.ts +1 -0
  54. package/out/main.js +74 -0
  55. package/out/main.js.map +1 -0
  56. package/out/sdk/ast-augmentation.d.ts +136 -0
  57. package/out/sdk/ast-augmentation.js +62 -0
  58. package/out/sdk/ast-augmentation.js.map +1 -0
  59. package/out/sdk/index.d.ts +94 -0
  60. package/out/sdk/index.js +97 -0
  61. package/out/sdk/index.js.map +1 -0
  62. package/out/sdk/indexes.d.ts +16 -0
  63. package/out/sdk/indexes.js +97 -0
  64. package/out/sdk/indexes.js.map +1 -0
  65. package/out/sdk/loader-node.d.ts +51 -0
  66. package/out/sdk/loader-node.js +119 -0
  67. package/out/sdk/loader-node.js.map +1 -0
  68. package/out/sdk/loader.d.ts +49 -0
  69. package/out/sdk/loader.js +85 -0
  70. package/out/sdk/loader.js.map +1 -0
  71. package/out/sdk/patterns.d.ts +93 -0
  72. package/out/sdk/patterns.js +123 -0
  73. package/out/sdk/patterns.js.map +1 -0
  74. package/out/sdk/query.d.ts +90 -0
  75. package/out/sdk/query.js +679 -0
  76. package/out/sdk/query.js.map +1 -0
  77. package/out/sdk/resolution.d.ts +52 -0
  78. package/out/sdk/resolution.js +68 -0
  79. package/out/sdk/resolution.js.map +1 -0
  80. package/out/sdk/types.d.ts +280 -0
  81. package/out/sdk/types.js +8 -0
  82. package/out/sdk/types.js.map +1 -0
  83. package/out/services/dependency-analyzer.d.ts +58 -0
  84. package/out/services/dependency-analyzer.js +254 -0
  85. package/out/services/dependency-analyzer.js.map +1 -0
  86. package/out/services/dependency-resolver.d.ts +146 -0
  87. package/out/services/dependency-resolver.js +452 -0
  88. package/out/services/dependency-resolver.js.map +1 -0
  89. package/out/services/git-url-resolver.browser.d.ts +10 -0
  90. package/out/services/git-url-resolver.browser.js +19 -0
  91. package/out/services/git-url-resolver.browser.js.map +1 -0
  92. package/out/services/git-url-resolver.d.ts +158 -0
  93. package/out/services/git-url-resolver.js +416 -0
  94. package/out/services/git-url-resolver.js.map +1 -0
  95. package/out/services/governance-validator.d.ts +44 -0
  96. package/out/services/governance-validator.js +153 -0
  97. package/out/services/governance-validator.js.map +1 -0
  98. package/out/services/import-resolver.d.ts +77 -0
  99. package/out/services/import-resolver.js +240 -0
  100. package/out/services/import-resolver.js.map +1 -0
  101. package/out/services/performance-optimizer.d.ts +60 -0
  102. package/out/services/performance-optimizer.js +140 -0
  103. package/out/services/performance-optimizer.js.map +1 -0
  104. package/out/services/relationship-inference.d.ts +11 -0
  105. package/out/services/relationship-inference.js +98 -0
  106. package/out/services/relationship-inference.js.map +1 -0
  107. package/out/services/semver.d.ts +98 -0
  108. package/out/services/semver.js +195 -0
  109. package/out/services/semver.js.map +1 -0
  110. package/out/services/types.d.ts +340 -0
  111. package/out/services/types.js +46 -0
  112. package/out/services/types.js.map +1 -0
  113. package/out/services/workspace-manager.d.ts +123 -0
  114. package/out/services/workspace-manager.js +489 -0
  115. package/out/services/workspace-manager.js.map +1 -0
  116. package/out/syntaxes/domain-lang.monarch.d.ts +76 -0
  117. package/out/syntaxes/domain-lang.monarch.js +29 -0
  118. package/out/syntaxes/domain-lang.monarch.js.map +1 -0
  119. package/out/utils/import-utils.d.ts +49 -0
  120. package/out/utils/import-utils.js +128 -0
  121. package/out/utils/import-utils.js.map +1 -0
  122. package/out/validation/bounded-context.d.ts +11 -0
  123. package/out/validation/bounded-context.js +79 -0
  124. package/out/validation/bounded-context.js.map +1 -0
  125. package/out/validation/classification.d.ts +3 -0
  126. package/out/validation/classification.js +3 -0
  127. package/out/validation/classification.js.map +1 -0
  128. package/out/validation/constants.d.ts +180 -0
  129. package/out/validation/constants.js +235 -0
  130. package/out/validation/constants.js.map +1 -0
  131. package/out/validation/domain-lang-validator.d.ts +2 -0
  132. package/out/validation/domain-lang-validator.js +27 -0
  133. package/out/validation/domain-lang-validator.js.map +1 -0
  134. package/out/validation/domain.d.ts +11 -0
  135. package/out/validation/domain.js +63 -0
  136. package/out/validation/domain.js.map +1 -0
  137. package/out/validation/import.d.ts +68 -0
  138. package/out/validation/import.js +237 -0
  139. package/out/validation/import.js.map +1 -0
  140. package/out/validation/manifest.d.ts +144 -0
  141. package/out/validation/manifest.js +327 -0
  142. package/out/validation/manifest.js.map +1 -0
  143. package/out/validation/maps.d.ts +21 -0
  144. package/out/validation/maps.js +60 -0
  145. package/out/validation/maps.js.map +1 -0
  146. package/out/validation/metadata.d.ts +7 -0
  147. package/out/validation/metadata.js +16 -0
  148. package/out/validation/metadata.js.map +1 -0
  149. package/out/validation/model.d.ts +12 -0
  150. package/out/validation/model.js +29 -0
  151. package/out/validation/model.js.map +1 -0
  152. package/out/validation/relationships.d.ts +12 -0
  153. package/out/validation/relationships.js +94 -0
  154. package/out/validation/relationships.js.map +1 -0
  155. package/out/validation/shared.d.ts +6 -0
  156. package/out/validation/shared.js +12 -0
  157. package/out/validation/shared.js.map +1 -0
  158. package/package.json +110 -0
  159. package/src/ast-augmentation.ts +5 -0
  160. package/src/domain-lang-module.ts +112 -0
  161. package/src/domain-lang.langium +351 -0
  162. package/src/generated/ast.ts +986 -0
  163. package/src/generated/grammar.ts +2409 -0
  164. package/src/generated/module.ts +25 -0
  165. package/src/index.ts +24 -0
  166. package/src/lsp/domain-lang-code-actions.ts +189 -0
  167. package/src/lsp/domain-lang-completion.ts +514 -0
  168. package/src/lsp/domain-lang-formatter.ts +51 -0
  169. package/src/lsp/domain-lang-naming.ts +56 -0
  170. package/src/lsp/domain-lang-scope.ts +137 -0
  171. package/src/lsp/domain-lang-workspace-manager.ts +104 -0
  172. package/src/lsp/hover/ddd-pattern-explanations.ts +237 -0
  173. package/src/lsp/hover/domain-lang-hover.ts +338 -0
  174. package/src/lsp/hover/domain-lang-keywords.ts +50 -0
  175. package/src/lsp/manifest-diagnostics.ts +290 -0
  176. package/src/main-browser.ts +15 -0
  177. package/src/main.ts +85 -0
  178. package/src/sdk/README.md +297 -0
  179. package/src/sdk/ast-augmentation.ts +157 -0
  180. package/src/sdk/index.ts +126 -0
  181. package/src/sdk/indexes.ts +155 -0
  182. package/src/sdk/loader-node.ts +146 -0
  183. package/src/sdk/loader.ts +99 -0
  184. package/src/sdk/patterns.ts +147 -0
  185. package/src/sdk/query.ts +802 -0
  186. package/src/sdk/resolution.ts +78 -0
  187. package/src/sdk/types.ts +323 -0
  188. package/src/services/dependency-analyzer.ts +321 -0
  189. package/src/services/dependency-resolver.ts +551 -0
  190. package/src/services/git-url-resolver.browser.ts +26 -0
  191. package/src/services/git-url-resolver.ts +517 -0
  192. package/src/services/governance-validator.ts +177 -0
  193. package/src/services/import-resolver.ts +292 -0
  194. package/src/services/performance-optimizer.ts +170 -0
  195. package/src/services/relationship-inference.ts +121 -0
  196. package/src/services/semver.ts +213 -0
  197. package/src/services/types.ts +415 -0
  198. package/src/services/workspace-manager.ts +607 -0
  199. package/src/syntaxes/domain-lang.monarch.ts +29 -0
  200. package/src/utils/import-utils.ts +152 -0
  201. package/src/validation/bounded-context.ts +99 -0
  202. package/src/validation/classification.ts +5 -0
  203. package/src/validation/constants.ts +304 -0
  204. package/src/validation/domain-lang-validator.ts +33 -0
  205. package/src/validation/domain.ts +77 -0
  206. package/src/validation/import.ts +295 -0
  207. package/src/validation/manifest.ts +439 -0
  208. package/src/validation/maps.ts +76 -0
  209. package/src/validation/metadata.ts +18 -0
  210. package/src/validation/model.ts +37 -0
  211. package/src/validation/relationships.ts +154 -0
  212. package/src/validation/shared.ts +14 -0
@@ -0,0 +1,452 @@
1
+ /**
2
+ * Completion provider for DomainLang - context-aware, grammar-aligned.
3
+ *
4
+ * **Design:**
5
+ * - Context-aware: Only suggests what's valid at cursor position
6
+ * - Grammar-aligned: Completions match grammar structure exactly
7
+ * - Simple: Uses parent node to determine context
8
+ * - Maintainable: Clear mapping from grammar to completions
9
+ */
10
+ import { DefaultCompletionProvider } from 'langium/lsp';
11
+ import { CompletionItemKind, InsertTextFormat } from 'vscode-languageserver';
12
+ import * as ast from '../generated/ast.js';
13
+ /**
14
+ * Top-level snippet templates for creating new AST nodes.
15
+ */
16
+ const TOP_LEVEL_SNIPPETS = [
17
+ {
18
+ label: '⚡ Domain (simple)',
19
+ kind: CompletionItemKind.Snippet,
20
+ insertText: 'Domain ${1:Name} {}',
21
+ documentation: '📝 Snippet: Create a simple domain',
22
+ sortText: '0_snippet_domain_simple'
23
+ },
24
+ {
25
+ label: '⚡ Domain (detailed)',
26
+ kind: CompletionItemKind.Snippet,
27
+ insertText: [
28
+ 'Domain ${1:Name} {',
29
+ '\tdescription: "${2:Description}"',
30
+ '\tvision: "${3:Vision}"',
31
+ '\tclassification: ${4:CoreDomain}',
32
+ '}'
33
+ ].join('\n'),
34
+ documentation: '📝 Snippet: Create a domain with description and vision',
35
+ sortText: '0_snippet_domain_detailed'
36
+ },
37
+ {
38
+ label: '⚡ BoundedContext (simple)',
39
+ kind: CompletionItemKind.Snippet,
40
+ insertText: 'bc ${1:Name} for ${2:Domain} as ${3:Core} by ${4:Team}',
41
+ documentation: '📝 Snippet: Quick bounded context definition',
42
+ sortText: '0_snippet_bc_simple'
43
+ },
44
+ {
45
+ label: '⚡ BoundedContext (detailed)',
46
+ kind: CompletionItemKind.Snippet,
47
+ insertText: [
48
+ 'BoundedContext ${1:Name} for ${2:Domain} {',
49
+ '\tdescription: "${3:Description}"',
50
+ '\tteam: ${4:Team}',
51
+ '\trole: ${5:Core}',
52
+ '\t',
53
+ '\tterminology {',
54
+ '\t\tterm ${6:Term}: "${7:Definition}"',
55
+ '\t}',
56
+ '}'
57
+ ].join('\n'),
58
+ documentation: '📝 Snippet: Full bounded context with all common blocks',
59
+ sortText: '0_snippet_bc_detailed'
60
+ },
61
+ {
62
+ label: '⚡ ContextMap',
63
+ kind: CompletionItemKind.Snippet,
64
+ insertText: [
65
+ 'ContextMap ${1:Name} {',
66
+ '\tcontains ${2:Context1}, ${3:Context2}',
67
+ '}'
68
+ ].join('\n'),
69
+ documentation: '📝 Snippet: Create a context map',
70
+ sortText: '0_snippet_contextmap'
71
+ },
72
+ {
73
+ label: '⚡ DomainMap',
74
+ kind: CompletionItemKind.Snippet,
75
+ insertText: [
76
+ 'DomainMap ${1:Name} {',
77
+ '\tcontains ${2:Domain1}, ${3:Domain2}',
78
+ '}'
79
+ ].join('\n'),
80
+ documentation: '📝 Snippet: Create a domain map',
81
+ sortText: '0_snippet_domainmap'
82
+ },
83
+ {
84
+ label: '⚡ Team',
85
+ kind: CompletionItemKind.Snippet,
86
+ insertText: 'Team ${1:TeamName}',
87
+ documentation: '📝 Snippet: Define a team',
88
+ sortText: '0_snippet_team'
89
+ },
90
+ {
91
+ label: '⚡ Classification',
92
+ kind: CompletionItemKind.Snippet,
93
+ insertText: 'Classification ${1:Name}',
94
+ documentation: '📝 Snippet: Define a reusable classification label',
95
+ sortText: '0_snippet_classification'
96
+ },
97
+ {
98
+ label: '⚡ Metadata',
99
+ kind: CompletionItemKind.Snippet,
100
+ insertText: 'Metadata ${1:KeyName}',
101
+ documentation: '📝 Snippet: Define a metadata key',
102
+ sortText: '0_snippet_metadata'
103
+ },
104
+ {
105
+ label: '⚡ Namespace',
106
+ kind: CompletionItemKind.Snippet,
107
+ insertText: [
108
+ 'Namespace ${1:name.space} {',
109
+ '\t$0',
110
+ '}'
111
+ ].join('\n'),
112
+ documentation: '📝 Snippet: Create a hierarchical namespace',
113
+ sortText: '0_snippet_namespace'
114
+ }
115
+ ];
116
+ export class DomainLangCompletionProvider extends DefaultCompletionProvider {
117
+ completionFor(context, next, acceptor) {
118
+ const node = context.node;
119
+ if (!node) {
120
+ super.completionFor(context, next, acceptor);
121
+ return;
122
+ }
123
+ // Strategy: Check node type and container to determine what's allowed at cursor position
124
+ // Check if cursor is after the node (for top-level positioning)
125
+ const offset = context.offset;
126
+ const nodeEnd = node.$cstNode?.end ?? 0;
127
+ const isAfterNode = offset >= nodeEnd;
128
+ // If we're positioned after a BC/Domain (e.g., on next line): show top-level
129
+ if ((ast.isBoundedContext(node) || ast.isDomain(node)) && isAfterNode) {
130
+ this.addTopLevelSnippets(acceptor, context);
131
+ // Let Langium provide keywords like "bc", "Domain", etc.
132
+ super.completionFor(context, next, acceptor);
133
+ return;
134
+ }
135
+ // If we're AT a BoundedContext node: only BC documentation blocks
136
+ if (ast.isBoundedContext(node)) {
137
+ this.addBoundedContextCompletions(node, acceptor, context);
138
+ super.completionFor(context, next, acceptor);
139
+ return;
140
+ }
141
+ // If we're AT a Domain node: only Domain documentation blocks
142
+ if (ast.isDomain(node)) {
143
+ this.addDomainCompletions(node, acceptor, context);
144
+ super.completionFor(context, next, acceptor);
145
+ return;
146
+ }
147
+ // If we're AT a ContextMap node: relationships and contains
148
+ if (ast.isContextMap(node)) {
149
+ this.addContextMapCompletions(node, acceptor, context);
150
+ super.completionFor(context, next, acceptor);
151
+ return;
152
+ }
153
+ // If we're AT a DomainMap node: contains
154
+ if (ast.isDomainMap(node)) {
155
+ this.addDomainMapCompletions(node, acceptor, context);
156
+ super.completionFor(context, next, acceptor);
157
+ return;
158
+ }
159
+ // If we're AT the Model or NamespaceDeclaration level: all top-level constructs
160
+ if (ast.isModel(node) || ast.isNamespaceDeclaration(node)) {
161
+ this.addTopLevelSnippets(acceptor, context);
162
+ super.completionFor(context, next, acceptor);
163
+ return;
164
+ }
165
+ const container = node.$container;
166
+ // Inside BoundedContext body: suggest missing scalar properties and collections
167
+ if (ast.isBoundedContext(container)) {
168
+ this.addBoundedContextCompletions(container, acceptor, context);
169
+ super.completionFor(context, next, acceptor);
170
+ return;
171
+ }
172
+ // Inside Domain body: suggest missing scalar properties
173
+ if (ast.isDomain(container)) {
174
+ this.addDomainCompletions(container, acceptor, context);
175
+ super.completionFor(context, next, acceptor);
176
+ return;
177
+ }
178
+ // Inside ContextMap body: relationships and contains
179
+ if (ast.isContextMap(container)) {
180
+ this.addContextMapCompletions(container, acceptor, context);
181
+ super.completionFor(context, next, acceptor);
182
+ return;
183
+ }
184
+ // Inside DomainMap body: contains
185
+ if (ast.isDomainMap(container)) {
186
+ this.addDomainMapCompletions(container, acceptor, context);
187
+ super.completionFor(context, next, acceptor);
188
+ return;
189
+ }
190
+ if (ast.isRelationship(node) || ast.isRelationship(container)) {
191
+ this.addRelationshipCompletions(acceptor, context);
192
+ super.completionFor(context, next, acceptor);
193
+ return;
194
+ }
195
+ // Top level container (Model or NamespaceDeclaration): all top-level constructs
196
+ if (ast.isModel(container) || ast.isNamespaceDeclaration(container)) {
197
+ this.addTopLevelSnippets(acceptor, context);
198
+ }
199
+ // Let Langium handle default completions
200
+ super.completionFor(context, next, acceptor);
201
+ }
202
+ addTopLevelSnippets(acceptor, context) {
203
+ for (const snippet of TOP_LEVEL_SNIPPETS) {
204
+ acceptor(context, {
205
+ label: snippet.label,
206
+ kind: snippet.kind,
207
+ insertText: snippet.insertText,
208
+ insertTextFormat: InsertTextFormat.Snippet,
209
+ documentation: snippet.documentation,
210
+ sortText: snippet.sortText
211
+ });
212
+ }
213
+ }
214
+ /**
215
+ * Add property/collection completions for BoundedContext.
216
+ */
217
+ addBoundedContextCompletions(node, acceptor, context) {
218
+ if (!node.description) {
219
+ acceptor(context, {
220
+ label: '⚡ description',
221
+ kind: CompletionItemKind.Snippet,
222
+ insertText: 'description: "${1:Description}"',
223
+ insertTextFormat: InsertTextFormat.Snippet,
224
+ documentation: '📝 Snippet: Describe the bounded context\'s responsibility',
225
+ sortText: '0_snippet_description'
226
+ });
227
+ }
228
+ if (node.team.length === 0) {
229
+ acceptor(context, {
230
+ label: '⚡ team',
231
+ kind: CompletionItemKind.Snippet,
232
+ insertText: 'team: ${1:TeamName}',
233
+ insertTextFormat: InsertTextFormat.Snippet,
234
+ documentation: '📝 Snippet: Assign the responsible team',
235
+ sortText: '0_snippet_team'
236
+ });
237
+ }
238
+ if (node.classification.length === 0) {
239
+ acceptor(context, {
240
+ label: '⚡ classification',
241
+ kind: CompletionItemKind.Snippet,
242
+ insertText: 'classification: ${1:Core}',
243
+ insertTextFormat: InsertTextFormat.Snippet,
244
+ documentation: '📝 Snippet: Assign the strategic classification (Core, Supporting, Generic)',
245
+ sortText: '0_snippet_classification'
246
+ });
247
+ }
248
+ if (!node.businessModel) {
249
+ acceptor(context, {
250
+ label: '⚡ businessModel',
251
+ kind: CompletionItemKind.Snippet,
252
+ insertText: 'businessModel: ${1:Commercial}',
253
+ insertTextFormat: InsertTextFormat.Snippet,
254
+ documentation: '📝 Snippet: Classify the business model',
255
+ sortText: '0_snippet_businessModel'
256
+ });
257
+ }
258
+ if (!node.evolution) {
259
+ acceptor(context, {
260
+ label: '⚡ evolution',
261
+ kind: CompletionItemKind.Snippet,
262
+ insertText: 'evolution: ${1:Product}',
263
+ insertTextFormat: InsertTextFormat.Snippet,
264
+ documentation: '📝 Snippet: Define the evolution stage (Genesis, Custom, Product, Commodity)',
265
+ sortText: '0_snippet_evolution'
266
+ });
267
+ }
268
+ if (node.terminology.length === 0) {
269
+ acceptor(context, {
270
+ label: '⚡ terminology',
271
+ kind: CompletionItemKind.Snippet,
272
+ insertText: [
273
+ 'terminology {',
274
+ '\tterm ${1:Term}: "${2:Definition}"',
275
+ '}'
276
+ ].join('\n'),
277
+ insertTextFormat: InsertTextFormat.Snippet,
278
+ documentation: '📝 Snippet: Define ubiquitous language terms',
279
+ sortText: '0_snippet_terminology'
280
+ });
281
+ }
282
+ if (node.decisions.length === 0) {
283
+ acceptor(context, {
284
+ label: '⚡ decisions',
285
+ kind: CompletionItemKind.Snippet,
286
+ insertText: [
287
+ 'decisions {',
288
+ '\tdecision [${1|technical,business|}] ${2:DecisionName}: "${3:Rationale}"',
289
+ '}'
290
+ ].join('\n'),
291
+ insertTextFormat: InsertTextFormat.Snippet,
292
+ documentation: '📝 Snippet: Document architectural decisions',
293
+ sortText: '0_snippet_decisions'
294
+ });
295
+ }
296
+ if (node.relationships.length === 0) {
297
+ acceptor(context, {
298
+ label: '⚡ relationships',
299
+ kind: CompletionItemKind.Snippet,
300
+ insertText: [
301
+ 'relationships {',
302
+ '\t${1:Context1} -> ${2:Context2}',
303
+ '}'
304
+ ].join('\n'),
305
+ insertTextFormat: InsertTextFormat.Snippet,
306
+ documentation: '📝 Snippet: Define relationships with other bounded contexts',
307
+ sortText: '0_snippet_relationships'
308
+ });
309
+ }
310
+ if (node.metadata.length === 0) {
311
+ acceptor(context, {
312
+ label: '⚡ metadata',
313
+ kind: CompletionItemKind.Snippet,
314
+ insertText: [
315
+ 'metadata {',
316
+ '\t${1:Language}: "${2:TypeScript}"',
317
+ '}'
318
+ ].join('\n'),
319
+ insertTextFormat: InsertTextFormat.Snippet,
320
+ documentation: '📝 Snippet: Add metadata key-value pairs',
321
+ sortText: '0_snippet_metadata'
322
+ });
323
+ }
324
+ }
325
+ /**
326
+ * Add property completions for Domain.
327
+ */
328
+ addDomainCompletions(node, acceptor, context) {
329
+ if (!node.description) {
330
+ acceptor(context, {
331
+ label: '⚡ description',
332
+ kind: CompletionItemKind.Snippet,
333
+ insertText: 'description: "${1:Description}"',
334
+ insertTextFormat: InsertTextFormat.Snippet,
335
+ documentation: '📝 Snippet: Describe what this domain encompasses',
336
+ sortText: '0_snippet_description'
337
+ });
338
+ }
339
+ if (!node.vision) {
340
+ acceptor(context, {
341
+ label: '⚡ vision',
342
+ kind: CompletionItemKind.Snippet,
343
+ insertText: 'vision: "${1:Vision statement}"',
344
+ insertTextFormat: InsertTextFormat.Snippet,
345
+ documentation: '📝 Snippet: Define the strategic vision for this domain',
346
+ sortText: '0_snippet_vision'
347
+ });
348
+ }
349
+ if (!node.type) {
350
+ acceptor(context, {
351
+ label: '⚡ type',
352
+ kind: CompletionItemKind.Snippet,
353
+ insertText: 'type: ${1:Core}',
354
+ insertTextFormat: InsertTextFormat.Snippet,
355
+ documentation: '📝 Snippet: Classify as Core, Supporting, or Generic domain type',
356
+ sortText: '0_snippet_type'
357
+ });
358
+ }
359
+ }
360
+ /**
361
+ * Add completions for ContextMap.
362
+ * Suggests relationship patterns and context references.
363
+ */
364
+ addContextMapCompletions(node, acceptor, context) {
365
+ // Suggest contains if no contexts yet
366
+ if (node.boundedContexts.length === 0) {
367
+ acceptor(context, {
368
+ label: 'contains',
369
+ kind: CompletionItemKind.Keyword,
370
+ insertText: 'contains ${1:Context1}, ${2:Context2}',
371
+ insertTextFormat: InsertTextFormat.Snippet,
372
+ documentation: 'Add bounded contexts to this map',
373
+ sortText: '0_contains'
374
+ });
375
+ }
376
+ // Always suggest relationship snippet
377
+ acceptor(context, {
378
+ label: 'relationship (simple)',
379
+ kind: CompletionItemKind.Snippet,
380
+ insertText: '${1:Context1} -> ${2:Context2}',
381
+ insertTextFormat: InsertTextFormat.Snippet,
382
+ documentation: 'Add a simple upstream-downstream relationship',
383
+ sortText: '1_relationship_simple'
384
+ });
385
+ acceptor(context, {
386
+ label: 'relationship (with patterns)',
387
+ kind: CompletionItemKind.Snippet,
388
+ insertText: '[${1|OHS,PL,ACL,CF,P,SK|}] ${2:Context1} -> [${3|OHS,PL,ACL,CF,P,SK|}] ${4:Context2}',
389
+ insertTextFormat: InsertTextFormat.Snippet,
390
+ documentation: 'Add a relationship with integration patterns',
391
+ sortText: '1_relationship_patterns'
392
+ });
393
+ }
394
+ /**
395
+ * Add completions for DomainMap.
396
+ * Suggests domain references.
397
+ */
398
+ addDomainMapCompletions(node, acceptor, context) {
399
+ // Suggest contains if no domains yet
400
+ if (node.domains.length === 0) {
401
+ acceptor(context, {
402
+ label: 'contains',
403
+ kind: CompletionItemKind.Keyword,
404
+ insertText: 'contains ${1:Domain1}, ${2:Domain2}',
405
+ insertTextFormat: InsertTextFormat.Snippet,
406
+ documentation: 'Add domains to this map',
407
+ sortText: '0_contains'
408
+ });
409
+ }
410
+ }
411
+ /**
412
+ * Add completions for relationships.
413
+ * Provides integration patterns and relationship types.
414
+ */
415
+ addRelationshipCompletions(acceptor, context) {
416
+ // Integration pattern completions
417
+ const patterns = [
418
+ { label: 'OHS (Open Host Service)', insertText: '[OHS]', doc: 'Open Host Service pattern' },
419
+ { label: 'PL (Published Language)', insertText: '[PL]', doc: 'Published Language pattern' },
420
+ { label: 'ACL (Anti-Corruption Layer)', insertText: '[ACL]', doc: 'Anti-Corruption Layer pattern' },
421
+ { label: 'CF (Conformist)', insertText: '[CF]', doc: 'Conformist pattern' },
422
+ { label: 'P (Partnership)', insertText: '[P]', doc: 'Partnership pattern' },
423
+ { label: 'SK (Shared Kernel)', insertText: '[SK]', doc: 'Shared Kernel pattern' }
424
+ ];
425
+ for (const pattern of patterns) {
426
+ acceptor(context, {
427
+ label: pattern.label,
428
+ kind: CompletionItemKind.EnumMember,
429
+ insertText: pattern.insertText,
430
+ documentation: pattern.doc,
431
+ sortText: `0_${pattern.label}`
432
+ });
433
+ }
434
+ // Relationship arrow completions
435
+ const arrows = [
436
+ { label: '->', doc: 'Upstream to downstream' },
437
+ { label: '<-', doc: 'Downstream to upstream' },
438
+ { label: '<->', doc: 'Bidirectional/Partnership' },
439
+ { label: '><', doc: 'Separate Ways' }
440
+ ];
441
+ for (const arrow of arrows) {
442
+ acceptor(context, {
443
+ label: arrow.label,
444
+ kind: CompletionItemKind.Operator,
445
+ insertText: arrow.label,
446
+ documentation: arrow.doc,
447
+ sortText: `1_${arrow.label}`
448
+ });
449
+ }
450
+ }
451
+ }
452
+ //# sourceMappingURL=domain-lang-completion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-lang-completion.js","sourceRoot":"","sources":["../../src/lsp/domain-lang-completion.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAyC,yBAAyB,EAAe,MAAM,aAAa,CAAC;AAC5G,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAE3C;;GAEG;AACH,MAAM,kBAAkB,GAAG;IACvB;QACI,KAAK,EAAE,mBAAmB;QAC1B,IAAI,EAAE,kBAAkB,CAAC,OAAO;QAChC,UAAU,EAAE,qBAAqB;QACjC,aAAa,EAAE,oCAAoC;QACnD,QAAQ,EAAE,yBAAyB;KACtC;IACD;QACI,KAAK,EAAE,qBAAqB;QAC5B,IAAI,EAAE,kBAAkB,CAAC,OAAO;QAChC,UAAU,EAAE;YACR,oBAAoB;YACpB,mCAAmC;YACnC,yBAAyB;YACzB,mCAAmC;YACnC,GAAG;SACN,CAAC,IAAI,CAAC,IAAI,CAAC;QACZ,aAAa,EAAE,yDAAyD;QACxE,QAAQ,EAAE,2BAA2B;KACxC;IACD;QACI,KAAK,EAAE,2BAA2B;QAClC,IAAI,EAAE,kBAAkB,CAAC,OAAO;QAChC,UAAU,EAAE,wDAAwD;QACpE,aAAa,EAAE,8CAA8C;QAC7D,QAAQ,EAAE,qBAAqB;KAClC;IACD;QACI,KAAK,EAAE,6BAA6B;QACpC,IAAI,EAAE,kBAAkB,CAAC,OAAO;QAChC,UAAU,EAAE;YACR,4CAA4C;YAC5C,mCAAmC;YACnC,mBAAmB;YACnB,mBAAmB;YACnB,IAAI;YACJ,iBAAiB;YACjB,uCAAuC;YACvC,KAAK;YACL,GAAG;SACN,CAAC,IAAI,CAAC,IAAI,CAAC;QACZ,aAAa,EAAE,yDAAyD;QACxE,QAAQ,EAAE,uBAAuB;KACpC;IACD;QACI,KAAK,EAAE,cAA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for DomainLang documents.
5
+ * Handles indentation and newlines for block-based constructs.
6
+ */
7
+ export declare class DomainLangFormatter extends AbstractFormatter {
8
+ protected format(node: AstNode): void;
9
+ /**
10
+ * Formats a block node with standard indentation and newlines.
11
+ *
12
+ * @param node - The AST node to format
13
+ */
14
+ private formatBlock;
15
+ }
@@ -0,0 +1,43 @@
1
+ import { AbstractFormatter, Formatting } from "langium/lsp";
2
+ import * as ast from '../generated/ast.js';
3
+ /**
4
+ * Provides formatting for DomainLang documents.
5
+ * Handles indentation and newlines for block-based constructs.
6
+ */
7
+ export class DomainLangFormatter extends AbstractFormatter {
8
+ format(node) {
9
+ // Namespace declarations
10
+ if (ast.isNamespaceDeclaration(node)) {
11
+ this.formatBlock(node);
12
+ }
13
+ // Domain declarations
14
+ if (ast.isDomain(node)) {
15
+ this.formatBlock(node);
16
+ }
17
+ // Bounded contexts
18
+ if (ast.isBoundedContext(node)) {
19
+ this.formatBlock(node);
20
+ }
21
+ // Context maps
22
+ if (ast.isContextMap(node)) {
23
+ this.formatBlock(node);
24
+ }
25
+ // Domain maps
26
+ if (ast.isDomainMap(node)) {
27
+ this.formatBlock(node);
28
+ }
29
+ }
30
+ /**
31
+ * Formats a block node with standard indentation and newlines.
32
+ *
33
+ * @param node - The AST node to format
34
+ */
35
+ formatBlock(node) {
36
+ const formatter = this.getNodeFormatter(node);
37
+ const open = formatter.keyword('{');
38
+ const close = formatter.keyword('}');
39
+ formatter.interior(open, close).prepend(Formatting.indent());
40
+ close.prepend(Formatting.newLine());
41
+ }
42
+ }
43
+ //# sourceMappingURL=domain-lang-formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-lang-formatter.js","sourceRoot":"","sources":["../../src/lsp/domain-lang-formatter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAE3C;;;GAGG;AACH,MAAM,OAAO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ox 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,CAA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