@likec4/language-server 1.17.0 → 1.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39,7 +39,7 @@ declare class LikeC4DocumentLinkProvider implements DocumentLinkProvider {
39
39
  }
40
40
 
41
41
  /******************************************************************************
42
- * This file was generated by langium-cli 3.2.0.
42
+ * This file was generated by langium-cli 3.3.0.
43
43
  * DO NOT EDIT MANUALLY!
44
44
  ******************************************************************************/
45
45
 
@@ -49,23 +49,19 @@ type CustomColorId = 'element' | 'model' | ArrowType | ElementShape | LineOption
49
49
  type CustomColorValue = string;
50
50
  type DynamicViewRule = DynamicViewGlobalPredicateRef | DynamicViewIncludePredicate | ViewRuleAutoLayout | ViewRuleStyleOrGlobalRef;
51
51
  declare const DynamicViewRule = "DynamicViewRule";
52
- declare function isDynamicViewRule(item: unknown): item is DynamicViewRule;
53
52
  type ElementExpression = ElementDescedantsExpression | ElementKindExpression | ElementRef | ElementTagExpression | ExpandElementExpression | WildcardExpression;
54
53
  declare const ElementExpression = "ElementExpression";
55
- declare function isElementExpression(item: unknown): item is ElementExpression;
56
54
  type ElementPredicate = ElementPredicateOrWhere | ElementPredicateWith;
57
55
  declare const ElementPredicate = "ElementPredicate";
58
56
  type ElementPredicateOrWhere = ElementExpression | ElementPredicateWhere;
59
57
  declare const ElementPredicateOrWhere = "ElementPredicateOrWhere";
60
58
  type ElementProperty = ElementStringProperty | ElementStyleProperty | IconProperty | LinkProperty | MetadataProperty;
61
59
  declare const ElementProperty = "ElementProperty";
62
- declare function isElementProperty(item: unknown): item is ElementProperty;
63
60
  type ElementShape = 'browser' | 'cylinder' | 'mobile' | 'person' | 'queue' | 'rectangle' | 'storage';
64
61
  type IconId = string;
65
62
  type Id = 'element' | 'group' | 'model' | ArrowType | ElementShape | LineOptions | ThemeColor | string;
66
63
  type LikeC4View = DynamicView | ElementView;
67
64
  declare const LikeC4View = "LikeC4View";
68
- declare function isLikeC4View(item: unknown): item is LikeC4View;
69
65
  type LineOptions = 'dashed' | 'dotted' | 'solid';
70
66
  type MetadataProperty = MetadataBody;
71
67
  declare const MetadataProperty = "MetadataProperty";
@@ -73,30 +69,25 @@ type Predicate = ElementPredicate | RelationPredicate;
73
69
  declare const Predicate = "Predicate";
74
70
  type RelationExpression = DirectedRelationExpression | InOutRelationExpression | IncomingRelationExpression | OutgoingRelationExpression;
75
71
  declare const RelationExpression = "RelationExpression";
76
- declare function isRelationExpression(item: unknown): item is RelationExpression;
77
72
  type RelationPredicate = RelationPredicateOrWhere | RelationPredicateWith;
78
73
  declare const RelationPredicate = "RelationPredicate";
79
74
  type RelationPredicateOrWhere = RelationExpression | RelationPredicateWhere;
80
75
  declare const RelationPredicateOrWhere = "RelationPredicateOrWhere";
81
76
  type RelationProperty = LinkProperty | MetadataProperty | RelationNavigateToProperty | RelationStringProperty | RelationStyleProperty;
82
77
  declare const RelationProperty = "RelationProperty";
83
- declare function isRelationProperty(item: unknown): item is RelationProperty;
84
78
  type RelationshipStyleProperty = ArrowProperty | ColorProperty | LineProperty;
85
79
  declare const RelationshipStyleProperty = "RelationshipStyleProperty";
86
80
  type StringProperty = ElementStringProperty | MetadataAttribute | NotationProperty | NotesProperty | RelationStringProperty | SpecificationElementStringProperty | SpecificationRelationshipStringProperty | ViewStringProperty;
