@likec4/language-server 1.43.0 → 1.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (301) hide show
  1. package/browser/package.json +1 -1
  2. package/browser-worker/package.json +1 -1
  3. package/dist/LikeC4LanguageServices.d.ts +13 -34
  4. package/dist/LikeC4LanguageServices.js +152 -0
  5. package/dist/Rpc.js +257 -0
  6. package/dist/ast.d.ts +5 -1
  7. package/dist/ast.js +257 -0
  8. package/dist/browser-worker.js +4 -0
  9. package/dist/browser.js +35 -0
  10. package/dist/bundled.js +44 -0
  11. package/dist/bundled.mjs +3568 -3900
  12. package/dist/documentation/documentation-provider.js +51 -0
  13. package/dist/documentation/index.js +1 -0
  14. package/dist/empty.js +2 -0
  15. package/dist/filesystem/ChokidarWatcher.d.ts +2 -0
  16. package/dist/filesystem/ChokidarWatcher.js +108 -0
  17. package/dist/filesystem/FileSystemWatcher.js +14 -0
  18. package/dist/filesystem/LikeC4FileSystem.d.ts +1 -2
  19. package/dist/filesystem/LikeC4FileSystem.js +126 -0
  20. package/dist/filesystem/index.d.ts +26 -0
  21. package/dist/filesystem/index.js +29 -0
  22. package/dist/formatting/LikeC4Formatter.js +637 -0
  23. package/dist/formatting/utils.js +18 -0
  24. package/dist/generated/ast.js +2155 -0
  25. package/dist/generated/{grammar.mjs → grammar.js} +6 -2
  26. package/dist/generated/module.d.ts +6 -1
  27. package/dist/generated/module.js +27 -0
  28. package/dist/generated-lib/{icons.mjs → icons.js} +11 -7
  29. package/dist/index.d.ts +10 -1
  30. package/dist/index.js +55 -0
  31. package/dist/{likec4lib.mjs → likec4lib.js} +3 -3
  32. package/dist/logger.js +81 -0
  33. package/dist/lsp/CodeActionProvider.d.ts +14 -0
  34. package/dist/lsp/CodeActionProvider.js +33 -0
  35. package/dist/lsp/CodeLensProvider.js +44 -0
  36. package/dist/lsp/CompletionProvider.d.ts +3 -1
  37. package/dist/lsp/CompletionProvider.js +200 -0
  38. package/dist/lsp/DocumentHighlightProvider.js +10 -0
  39. package/dist/lsp/DocumentLinkProvider.js +58 -0
  40. package/dist/lsp/DocumentSymbolProvider.js +306 -0
  41. package/dist/lsp/HoverProvider.js +106 -0
  42. package/dist/lsp/RenameProvider.js +6 -0
  43. package/dist/lsp/SemanticTokenProvider.js +257 -0
  44. package/dist/lsp/index.d.ts +1 -0
  45. package/dist/lsp/index.js +9 -0
  46. package/dist/mcp/MCPServerFactory.js +73 -0
  47. package/dist/mcp/NoopLikeC4MCPServer.js +17 -0
  48. package/dist/mcp/interfaces.js +5 -0
  49. package/dist/mcp/server/StdioLikeC4MCPServer.js +51 -0
  50. package/dist/mcp/server/StreamableLikeC4MCPServer.js +145 -0
  51. package/dist/mcp/server/WithMCPServer.js +56 -0
  52. package/dist/mcp/tools/_common.d.ts +8 -7
  53. package/dist/mcp/tools/_common.js +49 -0
  54. package/dist/mcp/tools/find-relationships.d.ts +7 -8
  55. package/dist/mcp/tools/find-relationships.js +150 -0
  56. package/dist/mcp/tools/list-projects.d.ts +3 -3
  57. package/dist/mcp/tools/list-projects.js +62 -0
  58. package/dist/mcp/tools/open-view.d.ts +6 -7
  59. package/dist/mcp/tools/open-view.js +52 -0
  60. package/dist/mcp/tools/read-deployment.d.ts +6 -7
  61. package/dist/mcp/tools/read-deployment.js +132 -0
  62. package/dist/mcp/tools/read-element.d.ts +6 -7
  63. package/dist/mcp/tools/read-element.js +194 -0
  64. package/dist/mcp/tools/read-project-summary.d.ts +5 -6
  65. package/dist/mcp/tools/read-project-summary.js +176 -0
  66. package/dist/mcp/tools/read-view.d.ts +6 -7
  67. package/dist/mcp/tools/read-view.js +203 -0
  68. package/dist/mcp/tools/search-element.d.ts +3 -3
  69. package/dist/mcp/tools/search-element.js +177 -0
  70. package/dist/mcp/utils.d.ts +2 -2
  71. package/dist/mcp/utils.js +48 -0
  72. package/dist/model/builder/MergedExtends.js +74 -0
  73. package/dist/model/builder/MergedSpecification.js +175 -0
  74. package/dist/model/builder/buildModel.js +176 -0
  75. package/dist/model/deployments-index.js +102 -0
  76. package/dist/model/fqn-index.d.ts +1 -2
  77. package/dist/model/fqn-index.js +247 -0
  78. package/dist/model/index.js +6 -0
  79. package/dist/model/model-builder.d.ts +13 -11
  80. package/dist/model/model-builder.js +232 -0
  81. package/dist/model/model-locator.d.ts +6 -5
  82. package/dist/model/model-locator.js +240 -0
  83. package/dist/model/model-parser-where.js +81 -0
  84. package/dist/model/model-parser.d.ts +309 -304
  85. package/dist/model/model-parser.js +126 -0
  86. package/dist/model/parser/Base.d.ts +2 -2
  87. package/dist/model/parser/Base.js +367 -0
  88. package/dist/model/parser/DeploymentModelParser.d.ts +2 -2
  89. package/dist/model/parser/DeploymentModelParser.js +176 -0
  90. package/dist/model/parser/DeploymentViewParser.d.ts +3 -3
  91. package/dist/model/parser/DeploymentViewParser.js +86 -0
  92. package/dist/model/parser/FqnRefParser.d.ts +2 -2
  93. package/dist/model/parser/FqnRefParser.js +382 -0
  94. package/dist/model/parser/GlobalsParser.d.ts +6 -6
  95. package/dist/model/parser/GlobalsParser.js +84 -0
  96. package/dist/model/parser/ImportsParser.d.ts +11 -12
  97. package/dist/model/parser/ImportsParser.js +24 -0
  98. package/dist/model/parser/ModelParser.d.ts +2 -2
  99. package/dist/model/parser/ModelParser.js +165 -0
  100. package/dist/model/parser/PredicatesParser.d.ts +2 -2
  101. package/dist/model/parser/PredicatesParser.js +45 -0
  102. package/dist/model/parser/SpecificationParser.d.ts +2 -2
  103. package/dist/model/parser/SpecificationParser.js +113 -0
  104. package/dist/model/parser/ValueConverter.js +12 -0
  105. package/dist/model/parser/ViewsParser.d.ts +3 -3
  106. package/dist/model/parser/ViewsParser.js +479 -0
  107. package/dist/model-change/ModelChanges.d.ts +8 -5
  108. package/dist/model-change/ModelChanges.js +129 -0
  109. package/dist/model-change/changeElementStyle.js +134 -0
  110. package/dist/model-change/changeViewLayout.d.ts +2 -2
  111. package/dist/model-change/changeViewLayout.js +28 -0
  112. package/dist/model-change/removeManualLayoutV1.d.ts +7 -0
  113. package/dist/model-change/removeManualLayoutV1.js +27 -0
  114. package/dist/module.d.ts +10 -5
  115. package/dist/module.js +143 -0
  116. package/dist/protocol.d.ts +34 -27
  117. package/dist/protocol.js +123 -0
  118. package/dist/references/index.js +3 -0
  119. package/dist/references/name-provider.js +37 -0
  120. package/dist/references/scope-computation.js +288 -0
  121. package/dist/references/scope-provider.d.ts +3 -3
  122. package/dist/references/scope-provider.js +242 -0
  123. package/dist/shared/NodeKindProvider.js +57 -0
  124. package/dist/shared/{WorkspaceSymbolProvider.mjs → WorkspaceSymbolProvider.js} +1 -1
  125. package/dist/shared/index.js +2 -0
  126. package/dist/test/index.js +1 -0
  127. package/dist/test/testServices.d.ts +16 -16
  128. package/dist/test/testServices.js +210 -0
  129. package/dist/utils/disposable.js +26 -0
  130. package/dist/utils/elementRef.d.ts +1 -1
  131. package/dist/utils/elementRef.js +27 -0
  132. package/dist/utils/fqnRef.js +63 -0
  133. package/dist/utils/index.js +35 -0
  134. package/dist/utils/printDocs.js +1 -0
  135. package/dist/utils/projectId.js +16 -0
  136. package/dist/utils/stringHash.js +5 -0
  137. package/dist/validation/DocumentValidator.js +17 -0
  138. package/dist/validation/_shared.js +26 -0
  139. package/dist/validation/deployment-checks.js +140 -0
  140. package/dist/validation/dynamic-view.js +67 -0
  141. package/dist/validation/element-ref.js +12 -0
  142. package/dist/validation/element.js +49 -0
  143. package/dist/validation/imports.js +46 -0
  144. package/dist/validation/index.d.ts +1 -1
  145. package/dist/validation/index.js +157 -0
  146. package/dist/validation/property-checks.js +108 -0
  147. package/dist/validation/relation.js +55 -0
  148. package/dist/validation/specification.js +190 -0
  149. package/dist/validation/view-predicates/fqn-expr-with.js +43 -0
  150. package/dist/validation/view-predicates/fqn-ref-expr.js +51 -0
  151. package/dist/validation/view-predicates/incoming.js +16 -0
  152. package/dist/validation/view-predicates/index.js +6 -0
  153. package/dist/validation/view-predicates/outgoing.js +20 -0
  154. package/dist/validation/view-predicates/relation-expr.js +46 -0
  155. package/dist/validation/view-predicates/relation-with.js +16 -0
  156. package/dist/validation/view.d.ts +1 -1
  157. package/dist/validation/view.js +42 -0
  158. package/dist/view-utils/assignNavigateTo.js +27 -0
  159. package/dist/view-utils/index.d.ts +1 -0
  160. package/dist/view-utils/index.js +2 -0
  161. package/dist/view-utils/manual-layout.d.ts +6 -0
  162. package/dist/view-utils/manual-layout.js +149 -0
  163. package/dist/views/ConfigurableLayouter.js +51 -0
  164. package/dist/views/LikeC4ManualLayouts.d.ts +42 -0
  165. package/dist/views/LikeC4ManualLayouts.js +209 -0
  166. package/dist/views/{likec4-views.d.ts → LikeC4Views.d.ts} +32 -10
  167. package/dist/views/LikeC4Views.js +216 -0
  168. package/dist/views/index.d.ts +4 -1
  169. package/dist/views/index.js +11 -0
  170. package/dist/workspace/AstNodeDescriptionProvider.js +18 -0
  171. package/dist/workspace/IndexManager.js +21 -0
  172. package/dist/workspace/LangiumDocuments.d.ts +4 -3
  173. package/dist/workspace/LangiumDocuments.js +72 -0
  174. package/dist/workspace/ProjectsManager.d.ts +25 -16
  175. package/dist/workspace/ProjectsManager.js +469 -0
  176. package/dist/workspace/WorkspaceManager.d.ts +3 -2
  177. package/dist/workspace/WorkspaceManager.js +98 -0
  178. package/dist/workspace/index.js +5 -0
  179. package/likec4lib/package.json +1 -1
  180. package/package.json +30 -28
  181. package/protocol/package.json +1 -1
  182. package/dist/LikeC4LanguageServices.mjs +0 -197
  183. package/dist/Rpc.mjs +0 -296
  184. package/dist/ast.mjs +0 -221
  185. package/dist/browser-worker.mjs +0 -2
  186. package/dist/browser.mjs +0 -32
  187. package/dist/documentation/documentation-provider.mjs +0 -48
  188. package/dist/documentation/index.mjs +0 -1
  189. package/dist/empty.mjs +0 -1
  190. package/dist/filesystem/ChokidarWatcher.mjs +0 -68
  191. package/dist/filesystem/FileSystemWatcher.mjs +0 -11
  192. package/dist/filesystem/LikeC4FileSystem.mjs +0 -64
  193. package/dist/filesystem/index.mjs +0 -19
  194. package/dist/formatting/LikeC4Formatter.mjs +0 -511
  195. package/dist/formatting/utils.mjs +0 -15
  196. package/dist/generated/ast.mjs +0 -2150
  197. package/dist/generated/module.mjs +0 -23
  198. package/dist/index.mjs +0 -50
  199. package/dist/logger.mjs +0 -82
  200. package/dist/lsp/CodeLensProvider.mjs +0 -42
  201. package/dist/lsp/CompletionProvider.mjs +0 -208
  202. package/dist/lsp/DocumentHighlightProvider.mjs +0 -10
  203. package/dist/lsp/DocumentLinkProvider.mjs +0 -53
  204. package/dist/lsp/DocumentSymbolProvider.mjs +0 -287
  205. package/dist/lsp/HoverProvider.mjs +0 -104
  206. package/dist/lsp/RenameProvider.mjs +0 -6
  207. package/dist/lsp/SemanticTokenProvider.mjs +0 -276
  208. package/dist/lsp/index.mjs +0 -7
  209. package/dist/mcp/MCPServerFactory.mjs +0 -70
  210. package/dist/mcp/NoopLikeC4MCPServer.mjs +0 -17
  211. package/dist/mcp/interfaces.mjs +0 -4
  212. package/dist/mcp/server/StdioLikeC4MCPServer.mjs +0 -46
  213. package/dist/mcp/server/StreamableLikeC4MCPServer.mjs +0 -153
  214. package/dist/mcp/server/WithMCPServer.mjs +0 -58
  215. package/dist/mcp/tools/_common.mjs +0 -42
  216. package/dist/mcp/tools/find-relationships.mjs +0 -151
  217. package/dist/mcp/tools/list-projects.mjs +0 -62
  218. package/dist/mcp/tools/open-view.mjs +0 -52
  219. package/dist/mcp/tools/read-deployment.mjs +0 -130
  220. package/dist/mcp/tools/read-element.mjs +0 -198
  221. package/dist/mcp/tools/read-project-summary.mjs +0 -178
  222. package/dist/mcp/tools/read-view.mjs +0 -205
  223. package/dist/mcp/tools/search-element.mjs +0 -171
  224. package/dist/mcp/utils.mjs +0 -47
  225. package/dist/model/builder/MergedExtends.mjs +0 -76
  226. package/dist/model/builder/MergedSpecification.mjs +0 -205
  227. package/dist/model/builder/assignTagColors.d.ts +0 -7
  228. package/dist/model/builder/assignTagColors.mjs +0 -51
  229. package/dist/model/builder/buildModel.mjs +0 -226
  230. package/dist/model/deployments-index.mjs +0 -100
  231. package/dist/model/fqn-index.mjs +0 -243
  232. package/dist/model/index.mjs +0 -6
  233. package/dist/model/model-builder.mjs +0 -285
  234. package/dist/model/model-locator.mjs +0 -239
  235. package/dist/model/model-parser-where.mjs +0 -81
  236. package/dist/model/model-parser.mjs +0 -127
  237. package/dist/model/parser/Base.mjs +0 -376
  238. package/dist/model/parser/DeploymentModelParser.mjs +0 -212
  239. package/dist/model/parser/DeploymentViewParser.mjs +0 -95
  240. package/dist/model/parser/FqnRefParser.mjs +0 -398
  241. package/dist/model/parser/GlobalsParser.mjs +0 -82
  242. package/dist/model/parser/ImportsParser.mjs +0 -28
  243. package/dist/model/parser/ModelParser.mjs +0 -190
  244. package/dist/model/parser/PredicatesParser.mjs +0 -45
  245. package/dist/model/parser/SpecificationParser.mjs +0 -120
  246. package/dist/model/parser/ValueConverter.mjs +0 -12
  247. package/dist/model/parser/ViewsParser.mjs +0 -490
  248. package/dist/model-change/ModelChanges.mjs +0 -89
  249. package/dist/model-change/changeElementStyle.mjs +0 -143
  250. package/dist/model-change/changeViewLayout.mjs +0 -32
  251. package/dist/model-change/saveManualLayout.d.ts +0 -11
  252. package/dist/model-change/saveManualLayout.mjs +0 -27
  253. package/dist/module.mjs +0 -180
  254. package/dist/protocol.mjs +0 -65
  255. package/dist/references/index.mjs +0 -3
  256. package/dist/references/name-provider.mjs +0 -39
  257. package/dist/references/scope-computation.mjs +0 -312
  258. package/dist/references/scope-provider.mjs +0 -239
  259. package/dist/shared/NodeKindProvider.mjs +0 -110
  260. package/dist/shared/index.mjs +0 -2
  261. package/dist/test/index.mjs +0 -1
  262. package/dist/test/testServices.mjs +0 -200
  263. package/dist/utils/disposable.mjs +0 -25
  264. package/dist/utils/elementRef.mjs +0 -20
  265. package/dist/utils/fqnRef.mjs +0 -57
  266. package/dist/utils/index.mjs +0 -33
  267. package/dist/utils/printDocs.mjs +0 -1
  268. package/dist/utils/projectId.mjs +0 -16
  269. package/dist/utils/stringHash.mjs +0 -5
  270. package/dist/validation/DocumentValidator.mjs +0 -16
  271. package/dist/validation/_shared.mjs +0 -25
  272. package/dist/validation/deployment-checks.mjs +0 -146
  273. package/dist/validation/dynamic-view.mjs +0 -67
  274. package/dist/validation/element-ref.mjs +0 -12
  275. package/dist/validation/element.mjs +0 -50
  276. package/dist/validation/imports.mjs +0 -25
  277. package/dist/validation/index.mjs +0 -180
  278. package/dist/validation/property-checks.mjs +0 -107
  279. package/dist/validation/relation.mjs +0 -53
  280. package/dist/validation/specification.mjs +0 -173
  281. package/dist/validation/view-predicates/fqn-expr-with.mjs +0 -43
  282. package/dist/validation/view-predicates/fqn-ref-expr.mjs +0 -53
  283. package/dist/validation/view-predicates/incoming.mjs +0 -16
  284. package/dist/validation/view-predicates/index.mjs +0 -6
  285. package/dist/validation/view-predicates/outgoing.mjs +0 -20
  286. package/dist/validation/view-predicates/relation-expr.mjs +0 -39
  287. package/dist/validation/view-predicates/relation-with.mjs +0 -16
  288. package/dist/validation/view.mjs +0 -25
  289. package/dist/view-utils/assignNavigateTo.mjs +0 -25
  290. package/dist/view-utils/index.mjs +0 -1
  291. package/dist/view-utils/manual-layout.mjs +0 -99
  292. package/dist/views/configurable-layouter.mjs +0 -51
  293. package/dist/views/index.mjs +0 -1
  294. package/dist/views/likec4-views.mjs +0 -166
  295. package/dist/workspace/AstNodeDescriptionProvider.mjs +0 -17
  296. package/dist/workspace/IndexManager.mjs +0 -17
  297. package/dist/workspace/LangiumDocuments.mjs +0 -53
  298. package/dist/workspace/ProjectsManager.mjs +0 -360
  299. package/dist/workspace/WorkspaceManager.mjs +0 -83
  300. package/dist/workspace/index.mjs +0 -5
  301. /package/dist/views/{configurable-layouter.d.ts → ConfigurableLayouter.d.ts} +0 -0