87
81
  declare const StringProperty = "StringProperty";
88
82
  type StyleProperty = BorderProperty | ColorProperty | IconProperty | OpacityProperty | ShapeProperty;
89
83
  declare const StyleProperty = "StyleProperty";
90
- declare function isStyleProperty(item: unknown): item is StyleProperty;
91
84
  type ThemeColor = 'amber' | 'blue' | 'gray' | 'green' | 'indigo' | 'muted' | 'primary' | 'red' | 'secondary' | 'sky' | 'slate';
92
85
  type Uri = string;
93
86
  type ViewLayoutDirection = 'BottomTop' | 'LeftRight' | 'RightLeft' | 'TopBottom';
94
87
  type ViewProperty = LinkProperty | ViewStringProperty;
95
88
  declare const ViewProperty = "ViewProperty";
96
- declare function isViewProperty(item: unknown): item is ViewProperty;
97
89
  type ViewRule = ViewRuleAutoLayout | ViewRuleGlobalPredicateRef | ViewRuleGroup | ViewRulePredicate | ViewRuleStyleOrGlobalRef;
98
90
  declare const ViewRule = "ViewRule";
99
- declare function isViewRule(item: unknown): item is ViewRule;
100
91
  type ViewRulePredicate = ExcludePredicate | IncludePredicate;
101
92
  declare const ViewRulePredicate = "ViewRulePredicate";
102
93
  type ViewRuleStyleOrGlobalRef = ViewRuleGlobalStyle | ViewRuleStyle;
@@ -178,7 +169,6 @@ interface DynamicViewBody extends AstNode {
178
169
  tags?: Tags;
179
170
  }
180
171
  declare const DynamicViewBody = "DynamicViewBody";
181
- declare function isDynamicViewBody(item: unknown): item is DynamicViewBody;
182
172
  interface DynamicViewGlobalPredicateRef extends AstNode {
183
173
  readonly $container: DynamicViewBody;
184
174
  readonly $type: 'DynamicViewGlobalPredicateRef';
@@ -197,7 +187,6 @@ interface DynamicViewParallelSteps extends AstNode {
197
187
  steps: Array<DynamicViewStep>;
198
188
  }
199
189
  declare const DynamicViewParallelSteps = "DynamicViewParallelSteps";
200
- declare function isDynamicViewParallelSteps(item: unknown): item is DynamicViewParallelSteps;
201
190
  interface DynamicViewPredicateIterator extends AstNode {
202
191
  readonly $container: DynamicViewIncludePredicate | DynamicViewPredicateIterator;
203
192
  readonly $type: 'DynamicViewPredicateIterator';
@@ -205,7 +194,6 @@ interface DynamicViewPredicateIterator extends AstNode {
205
194
  value: ElementPredicate;
206
195
  }
207
196
  declare const DynamicViewPredicateIterator = "DynamicViewPredicateIterator";
208
- declare function isDynamicViewPredicateIterator(item: unknown): item is DynamicViewPredicateIterator;
209
197
  interface DynamicViewRef extends AstNode {
210
198
  readonly $container: RelationNavigateToProperty;
211
199
  readonly $type: 'DynamicViewRef';
@@ -223,7 +211,6 @@ interface DynamicViewStep extends AstNode {
223
211
  title?: string;
224
212
  }
225
213
  declare const DynamicViewStep = "DynamicViewStep";
226
- declare function isDynamicViewStep(item: unknown): item is DynamicViewStep;
227
214
  interface Element extends AstNode {
228
215
  readonly $container: ElementBody | ExtendElementBody | Model;
229
216
  readonly $type: 'Element';
@@ -233,7 +220,6 @@ interface Element extends AstNode {
233
220
  props: Array<string>;
234
221
  }
235
222
  declare const Element = "Element";
236
- declare function isElement(item: unknown): item is Element;
237
223
  interface ElementBody extends AstNode {
238
224
  readonly $container: Element;
239
225
  readonly $type: 'ElementBody';
@@ -242,7 +228,6 @@ interface ElementBody extends AstNode {
242
228
  tags?: Tags;
243
229
  }
244
230
  declare const ElementBody = "ElementBody";
245
- declare function isElementBody(item: unknown): item is ElementBody;
246
231
  interface ElementDescedantsExpression extends AstNode {
247
232
  readonly $container: DirectedRelationExpression | DynamicViewPredicateIterator | ElementExpressionsIterator | ElementPredicateWhere | ElementPredicateWith | IncomingRelationExpression | OutgoingRelationExpression | Predicates;
248
233
  readonly $type: 'ElementDescedantsExpression';
@@ -283,7 +268,6 @@ interface ElementPredicateWith extends AstNode {
283
268
  subject: ElementPredicateOrWhere;
284
269
  }
285
270
  declare const ElementPredicateWith = "ElementPredicateWith";
286
- declare function isElementPredicateWith(item: unknown): item is ElementPredicateWith;
287
271
  interface ElementRef extends AstNode {
288
272
  readonly $container: DirectedRelationExpression | DynamicViewPredicateIterator | DynamicViewStep | ElementDescedantsExpression | ElementExpressionsIterator | ElementPredicateWhere | ElementPredicateWith | ElementRef | ElementView | ExpandElementExpression | IncomingRelationExpression | OutgoingRelationExpression | Predicates | Relation;
289
273
  readonly $type: 'ElementRef';
@@ -329,7 +313,6 @@ interface ElementViewBody extends AstNode {
329
313
  tags?: Tags;
330
314
  }
331
315
  declare const ElementViewBody = "ElementViewBody";
332
- declare function isElementViewBody(item: unknown): item is ElementViewBody;
333
316
  interface ElementViewRef extends AstNode {
334
317
  readonly $container: ElementView;
335
318
  readonly $type: 'ElementViewRef';
@@ -355,14 +338,12 @@ interface ExtendElement extends AstNode {
355
338
  element: FqnElementRef;
356
339
  }
357
340
  declare const ExtendElement = "ExtendElement";
358
- declare function isExtendElement(item: unknown): item is ExtendElement;
359
341
  interface ExtendElementBody extends AstNode {
360
342
  readonly $container: ExtendElement;
361
343
  readonly $type: 'ExtendElementBody';
362
344
  elements: Array<Element | Relation>;
363
345
  }
364
346
  declare const ExtendElementBody = "ExtendElementBody";
365
- declare function isExtendElementBody(item: unknown): item is ExtendElementBody;
366
347
  interface FqnElementRef extends AstNode {
367
348
  readonly $container: ExtendElement | FqnElementRef;
368
349
  readonly $type: 'FqnElementRef';
@@ -377,7 +358,6 @@ interface GlobalDynamicPredicateGroup extends AstNode {
377
358
  predicates: Array<DynamicViewIncludePredicate>;
378
359
  }
379
360
  declare const GlobalDynamicPredicateGroup = "GlobalDynamicPredicateGroup";
380
- declare function isGlobalDynamicPredicateGroup(item: unknown): item is GlobalDynamicPredicateGroup;
381
361
  interface GlobalPredicateGroup extends AstNode {
382
362
  readonly $container: Globals;
383
363
  readonly $type: 'GlobalPredicateGroup';
@@ -385,7 +365,6 @@ interface GlobalPredicateGroup extends AstNode {
385
365
  predicates: Array<ViewRulePredicate>;
386
366
  }
387
367
  declare const GlobalPredicateGroup = "GlobalPredicateGroup";
388
- declare function isGlobalPredicateGroup(item: unknown): item is GlobalPredicateGroup;
389
368
  interface Globals extends AstNode {
390
369
  readonly $container: LikeC4Grammar;
391
370
  readonly $type: 'Globals';
@@ -394,7 +373,6 @@ interface Globals extends AstNode {
394
373
  styles: Array<GlobalStyle | GlobalStyleGroup>;
395
374
  }
396
375
  declare const Globals = "Globals";
397
- declare function isGlobals(item: unknown): item is Globals;
398
376
  interface GlobalStyle extends AstNode {
399
377
  readonly $container: Globals;
400
378
  readonly $type: 'GlobalStyle';
@@ -403,7 +381,6 @@ interface GlobalStyle extends AstNode {
403
381
  target: ElementExpressionsIterator;
404
382
  }
405
383
  declare const GlobalStyle = "GlobalStyle";
406
- declare function isGlobalStyle(item: unknown): item is GlobalStyle;
407
384
  interface GlobalStyleGroup extends AstNode {
408
385
  readonly $container: Globals;
409
386
  readonly $type: 'GlobalStyleGroup';
@@ -411,7 +388,6 @@ interface GlobalStyleGroup extends AstNode {
411
388
  styles: Array<ViewRuleStyle>;
412
389
  }
413
390
  declare const GlobalStyleGroup = "GlobalStyleGroup";
414
- declare function isGlobalStyleGroup(item: unknown): item is GlobalStyleGroup;
415
391
  interface GlobalStyleId extends AstNode {
416
392
  readonly $container: GlobalStyle | GlobalStyleGroup;
417
393
  readonly $type: 'GlobalStyleId';
@@ -500,7 +476,6 @@ interface Model extends AstNode {
500
476
  name: 'model';
501
477
  }
502
478
  declare const Model = "Model";
503
- declare function isModel(item: unknown): item is Model;
504
479
  interface ModelViews extends AstNode {
505
480
  readonly $container: LikeC4Grammar;
506
481
  readonly $type: 'ModelViews';
@@ -509,7 +484,6 @@ interface ModelViews extends AstNode {
509
484
  views: Array<LikeC4View>;
510
485
  }
511
486
  declare const ModelViews = "ModelViews";
512
- declare function isModelViews(item: unknown): item is ModelViews;
513
487
  interface NavigateToProperty extends AstNode {
514
488
  readonly $container: CustomElementProperties;
515
489
  readonly $type: 'NavigateToProperty';
@@ -565,7 +539,6 @@ interface Relation extends AstNode {
565
539
  title?: string;
566
540
  }
567
541
  declare const Relation = "Relation";
568
- declare function isRelation(item: unknown): item is Relation;
569
542
  interface RelationBody extends AstNode {
570
543
  readonly $container: Relation;
571
544
  readonly $type: 'RelationBody';
@@ -573,7 +546,6 @@ interface RelationBody extends AstNode {
573
546
  tags?: Tags;
574
547
  }
575
548
  declare const RelationBody = "RelationBody";
576
- declare function isRelationBody(item: unknown): item is RelationBody;
577
549
  interface RelationNavigateToProperty extends AstNode {
578
550
  readonly $container: CustomRelationProperties | RelationBody;
579
551
  readonly $type: 'RelationNavigateToProperty';
@@ -595,7 +567,6 @@ interface RelationPredicateWith extends AstNode {
595
567
  subject: RelationPredicateOrWhere;
596
568
  }
597
569
  declare const RelationPredicateWith = "RelationPredicateWith";
598
- declare function isRelationPredicateWith(item: unknown): item is RelationPredicateWith;
599
570
  interface RelationshipKind extends AstNode {
600
571
  readonly $container: SpecificationRelationshipKind;
601
572
  readonly $type: 'RelationshipKind';
@@ -630,7 +601,6 @@ interface SpecificationColor extends AstNode {
630
601
  name: CustomColor;
631
602
  }
632
603
  declare const SpecificationColor = "SpecificationColor";
633
- declare function isSpecificationColor(item: unknown): item is SpecificationColor;
634
604
  interface SpecificationElementKind extends AstNode {
635
605
  readonly $container: SpecificationRule;
636
606
  readonly $type: 'SpecificationElementKind';
@@ -638,7 +608,6 @@ interface SpecificationElementKind extends AstNode {
638
608
  props: Array<ElementStyleProperty | SpecificationElementStringProperty>;
639
609
  }
640
610
  declare const SpecificationElementKind = "SpecificationElementKind";
641
- declare function isSpecificationElementKind(item: unknown): item is SpecificationElementKind;
642
611
  interface SpecificationElementStringProperty extends AstNode {
643
612
  readonly $container: SpecificationElementKind;
644
613
  readonly $type: 'SpecificationElementStringProperty';
@@ -653,7 +622,6 @@ interface SpecificationRelationshipKind extends AstNode {
653
622
  props: Array<RelationshipStyleProperty | SpecificationRelationshipStringProperty>;
654
623
  }
655
624
  declare const SpecificationRelationshipKind = "SpecificationRelationshipKind";
656
- declare function isSpecificationRelationshipKind(item: unknown): item is SpecificationRelationshipKind;
657
625
  interface SpecificationRelationshipStringProperty extends AstNode {
658
626
  readonly $container: SpecificationRelationshipKind;
659
627
  readonly $type: 'SpecificationRelationshipStringProperty';
@@ -671,14 +639,12 @@ interface SpecificationRule extends AstNode {
671
639
  tags: Array<SpecificationTag>;
672
640
  }
673
641
  declare const SpecificationRule = "SpecificationRule";
674
- declare function isSpecificationRule(item: unknown): item is SpecificationRule;
675
642
  interface SpecificationTag extends AstNode {
676
643
  readonly $container: SpecificationRule;
677
644
  readonly $type: 'SpecificationTag';
678
645
  tag: Tag;
679
646
  }
680
647
  declare const SpecificationTag = "SpecificationTag";
681
- declare function isSpecificationTag(item: unknown): item is SpecificationTag;
682
648
  interface Tag extends AstNode {
683
649
  readonly $container: SpecificationTag;
684
650
  readonly $type: 'Tag';
@@ -692,7 +658,6 @@ interface Tags extends AstNode {
692
658
  values: Array<Reference<Tag>>;
693
659
  }
694
660
  declare const Tags = "Tags";
695
- declare function isTags(item: unknown): item is Tags;
696
661
  interface ViewRef extends AstNode {
697
662
  readonly $container: NavigateToProperty;
698
663
  readonly $type: 'ViewRef';
@@ -1046,7 +1011,7 @@ interface ParsedLikeC4LangiumDocument extends Omit<LangiumDocument<LikeC4Grammar
1046
1011
  }
1047
1012
  type Guard<N extends AstNode> = (n: AstNode) => n is N;
1048
1013
  type Guarded<G> = G extends Guard<infer N> ? N : never;
1049
- declare const isValidatableAstNode: (n: AstNode) => n is Guarded<typeof isRelation | typeof isExtendElement | typeof isElement | typeof isLikeC4View | typeof isGlobals | typeof isGlobalPredicateGroup | typeof isGlobalDynamicPredicateGroup | typeof isGlobalStyle | typeof isGlobalStyleGroup | typeof isDynamicViewPredicateIterator | typeof isElementPredicateWith | typeof isRelationPredicateWith | typeof isElementExpression | typeof isRelationExpression | typeof isDynamicViewParallelSteps | typeof isDynamicViewStep | typeof isViewProperty | typeof isStyleProperty | typeof isTags | typeof isViewRule | typeof isDynamicViewRule | typeof isElementViewBody | typeof isDynamicViewBody | typeof isRelationProperty | typeof isRelationBody | typeof isElementProperty | typeof isElementBody | typeof isExtendElementBody | typeof isSpecificationElementKind | typeof isSpecificationRelationshipKind | typeof isSpecificationTag | typeof isSpecificationColor | typeof isSpecificationRule | typeof isModelViews | typeof isModel>;
1014
+ declare const isValidatableAstNode: (n: AstNode) => n is RelationStyleProperty | SpecificationRelationshipKind | DynamicViewStep | RelationPredicateWith | DynamicViewBody | DynamicViewParallelSteps | DynamicView | ModelViews | ExcludePredicate | IncludePredicate | ElementViewBody | GlobalPredicateGroup | ViewRuleGroup | ElementView | Globals | RelationBody | Relation | ElementBody | ExtendElementBody | Model | Element | ExtendElement | SpecificationRule | BorderProperty | ElementStyleProperty | GlobalStyle | ViewRuleStyle | ElementPredicateWith | DynamicViewPredicateIterator | DynamicViewIncludePredicate | GlobalDynamicPredicateGroup | SpecificationElementKind | GlobalStyleGroup | ColorProperty | SpecificationColor | DirectedRelationExpression | DynamicViewGlobalPredicateRef | RelationNavigateToProperty | ViewRuleAutoLayout | ViewRuleGlobalStyle | ElementDescedantsExpression | IncomingRelationExpression | OutgoingRelationExpression | InOutRelationExpression | ElementKindExpression | ElementRef | ElementTagExpression | ExpandElementExpression | WildcardExpression | ElementStringProperty | IconProperty | LinkProperty | MetadataBody | OpacityProperty | RelationStringProperty | ShapeProperty | SpecificationTag | ViewStringProperty | Tags | ViewRuleGlobalPredicateRef;
1050
1015
  type ValidatableAstNode = Guarded<typeof isValidatableAstNode>;
1051
1016
  declare function checksFromDiagnostics(doc: LikeC4LangiumDocument): {
1052
1017
  isValid: (n: ValidatableAstNode) => boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@likec4/language-server",
3
3
  "description": "LikeC4 Language Server",
4
- "version": "1.17.0",
4
+ "version": "1.17.1",
5
5
  "license": "MIT",
6
6
  "bugs": "https://github.com/likec4/likec4/issues",
7
7
  "homepage": "https://likec4.dev",
@@ -112,20 +112,20 @@
112
112
  },
113
113
  "dependencies": {
114
114
  "@dagrejs/dagre": "^1.1.4",
115
- "@likec4/core": "1.17.0",
116
- "@likec4/log": "1.17.0",
115
+ "@likec4/core": "1.17.1",
116
+ "@likec4/log": "1.17.1",
117
117
  "@msgpack/msgpack": "^3.0.0-beta2",
118
118
  "@smithy/util-base64": "^3.0.0",
119
119
  "fast-equals": "^5.0.1",
120
120
  "indent-string": "^5.0.0",
121
121
  "json5": "^2.2.3",
122
- "langium": "3.2.0",
122
+ "langium": "3.3.0",
123
123
  "object-hash": "^3.0.0",
124
124
  "p-debounce": "^4.0.0",
125
- "remeda": "^2.16.0",
125
+ "remeda": "^2.17.3",
126
126
  "string-hash": "^1.1.3",
127
127
  "strip-indent": "^4.0.0",
128
- "type-fest": "4.26.1",
128
+ "type-fest": "4.27.1",
129
129
  "ufo": "^1.5.4",
130
130
  "vscode-jsonrpc": "8.2.0",
131
131
  "vscode-languageserver": "9.0.1",
@@ -133,20 +133,20 @@
133
133
  "vscode-uri": "3.0.8"
134
134
  },
135
135
  "devDependencies": {
136
- "@likec4/icons": "1.17.0",
137
- "@likec4/tsconfig": "1.17.0",
138
- "@types/node": "^20.16.14",
136
+ "@likec4/icons": "1.17.1",
137
+ "@likec4/tsconfig": "1.17.1",
138
+ "@types/node": "^20.17.7",
139
139
  "@types/object-hash": "^3.0.6",
140
140
  "@types/string-hash": "^1.1.3",
141
141
  "@vitest/coverage-v8": "^2.1.5",
142
142
  "execa": "^9.3.1",
143
- "langium-cli": "3.2.0",
144
- "npm-run-all2": "^6.2.6",
143
+ "langium-cli": "3.3.0",
144
+ "npm-run-all2": "^7.0.1",
145
145
  "tsx": "~4.9.3",
146
- "turbo": "^2.2.3",
147
- "typescript": "^5.6.3",
146
+ "turbo": "^2.3.1",
147
+ "typescript": "^5.7.2",
148
148
  "unbuild": "^3.0.0-rc.11",
149
149
  "vitest": "^2.1.5"
150
150
  },
151
- "packageManager": "yarn@4.5.1"
151
+ "packageManager": "yarn@4.5.3"
152
152
  }
@@ -1,5 +1,6 @@
1
1
  import { type AstNode, GrammarUtils } from 'langium'
2
2
  import { AbstractFormatter, Formatting, type NodeFormatter } from 'langium/lsp'
3
+ import { filter, isTruthy } from 'remeda'
3
4
  import * as ast from '../generated/ast'
4
5
  import * as utils from './utils'
5
6
 
@@ -19,7 +20,7 @@ export class LikeC4Formatter extends AbstractFormatter {
19
20
 
20
21
  // Specification
21
22
  this.formatSpecificationRule(node)
22
-
23
+
23
24
  // Globals
24
25
  this.formatGlobals(node)
25
26
 
@@ -27,7 +28,7 @@ export class LikeC4Formatter extends AbstractFormatter {
27
28
  this.formatElementDeclaration(node)
28
29
  this.formatRelation(node)
29
30
  this.formatMetadataProperty(node)
30
-
31
+
31
32
  // Views
32
33
  this.formatView(node)
33
34
  this.formatViewRuleGroup(node)
@@ -36,7 +37,7 @@ export class LikeC4Formatter extends AbstractFormatter {
36
37
  this.formatWhereExpression(node)
37
38
  this.formatAutolayoutProperty(node)
38
39
  this.formatWithPredicate(node)
39
-
40
+
40
41
  // Common
41
42
  this.formatViewRuleStyle(node)
42
43
  this.formatLeafProperty(node)
@@ -64,7 +65,11 @@ export class LikeC4Formatter extends AbstractFormatter {
64
65
  f.keywords(']->').prepend(FormattingOptions.noSpace)
65
66
  f.keywords('-[').append(FormattingOptions.noSpace)
66
67
 
67
- f.properties('target', 'title', 'technology', 'tags').prepend(FormattingOptions.oneSpace)
68
+ f.nodes(...filter([
69
+ n.target,
70
+ n.tags
71
+ ], isTruthy)).prepend(FormattingOptions.oneSpace)
72
+ f.properties('title', 'technology').prepend(FormattingOptions.oneSpace)
68
73
  })
69
74
 
70
75
  this.on(node, ast.isDynamicViewStep, (n, f) => {
@@ -1,5 +1,5 @@
1
1
  /******************************************************************************
2
- * This file was generated by langium-cli 3.2.0.
2
+ * This file was generated by langium-cli 3.3.0.
3
3
  * DO NOT EDIT MANUALLY!
4
4
  ******************************************************************************/
5
5
 
@@ -1,5 +1,5 @@
1
1
  /******************************************************************************
2
- * This file was generated by langium-cli 3.2.0.
2
+ * This file was generated by langium-cli 3.3.0.
3
3
  * DO NOT EDIT MANUALLY!
4
4
  ******************************************************************************/
5
5
 
@@ -1,5 +1,5 @@
1
1
  /******************************************************************************
2
- * This file was generated by langium-cli 3.2.0.
2
+ * This file was generated by langium-cli 3.3.0.
3
3
  * DO NOT EDIT MANUALLY!
4
4
  ******************************************************************************/
5
5
 
@@ -10,7 +10,8 @@ import { LikeC4Grammar } from './grammar';
10
10
  export const LikeC4LanguageMetaData = {
11
11
  languageId: 'likec4',
12
12
  fileExtensions: ['.c4', '.likec4', '.like-c4'],
13
- caseInsensitive: false
13
+ caseInsensitive: false,
14
+ mode: 'production'
14
15
  } as const satisfies LanguageMetaData;
15
16
 
16
17
  export const parserConfig: IParserConfig = {
@@ -91,7 +91,12 @@ export class DynamicViewComputeCtx {
91
91
  title,
92
92
  relations,
93
93
  tags,
94
- navigateTo: derivedNavigateTo
94
+ navigateTo: derivedNavigateTo,
95
+ head,
96
+ tail,
97
+ color,
98
+ line,
99
+ notation
95
100
  } = this.findRelations(source, target)
96
101
 
97
102
  const navigateTo = isTruthy(stepNavigateTo) && stepNavigateTo !== this.view.id ? stepNavigateTo : derivedNavigateTo
@@ -105,7 +110,12 @@ export class DynamicViewComputeCtx {
105
110
  relations: relations ?? [],
106
111
  isBackward: isBackward ?? false,
107
112
  ...(navigateTo ? { navigateTo } : {}),
108
- ...(tags ? { tags } : {})
113
+ ...(tags ? { tags } : {}),
114
+ ...(head ? { head } : {}),
115
+ ...(tail ? { tail } : {}),
116
+ ...(color ? { color } : {}),
117
+ ...(line ? { line } : {}),
118
+ ...(notation ? { notation } : {})
109
119
  })
110
120
  }
111
121
 
@@ -230,6 +240,11 @@ export class DynamicViewComputeCtx {
230
240
  tags: NonEmptyArray<Tag> | null
231
241
  relations: NonEmptyArray<RelationID> | null
232
242
  navigateTo: ViewID | null
243
+ tail: RelationshipArrowType | null
244
+ head: RelationshipArrowType | null
245
+ color: Color | null
246
+ line: RelationshipLineType | null
247
+ notation: string | null
233
248
  } {
234
249
  const relationships = unique(this.graph.edgesBetween(source, target).flatMap(e => e.relations))
235
250
  if (relationships.length === 0) {
@@ -237,7 +252,12 @@ export class DynamicViewComputeCtx {
237
252
  title: null,
238
253
  tags: null,
239
254
  relations: null,
240
- navigateTo: null
255
+ navigateTo: null,
256
+ tail: null,
257
+ head: null,
258
+ color: null,
259
+ line: null,
260
+ notation: null
241
261
  }
242
262
  }
243
263
  const alltags = pipe(
@@ -252,16 +272,6 @@ export class DynamicViewComputeCtx {
252
272
  // Most closest relation
253
273
  const relation = only(relationships) || relationships.find(r => r.source === source.id && r.target === target.id)
254
274
 
255
- // This edge represents mutliple relations
256
- // We use label if only it is the same for all relations
257
- const title = isTruthy(relation?.title) ? relation.title : pipe(
258
- relationships,
259
- map(r => r.title),
260
- filter(isTruthy),
261
- unique(),
262
- only()
263
- )
264
-
265
275
  const navigateTo = !!relation?.navigateTo && relation.navigateTo !== this.view.id ? relation.navigateTo : pipe(
266
276
  relationships,
267
277
  map(r => r.navigateTo),
@@ -271,11 +281,33 @@ export class DynamicViewComputeCtx {
271
281
  only()
272
282
  )
273
283
 
284
+ const commonProperties = relationships.reduce((acc, r) => {
285
+ isTruthy(r.title) && acc.title.push(r.title)
286
+ isTruthy(r.tail) && acc.tail.push(r.tail)
287
+ isTruthy(r.head) && acc.head.push(r.head)
288
+ isTruthy(r.color) && acc.color.push(r.color)
289
+ isTruthy(r.line) && acc.line.push(r.line)
290
+
291
+ return acc
292
+ }, {
293
+ title: [] as string[],
294
+ tail: [] as RelationshipArrowType[],
295
+ head: [] as RelationshipArrowType[],
296
+ color: [] as Color[],
297
+ line: [] as RelationshipLineType[],
298
+ notation: [] as string[]
299
+ })
300
+
274
301
  return {
275
- title: title ?? null,
276
302
  tags,
277
303
  relations,
278
- navigateTo: navigateTo ?? null
304
+ navigateTo: navigateTo ?? null,
305
+ title: pipe(commonProperties.title, unique(), only()) ?? null,
306
+ tail: pipe(commonProperties.tail, unique(), only()) ?? null,
307
+ head: pipe(commonProperties.head, unique(), only()) ?? null,
308
+ color: pipe(commonProperties.color, unique(), only()) ?? null,
309
+ line: pipe(commonProperties.line, unique(), only()) ?? null,
310
+ notation: pipe(commonProperties.notation, unique(), only()) ?? null
279
311
  }
280
312
  }
281
313
  }