@@ -9,15 +9,15 @@ export declare function GlobalsParser<TBase extends WithViewsParser>(B: TBase):
9
9
  parseGlobalDynamicPredicateGroup(astRule: ast.GlobalDynamicPredicateGroup): c4.DynamicViewIncludeRule[];
10
10
  parseGlobalStyleOrGroup(astRule: ast.GlobalStyle | ast.GlobalStyleGroup): c4.ElementViewRuleStyle[];
11
11
  parseViews(): void;
12
- parseElementView(astNode: ast.ElementView, additionalStyles: any[]): import("../../ast").ParsedAstElementView;
12
+ parseElementView(astNode: ast.ElementView, additionalStyles: (c4.ViewRuleGlobalStyle | c4.ElementViewRuleStyle<c4.aux.Any>)[]): import("../../ast").ParsedAstElementView;
13
13
  parseElementViewRule(astRule: ast.ViewRule): c4.ElementViewRule;
14
14
  parseViewRulePredicate(astNode: ast.ViewRulePredicate): c4.ElementViewPredicate;
15
15
  parseViewRuleGlobalPredicateRef(astRule: ast.ViewRuleGlobalPredicateRef | ast.DynamicViewGlobalPredicateRef): c4.ViewRuleGlobalPredicateRef;
16
- parseViewRuleStyleOrGlobalRef(astRule: ast.ViewRuleStyleOrGlobalRef): any;
16
+ parseViewRuleStyleOrGlobalRef(astRule: ast.ViewRuleStyleOrGlobalRef): c4.ViewRuleGlobalStyle | c4.ElementViewRuleStyle<c4.aux.Any>;
17
17
  parseViewRuleGroup(astNode: ast.ViewRuleGroup): c4.ElementViewRuleGroup;
18
18
  parseViewRuleStyle(astRule: ast.ViewRuleStyle | ast.GlobalStyle): c4.ElementViewRuleStyle;
19
19
  parseViewRuleGlobalStyle(astRule: ast.ViewRuleGlobalStyle): c4.ViewRuleGlobalStyle;
20
- parseDynamicElementView(astNode: ast.DynamicView, additionalStyles: any[]): import("../../ast").ParsedAstDynamicView;
20
+ parseDynamicElementView(astNode: ast.DynamicView, additionalStyles: (c4.ViewRuleGlobalStyle | c4.ElementViewRuleStyle<c4.aux.Any>)[]): import("../../ast").ParsedAstDynamicView;
21
21
  parseDynamicViewRule(astRule: ast.DynamicViewRule): c4.DynamicViewRule;
22
22
  parseDynamicViewIncludePredicate(astRule: ast.DynamicViewIncludePredicate): c4.DynamicViewIncludeRule;
23
23
  parseDynamicParallelSteps(node: ast.DynamicViewParallelSteps): c4.DynamicStepsParallel;
@@ -60,14 +60,14 @@ export declare function GlobalsParser<TBase extends WithViewsParser>(B: TBase):
60
60
  readonly doc: import("../../ast").ParsedLikeC4LangiumDocument;
61
61
  get project(): import("../../workspace").Project;
62
62
  resolveFqn(node: ast.FqnReferenceable): c4.Fqn;
63
- getAstNodePath(node: c4): any;
63
+ getAstNodePath(node: import("langium").AstNode): string;
64
64
  getMetadata(metadataAstNode: ast.MetadataProperty | undefined): {
65
65
  [key: string]: string | string[];
66
66
  } | undefined;
67
67
  parseMarkdownOrString(markdownOrString: ast.MarkdownOrString | undefined): c4.MarkdownOrString | undefined;
68
68
  convertTags<E extends {
69
69
  tags?: ast.Tags;
70
- }>(withTags?: E | undefined): any;
70
+ }>(withTags?: E | undefined): c4.NonEmptyArray<c4.Tag<string>> | null;
71
71
  parseTags<E extends {
72
72
  tags?: ast.Tags;
73
73
  }>(withTags?: E): c4.NonEmptyArray<c4.Tag> | null;
@@ -102,7 +102,7 @@ export declare function GlobalsParser<TBase extends WithViewsParser>(B: TBase):
102
102
  parseDeploymentNode(astNode: ast.DeploymentNode): import("../../ast").ParsedAstDeployment.Node;
103
103
  parseDeployedInstance(astNode: ast.DeployedInstance): import("../../ast").ParsedAstDeployment.Instance;
104
104
  parseExtendDeployment(astNode: ast.ExtendDeployment): import("../../ast").ParsedAstExtend | null;
105
- _resolveDeploymentRelationSource(node: ast.DeploymentRelation): c4;
105
+ _resolveDeploymentRelationSource(node: ast.DeploymentRelation): c4.FqnRef;
106
106
  parseDeploymentRelation(astNode: ast.DeploymentRelation): import("../../ast").ParsedAstDeploymentRelation;
107
107
  };
108
108
  } & TBase;
@@ -0,0 +1,84 @@
1
+ import { nonexhaustive } from '@likec4/core';
2
+ import { loggable } from '@likec4/log';
3
+ import { hasAtLeast, isTruthy } from 'remeda';
4
+ import { ast } from '../../ast';
5
+ import { serverLogger } from '../../logger';
6
+ const logger = serverLogger.getChild('GlobalsParser');
7
+ export function GlobalsParser(B) {
8
+ return class GlobalsParser extends B {
9
+ parseGlobals() {
10
+ const { parseResult, c4Globals } = this.doc;
11
+ const isValid = this.isValid;
12
+ const globals = parseResult.value.globals.filter(isValid);
13
+ const elRelPredicates = globals.flatMap(r => r.predicates.filter(isValid));
14
+ for (const predicate of elRelPredicates) {
15
+ try {
16
+ const globalPredicateId = predicate.name;
17
+ if (!isTruthy(globalPredicateId)) {
18
+ continue;
19
+ }
20
+ if (globalPredicateId in c4Globals.predicates) {
21
+ logger.warn(`Global predicate named "${globalPredicateId}" is already defined`);
22
+ continue;
23
+ }
24
+ this.parseAndStoreGlobalPredicateGroupOrDynamic(predicate, globalPredicateId, c4Globals);
25
+ }
26
+ catch (e) {
27
+ logger.warn(loggable(e));
28
+ }
29
+ }
30
+ const styles = globals.flatMap(r => r.styles.filter(isValid));
31
+ for (const style of styles) {
32
+ try {
33
+ const globalStyleId = style.id.name;
34
+ if (!isTruthy(globalStyleId)) {
35
+ continue;
36
+ }
37
+ if (globalStyleId in c4Globals.styles) {
38
+ logger.warn(`Global style named "${globalStyleId}" is already defined`);
39
+ continue;
40
+ }
41
+ const styles = this.parseGlobalStyleOrGroup(style);
42
+ if (hasAtLeast(styles, 1)) {
43
+ c4Globals.styles[globalStyleId] = styles;
44
+ }
45
+ }
46
+ catch (e) {
47
+ logger.warn(loggable(e));
48
+ }
49
+ }
50
+ }
51
+ parseAndStoreGlobalPredicateGroupOrDynamic(astRule, id, c4Globals) {
52
+ if (ast.isGlobalPredicateGroup(astRule)) {
53
+ const predicates = this.parseGlobalPredicateGroup(astRule);
54
+ if (hasAtLeast(predicates, 1)) {
55
+ c4Globals.predicates[id] = predicates;
56
+ }
57
+ return;
58
+ }
59
+ if (ast.isGlobalDynamicPredicateGroup(astRule)) {
60
+ const predicates = this.parseGlobalDynamicPredicateGroup(astRule);
61
+ if (hasAtLeast(predicates, 1)) {
62
+ c4Globals.dynamicPredicates[id] = predicates;
63
+ }
64
+ return;
65
+ }
66
+ nonexhaustive(astRule);
67
+ }
68
+ parseGlobalPredicateGroup(astRule) {
69
+ return astRule.predicates.map(p => this.parseViewRulePredicate(p));
70
+ }
71
+ parseGlobalDynamicPredicateGroup(astRule) {
72
+ return astRule.predicates.map(p => this.parseDynamicViewIncludePredicate(p));
73
+ }
74
+ parseGlobalStyleOrGroup(astRule) {
75
+ if (ast.isGlobalStyle(astRule)) {
76
+ return [this.parseViewRuleStyle(astRule)];
77
+ }
78
+ if (ast.isGlobalStyleGroup(astRule)) {
79
+ return astRule.styles.map(s => this.parseViewRuleStyle(s));
80
+ }
81
+ nonexhaustive(astRule);
82
+ }
83
+ };
84
+ }
@@ -1,4 +1,3 @@
1
- import { type ProjectId } from '@likec4/core';
2
1
  import type { ast } from '../../ast';
3
2
  import type { Base } from './Base';
4
3
  export declare function ImportsParser<TBase extends Base>(B: TBase): {
@@ -8,23 +7,23 @@ export declare function ImportsParser<TBase extends Base>(B: TBase): {
8
7
  readonly services: import("../..").LikeC4Services;
9
8
  readonly doc: import("../../ast").ParsedLikeC4LangiumDocument;
10
9
  get project(): import("../../workspace").Project;
11
- resolveFqn(node: ast.FqnReferenceable): ProjectId;
12
- getAstNodePath(node: ProjectId): any;
10
+ resolveFqn(node: ast.FqnReferenceable): import("@likec4/core").Fqn;
11
+ getAstNodePath(node: import("langium").AstNode): string;
13
12
  getMetadata(metadataAstNode: ast.MetadataProperty | undefined): {
14
13
  [key: string]: string | string[];
15
14
  } | undefined;
16
- parseMarkdownOrString(markdownOrString: ast.MarkdownOrString | undefined): ProjectId | undefined;
15
+ parseMarkdownOrString(markdownOrString: ast.MarkdownOrString | undefined): import("@likec4/core").MarkdownOrString | undefined;
17
16
  convertTags<E extends {
18
17
  tags?: ast.Tags;
19
- }>(withTags?: E | undefined): any;
18
+ }>(withTags?: E | undefined): import("@likec4/core").NonEmptyArray<import("@likec4/core").Tag<string>> | null;
20
19
  parseTags<E extends {
21
20
  tags?: ast.Tags;
22
- }>(withTags?: E): ProjectId<ProjectId> | null;
23
- convertLinks(source?: ast.LinkProperty["$container"]): ProjectId[] | undefined;
24
- parseLinks(source?: ast.LinkProperty["$container"]): ProjectId[] | undefined;
25
- parseIconProperty(prop: ast.IconProperty | undefined): ProjectId | undefined;
21
+ }>(withTags?: E): import("@likec4/core").NonEmptyArray<import("@likec4/core").Tag> | null;
22
+ convertLinks(source?: ast.LinkProperty["$container"]): import("@likec4/core").Link[] | undefined;
23
+ parseLinks(source?: ast.LinkProperty["$container"]): import("@likec4/core").Link[] | undefined;
24
+ parseIconProperty(prop: ast.IconProperty | undefined): import("@likec4/core").IconUrl | undefined;
26
25
  parseImageAlias(value: string): string | undefined;
27
- parseColorLiteral(astNode: ast.ColorLiteral): ProjectId | undefined;
26
+ parseColorLiteral(astNode: ast.ColorLiteral): import("@likec4/core").ColorLiteral | undefined;
28
27
  parseElementStyle(elementProps: Array<ast.ElementProperty> | ast.ElementStyleProperty | undefined): import("../../ast").ParsedElementStyle;
29
28
  parseStyleProps(styleProps: Array<ast.StyleProperty> | undefined): import("../../ast").ParsedElementStyle;
30
29
  parseBaseProps(props: {
@@ -39,8 +38,8 @@ export declare function ImportsParser<TBase extends Base>(B: TBase): {
39
38
  technology?: string | undefined;
40
39
  }): {
41
40
  title?: string;
42
- summary?: ProjectId;
43
- description?: ProjectId;
41
+ summary?: import("@likec4/core").MarkdownOrString;
42
+ description?: import("@likec4/core").MarkdownOrString;
44
43
  technology?: string;
45
44
  };
46
45
  };
@@ -0,0 +1,24 @@
1
+ import { nonNullable } from '@likec4/core';
2
+ import { loggable } from '@likec4/log';
3
+ import { serverLogger } from '../../logger';
4
+ const logger = serverLogger.getChild('ImportsParser');
5
+ export function ImportsParser(B) {
6
+ return class ImportsParser extends B {
7
+ parseImports() {
8
+ const imports = this.doc.parseResult.value.imports ?? [];
9
+ for (const importsFromPoject of imports) {
10
+ const project = importsFromPoject.project;
11
+ let imported = importsFromPoject.imports;
12
+ while (imported) {
13
+ try {
14
+ this.doc.c4Imports.set(project, this.resolveFqn(nonNullable(imported.imported.ref, `ElementRef is empty of imported: ${imported.imported.$refText}`)));
15
+ }
16
+ catch (e) {
17
+ logger.warn(loggable(e));
18
+ }
19
+ imported = imported.prev;
20
+ }
21
+ }
22
+ }
23
+ };
24
+ }
@@ -32,14 +32,14 @@ export declare function ModelParser<TBase extends WithExpressionV2>(B: TBase): {
32
32
  readonly doc: import("../../ast").ParsedLikeC4LangiumDocument;
33
33
  get project(): import("../../workspace").Project;
34
34
  resolveFqn(node: ast.FqnReferenceable): c4.Fqn;
35
- getAstNodePath(node: c4): any;
35
+ getAstNodePath(node: import("langium").AstNode): string;
36
36
  getMetadata(metadataAstNode: ast.MetadataProperty | undefined): {
37
37
  [key: string]: string | string[];
38
38
  } | undefined;
39
39
  parseMarkdownOrString(markdownOrString: ast.MarkdownOrString | undefined): c4.MarkdownOrString | undefined;
40
40
  convertTags<E extends {
41
41
  tags?: ast.Tags;
42
- }>(withTags?: E | undefined): any;
42
+ }>(withTags?: E | undefined): c4.NonEmptyArray<c4.Tag<string>> | null;
43
43
  parseTags<E extends {
44
44
  tags?: ast.Tags;
45
45
  }>(withTags?: E): c4.NonEmptyArray<c4.Tag> | null;
@@ -0,0 +1,165 @@
1
+ import { invariant, isNonEmptyArray, LinkedList, nonexhaustive, nonNullable } from '@likec4/core';
2
+ import { exact, FqnRef } from '@likec4/core/types';
3
+ import { loggable } from '@likec4/log';
4
+ import { filter, first, isDefined, isEmpty, isTruthy, map, mapToObj, pipe } from 'remeda';
5
+ import { ast, toRelationshipStyle, } from '../../ast';
6
+ import { logger as mainLogger } from '../../logger';
7
+ import { stringHash } from '../../utils/stringHash';
8
+ const logger = mainLogger.getChild('ModelParser');
9
+ function* streamModel(doc) {
10
+ const traverseStack = LinkedList.from(doc.parseResult.value.models.flatMap(m => m.elements));
11
+ const relations = [];
12
+ let el;
13
+ while ((el = traverseStack.shift())) {
14
+ if (ast.isRelation(el)) {
15
+ relations.push(el);
16
+ continue;
17
+ }
18
+ if (el.body && el.body.elements && el.body.elements.length > 0) {
19
+ for (const child of el.body.elements) {
20
+ traverseStack.push(child);
21
+ }
22
+ }
23
+ yield el;
24
+ }
25
+ yield* relations;
26
+ return;
27
+ }
28
+ export function ModelParser(B) {
29
+ return class ModelParser extends B {
30
+ parseModel() {
31
+ const doc = this.doc;
32
+ for (const el of streamModel(doc)) {
33
+ try {
34
+ if (ast.isElement(el)) {
35
+ doc.c4Elements.push(this.parseElement(el));
36
+ continue;
37
+ }
38
+ if (ast.isRelation(el)) {
39
+ if (this.isValid(el)) {
40
+ doc.c4Relations.push(this.parseRelation(el));
41
+ }
42
+ continue;
43
+ }
44
+ if (ast.isExtendElement(el)) {
45
+ const parsed = this.parseExtendElement(el);
46
+ if (parsed) {
47
+ doc.c4ExtendElements.push(parsed);
48
+ }
49
+ continue;
50
+ }
51
+ nonexhaustive(el);
52
+ }
53
+ catch (e) {
54
+ const astPath = this.getAstNodePath(el);
55
+ const error = loggable(e);
56
+ const message = e instanceof Error ? e.message : String(error);
57
+ logger.warn(`Error on {eltype}: ${message}\n document: {path}\n astpath: {astPath}\n${error}`, {
58
+ path: doc.uri.path,
59
+ eltype: el.$type,
60
+ astPath,
61
+ });
62
+ }
63
+ }
64
+ }
65
+ parseElement(astNode) {
66
+ const isValid = this.isValid;
67
+ const id = this.resolveFqn(astNode);
68
+ const kind = nonNullable(astNode.kind.ref, 'Element kind is not resolved').name;
69
+ const tags = this.parseTags(astNode.body);
70
+ const style = this.parseElementStyle(astNode.body?.props);
71
+ const metadata = this.getMetadata(astNode.body?.props.find(ast.isMetadataProperty));
72
+ const astPath = this.getAstNodePath(astNode);
73
+ let [_title, _summary, _technology] = astNode.props ?? [];
74
+ const bodyProps = pipe(astNode.body?.props ?? [], filter(isValid), filter(ast.isElementStringProperty), mapToObj(p => [p.key, p.value]));
75
+ const { title, ...descAndTech } = this.parseBaseProps(bodyProps, {
76
+ title: _title,
77
+ summary: _summary,
78
+ technology: _technology,
79
+ });
80
+ const links = this.parseLinks(astNode.body);
81
+ return exact({
82
+ id,
83
+ kind,
84
+ astPath,
85
+ title: title ?? astNode.name,
86
+ metadata,
87
+ tags: tags ?? undefined,
88
+ ...(links && isNonEmptyArray(links) && { links }),
89
+ ...descAndTech,
90
+ style,
91
+ });
92
+ }
93
+ parseExtendElement(astNode) {
94
+ const id = this.resolveFqn(astNode);
95
+ const tags = this.parseTags(astNode.body);
96
+ const metadata = this.getMetadata(astNode.body?.props.find(ast.isMetadataProperty));
97
+ const astPath = this.getAstNodePath(astNode);
98
+ const links = this.parseLinks(astNode.body) ?? [];
99
+ if (!tags && isEmpty(metadata ?? {}) && isEmpty(links)) {
100
+ return null;
101
+ }
102
+ return exact({
103
+ id,
104
+ astPath,
105
+ metadata,
106
+ tags,
107
+ links: isNonEmptyArray(links) ? links : null,
108
+ });
109
+ }
110
+ _resolveRelationSource(node) {
111
+ if (isDefined(node.source)) {
112
+ const source = this.parseFqnRef(node.source);
113
+ invariant(FqnRef.isModelRef(source) || FqnRef.isImportRef(source), 'Relation source must be a model reference');
114
+ return source;
115
+ }
116
+ if (ast.isElementBody(node.$container)) {
117
+ return {
118
+ model: this.resolveFqn(node.$container.$container),
119
+ };
120
+ }
121
+ if (ast.isExtendElementBody(node.$container)) {
122
+ return {
123
+ model: this.resolveFqn(node.$container.$container),
124
+ };
125
+ }
126
+ throw new Error('RelationRefError: Invalid container for sourceless relation');
127
+ }
128
+ parseRelation(astNode) {
129
+ const isValid = this.isValid;
130
+ const source = this._resolveRelationSource(astNode);
131
+ const target = this.parseFqnRef(astNode.target);
132
+ invariant(FqnRef.isModelRef(target) || FqnRef.isImportRef(target), 'Target must be a model reference');
133
+ const tags = this.parseTags(astNode) ?? this.parseTags(astNode.body);
134
+ const links = this.parseLinks(astNode.body);
135
+ const kind = (astNode.kind ?? astNode.dotKind?.kind)?.ref?.name;
136
+ const metadata = this.getMetadata(astNode.body?.props.find(ast.isMetadataProperty));
137
+ const astPath = this.getAstNodePath(astNode);
138
+ const bodyProps = pipe(astNode.body?.props ?? [], filter(ast.isRelationStringProperty), filter(p => isTruthy(p.value)), mapToObj(p => [p.key, p.value]));
139
+ const navigateTo = pipe(astNode.body?.props ?? [], filter(ast.isRelationNavigateToProperty), map(p => p.value.view.ref?.name), filter(isTruthy), first());
140
+ const { title = '', description, technology } = this.parseBaseProps(bodyProps, {
141
+ // inline props
142
+ title: astNode.title,
143
+ description: astNode.description,
144
+ technology: astNode.technology,
145
+ });
146
+ const styleProp = astNode.body?.props.find(ast.isRelationStyleProperty);
147
+ const id = stringHash(astPath, source.model, target.model);
148
+ return exact({
149
+ id,
150
+ astPath,
151
+ source,
152
+ target,
153
+ title,
154
+ metadata,
155
+ kind,
156
+ tags: tags ?? undefined,
157
+ links: isNonEmptyArray(links) ? links : undefined,
158
+ navigateTo: navigateTo ? navigateTo : undefined,
159
+ description,
160
+ technology,
161
+ ...toRelationshipStyle(styleProp?.props, isValid),
162
+ });
163
+ }
164
+ };
165
+ }
@@ -37,14 +37,14 @@ export declare function PredicatesParser<TBase extends WithExpressionV2>(B: TBas
37
37
  readonly doc: import("../../ast").ParsedLikeC4LangiumDocument;
38
38
  get project(): import("../../workspace").Project;
39
39
  resolveFqn(node: ast.FqnReferenceable): c4.Fqn;
40
- getAstNodePath(node: c4): any;
40
+ getAstNodePath(node: import("langium").AstNode): string;
41
41
  getMetadata(metadataAstNode: ast.MetadataProperty | undefined): {
42
42
  [key: string]: string | string[];
43
43
  } | undefined;
44
44
  parseMarkdownOrString(markdownOrString: ast.MarkdownOrString | undefined): c4.MarkdownOrString | undefined;
45
45
  convertTags<E extends {
46
46
  tags?: ast.Tags;
47
- }>(withTags?: E | undefined): any;
47
+ }>(withTags?: E | undefined): c4.NonEmptyArray<c4.Tag<string>> | null;
48
48
  parseTags<E extends {
49
49
  tags?: ast.Tags;
50
50
  }>(withTags?: E): c4.NonEmptyArray<c4.Tag> | null;
@@ -0,0 +1,45 @@
1
+ import { nonexhaustive } from '@likec4/core';
2
+ import { ast } from '../../ast';
3
+ export function PredicatesParser(B) {
4
+ return class PredicatesParser extends B {
5
+ parsePredicate(astNode) {
6
+ return this.parseExpressionV2(astNode);
7
+ }
8
+ parseElementPredicate(astNode) {
9
+ if (ast.isFqnExprWith(astNode)) {
10
+ return this.parseFqnExprWith(astNode);
11
+ }
12
+ if (ast.isFqnExprOrWhere(astNode)) {
13
+ return this.parseFqnExprOrWhere(astNode);
14
+ }
15
+ nonexhaustive(astNode);
16
+ }
17
+ parseElementPredicateOrWhere(astNode) {
18
+ return this.parseFqnExprOrWhere(astNode);
19
+ }
20
+ parseElementExpression(astNode) {
21
+ return this.parseFqnExpr(astNode);
22
+ }
23
+ parseElementPredicateWhere(astNode) {
24
+ return this.parseFqnExprWhere(astNode);
25
+ }
26
+ parseElementPredicateWith(astNode) {
27
+ return this.parseFqnExprWith(astNode);
28
+ }
29
+ parseRelationPredicate(astNode) {
30
+ return this.parseRelationExprOrWith(astNode);
31
+ }
32
+ parseRelationPredicateOrWhere(astNode) {
33
+ return this.parseRelationExprOrWhere(astNode);
34
+ }
35
+ parseRelationPredicateWhere(astNode) {
36
+ return this.parseRelationExprWhere(astNode);
37
+ }
38
+ parseRelationPredicateWith(astNode) {
39
+ return this.parseRelationExprWith(astNode);
40
+ }
41
+ parseRelationExpression(astNode) {
42
+ return this.parseRelationExpr(astNode);
43
+ }
44
+ };
45
+ }
@@ -15,14 +15,14 @@ export declare function SpecificationParser<TBase extends Base>(B: TBase): {
15
15
  readonly doc: import("../../ast").ParsedLikeC4LangiumDocument;
16
16
  get project(): import("../../workspace").Project;
17
17
  resolveFqn(node: ast.FqnReferenceable): c4.Fqn;
18
- getAstNodePath(node: c4): any;
18
+ getAstNodePath(node: import("langium").AstNode): string;
19
19
  getMetadata(metadataAstNode: ast.MetadataProperty | undefined): {
20
20
  [key: string]: string | string[];
21
21
  } | undefined;
22
22
  parseMarkdownOrString(markdownOrString: ast.MarkdownOrString | undefined): c4.MarkdownOrString | undefined;
23
23
  convertTags<E extends {
24
24
  tags?: ast.Tags;
25
- }>(withTags?: E | undefined): any;
25
+ }>(withTags?: E | undefined): c4.NonEmptyArray<c4.Tag<string>> | null;
26
26
  parseTags<E extends {
27
27
  tags?: ast.Tags;
28
28
  }>(withTags?: E): c4.NonEmptyArray<c4.Tag> | null;
@@ -0,0 +1,113 @@
1
+ import * as c4 from '@likec4/core';
2
+ import { exact } from '@likec4/core';
3
+ import { nonNullable } from '@likec4/core/utils';
4
+ import { loggable } from '@likec4/log';
5
+ import { filter, isNonNullish, isNullish, isTruthy, mapToObj, omitBy, pipe } from 'remeda';
6
+ import { ast, parseMarkdownAsString, toRelationshipStyle } from '../../ast';
7
+ import { serverLogger } from '../../logger';
8
+ import { removeIndent } from './Base';
9
+ const logger = serverLogger.getChild('SpecificationParser');
10
+ export function SpecificationParser(B) {
11
+ return class SpecificationParser extends B {
12
+ parseSpecification() {
13
+ const { parseResult: { value: { specifications, }, }, c4Specification, } = this.doc;
14
+ const isValid = this.isValid;
15
+ for (const elementSpec of specifications.flatMap(s => s.elements.filter(isValid))) {
16
+ try {
17
+ Object.assign(c4Specification.elements, this.parseElementSpecificationNode(elementSpec));
18
+ }
19
+ catch (e) {
20
+ logger.warn(loggable(e));
21
+ }
22
+ }
23
+ for (const deploymentNodeSpec of specifications.flatMap(s => s.deploymentNodes.filter(isValid))) {
24
+ try {
25
+ Object.assign(c4Specification.deployments, this.parseElementSpecificationNode(deploymentNodeSpec));
26
+ }
27
+ catch (e) {
28
+ logger.warn(loggable(e));
29
+ }
30
+ }
31
+ const relations_specs = specifications.flatMap(s => s.relationships.filter(this.isValid));
32
+ for (const { kind, props } of relations_specs) {
33
+ try {
34
+ const kindName = kind.name;
35
+ if (!isTruthy(kindName)) {
36
+ continue;
37
+ }
38
+ if (kindName in c4Specification.relationships) {
39
+ logger.warn(`Relationship kind "${kindName}" is already defined`);
40
+ continue;
41
+ }
42
+ const bodyProps = pipe(props.filter(ast.isSpecificationRelationshipStringProperty) ?? [], filter(p => this.isValid(p) && isNonNullish(p.value)), mapToObj(p => [p.key, removeIndent(parseMarkdownAsString(p.value))]), omitBy(isNullish));
43
+ c4Specification.relationships[kindName] = {
44
+ ...bodyProps,
45
+ ...toRelationshipStyle(props.filter(ast.isRelationshipStyleProperty), this.isValid),
46
+ };
47
+ }
48
+ catch (e) {
49
+ logger.warn(loggable(e));
50
+ }
51
+ }
52
+ const tags_specs = specifications.flatMap(s => s.tags.filter(this.isValid));
53
+ for (const tagSpec of tags_specs) {
54
+ try {
55
+ const tag = tagSpec.tag.name;
56
+ const astPath = this.getAstNodePath(tagSpec.tag);
57
+ const color = tagSpec.color && this.parseColorLiteral(tagSpec.color);
58
+ if (tag in c4Specification.tags) {
59
+ logger.warn(`Tag {tag} is already defined, skipping duplicate`, { tag });
60
+ continue;
61
+ }
62
+ if (isTruthy(tag)) {
63
+ c4Specification.tags[tag] = {
64
+ astPath,
65
+ ...(color ? { color } : {}),
66
+ };
67
+ }
68
+ }
69
+ catch (e) {
70
+ logger.warn(loggable(e));
71
+ }
72
+ }
73
+ const colors_specs = specifications.flatMap(s => s.colors.filter(isValid));
74
+ for (const { name, color } of colors_specs) {
75
+ try {
76
+ const colorName = name.name;
77
+ if (colorName in c4Specification.colors) {
78
+ logger.warn(`Custom color "${colorName}" is already defined`);
79
+ continue;
80
+ }
81
+ c4Specification.colors[colorName] = {
82
+ color: nonNullable(this.parseColorLiteral(color), `Color "${colorName}" is not valid: ${color}`),
83
+ };
84
+ }
85
+ catch (e) {
86
+ logger.warn(loggable(e));
87
+ }
88
+ }
89
+ }
90
+ parseElementSpecificationNode(specAst) {
91
+ const { kind, props } = specAst;
92
+ const kindName = kind.name;
93
+ if (!isTruthy(kindName)) {
94
+ throw new Error('DeploymentNodeKind name is not resolved');
95
+ }
96
+ const tags = this.parseTags(specAst);
97
+ const style = this.parseElementStyle(props.find(ast.isElementStyleProperty));
98
+ const links = this.parseLinks(specAst);
99
+ const bodyProps = pipe(props.filter(ast.isSpecificationElementStringProperty) ?? [], filter(p => this.isValid(p)), mapToObj(p => [p.key, p.value]));
100
+ const baseProps = this.parseBaseProps(bodyProps);
101
+ const notation = removeIndent(parseMarkdownAsString(bodyProps.notation));
102
+ return {
103
+ [kindName]: exact({
104
+ ...baseProps,
105
+ notation,
106
+ tags: tags ?? undefined,
107
+ ...(links && c4.isNonEmptyArray(links) && { links }),
108
+ style,
109
+ }),
110
+ };
111
+ }
112
+ };
113
+ }
@@ -0,0 +1,12 @@
1
+ import { DefaultValueConverter, ValueConverter } from 'langium';
2
+ export class LikeC4ValueConverter extends DefaultValueConverter {
3
+ runConverter(rule, input, cstNode) {
4
+ if (rule.name === 'MarkdownString') {
5
+ if ((input.startsWith('"""') && input.endsWith('"""')) || (input.startsWith(`'''`) && input.endsWith(`'''`))) {
6
+ input = input.slice(2, -2);
7
+ }
8
+ return ValueConverter.convertString(input);
9
+ }
10
+ return super.runConverter(rule, input, cstNode);
11
+ }
12
+ }
@@ -62,14 +62,14 @@ export declare function ViewsParser<TBase extends WithPredicates & WithDeploymen
62
62
  readonly doc: import("../../ast").ParsedLikeC4LangiumDocument;
63
63
  get project(): import("../../workspace").Project;
64
64
  resolveFqn(node: ast.FqnReferenceable): c4.Fqn;
65
- getAstNodePath(node: c4): any;
65
+ getAstNodePath(node: import("langium").AstNode): string;
66
66
  getMetadata(metadataAstNode: ast.MetadataProperty | undefined): {
67
67
  [key: string]: string | string[];
68
68
  } | undefined;
69
69
  parseMarkdownOrString(markdownOrString: ast.MarkdownOrString | undefined): c4.MarkdownOrString | undefined;
70
70
  convertTags<E extends {
71
71
  tags?: ast.Tags;
72
- }>(withTags?: E | undefined): any;
72
+ }>(withTags?: E | undefined): c4.NonEmptyArray<c4.Tag<string>> | null;
73
73
  parseTags<E extends {
74
74
  tags?: ast.Tags;
75
75
  }>(withTags?: E): c4.NonEmptyArray<c4.Tag> | null;
@@ -104,7 +104,7 @@ export declare function ViewsParser<TBase extends WithPredicates & WithDeploymen
104
104
  parseDeploymentNode(astNode: ast.DeploymentNode): import("../../ast").ParsedAstDeployment.Node;
105
105
  parseDeployedInstance(astNode: ast.DeployedInstance): import("../../ast").ParsedAstDeployment.Instance;
106
106
  parseExtendDeployment(astNode: ast.ExtendDeployment): import("../../ast").ParsedAstExtend | null;
107
- _resolveDeploymentRelationSource(node: ast.DeploymentRelation): c4;
107
+ _resolveDeploymentRelationSource(node: ast.DeploymentRelation): c4.FqnRef;
108
108
  parseDeploymentRelation(astNode: ast.DeploymentRelation): import("../../ast").ParsedAstDeploymentRelation;
109
109
  };
110
110
  } & TBase;