@likec4/language-server 1.15.1 → 1.17.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.
- package/contrib/likec4.tmLanguage.json +1 -1
- package/dist/browser.cjs +1 -1
- package/dist/browser.d.cts +2 -2
- package/dist/browser.d.mts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.mjs +2 -2
- package/dist/index.cjs +35 -5
- package/dist/index.d.cts +17 -4
- package/dist/index.d.mts +17 -4
- package/dist/index.d.ts +17 -4
- package/dist/index.mjs +34 -5
- package/dist/model-graph/index.cjs +1 -1
- package/dist/model-graph/index.d.cts +4 -2
- package/dist/model-graph/index.d.mts +4 -2
- package/dist/model-graph/index.d.ts +4 -2
- package/dist/model-graph/index.mjs +1 -1
- package/dist/shared/{language-server.BuChFlda.mjs → language-server.B8qSDsWW.mjs} +211 -96
- package/dist/shared/language-server.BGGRJRnr.d.mts +1338 -0
- package/dist/shared/{language-server.BT4WTbFI.mjs → language-server.BXFhlTPo.mjs} +139 -76
- package/dist/shared/{language-server.DfMwkd2l.d.mts → language-server.BgDKnNok.d.mts} +45 -11
- package/dist/shared/language-server.Bmpq16Gw.d.ts +1338 -0
- package/dist/shared/language-server.C1ZfM22X.d.cts +1338 -0
- package/dist/shared/{language-server.U2piOAVt.d.cts → language-server.DJo88TnT.d.cts} +45 -11
- package/dist/shared/{language-server.DfjkvknB.cjs → language-server.DZRuJVSg.cjs} +209 -94
- package/dist/shared/{language-server.B8s2wfT_.cjs → language-server.N8HLDQqz.cjs} +137 -74
- package/dist/shared/{language-server.j-ShR6as.d.ts → language-server.PEjk7U9s.d.ts} +45 -11
- package/package.json +7 -7
- package/src/LikeC4FileSystem.ts +36 -0
- package/src/Rpc.ts +2 -2
- package/src/ast.ts +11 -3
- package/src/generated/ast.ts +112 -11
- package/src/generated/grammar.ts +1 -1
- package/src/index.ts +3 -3
- package/src/like-c4.langium +20 -1
- package/src/lsp/SemanticTokenProvider.ts +26 -8
- package/src/model/fqn-computation.ts +6 -2
- package/src/model/model-builder.ts +25 -30
- package/src/model/model-parser.ts +91 -18
- package/src/model-graph/LikeC4ModelGraph.ts +22 -11
- package/src/model-graph/compute-view/__test__/fixture.ts +69 -19
- package/src/model-graph/compute-view/compute.ts +85 -73
- package/src/model-graph/dynamic-view/compute.ts +12 -2
- package/src/model-graph/utils/applyCustomElementProperties.ts +1 -3
- package/src/model-graph/utils/applyViewRuleStyles.ts +0 -4
- package/src/references/scope-computation.ts +10 -0
- package/src/validation/index.ts +3 -0
- package/src/validation/specification.ts +21 -0
- package/src/view-utils/index.ts +0 -1
- package/src/view-utils/resolve-global-rules.ts +66 -50
|
@@ -47,7 +47,7 @@ type ArrowType = 'crow' | 'diamond' | 'dot' | 'none' | 'normal' | 'odiamond' | '
|
|
|
47
47
|
type BorderStyleValue = 'none' | LineOptions;
|
|
48
48
|
type CustomColorId = 'element' | 'model' | ArrowType | ElementShape | LineOptions | string;
|
|
49
49
|
type CustomColorValue = string;
|
|
50
|
-
type DynamicViewRule = DynamicViewIncludePredicate | ViewRuleAutoLayout | ViewRuleStyleOrGlobalRef;
|
|
50
|
+
type DynamicViewRule = DynamicViewGlobalPredicateRef | DynamicViewIncludePredicate | ViewRuleAutoLayout | ViewRuleStyleOrGlobalRef;
|
|
51
51
|
declare const DynamicViewRule = "DynamicViewRule";
|
|
52
52
|
declare function isDynamicViewRule(item: unknown): item is DynamicViewRule;
|
|
53
53
|
type ElementExpression = ElementDescedantsExpression | ElementKindExpression | ElementRef | ElementTagExpression | ExpandElementExpression | WildcardExpression;
|
|
@@ -94,7 +94,7 @@ type ViewLayoutDirection = 'BottomTop' | 'LeftRight' | 'RightLeft' | 'TopBottom'
|
|
|
94
94
|
type ViewProperty = LinkProperty | ViewStringProperty;
|
|
95
95
|
declare const ViewProperty = "ViewProperty";
|
|
96
96
|
declare function isViewProperty(item: unknown): item is ViewProperty;
|
|
97
|
-
type ViewRule = ViewRuleAutoLayout | ViewRuleGroup | ViewRulePredicate | ViewRuleStyleOrGlobalRef;
|
|
97
|
+
type ViewRule = ViewRuleAutoLayout | ViewRuleGlobalPredicateRef | ViewRuleGroup | ViewRulePredicate | ViewRuleStyleOrGlobalRef;
|
|
98
98
|
declare const ViewRule = "ViewRule";
|
|
99
99
|
declare function isViewRule(item: unknown): item is ViewRule;
|
|
100
100
|
type ViewRulePredicate = ExcludePredicate | IncludePredicate;
|
|
@@ -179,8 +179,14 @@ interface DynamicViewBody extends AstNode {
|
|
|
179
179
|
}
|
|
180
180
|
declare const DynamicViewBody = "DynamicViewBody";
|
|
181
181
|
declare function isDynamicViewBody(item: unknown): item is DynamicViewBody;
|
|
182
|
-
interface
|
|
182
|
+
interface DynamicViewGlobalPredicateRef extends AstNode {
|
|
183
183
|
readonly $container: DynamicViewBody;
|
|
184
|
+
readonly $type: 'DynamicViewGlobalPredicateRef';
|
|
185
|
+
predicate: Reference<GlobalDynamicPredicateGroup>;
|
|
186
|
+
}
|
|
187
|
+
declare const DynamicViewGlobalPredicateRef = "DynamicViewGlobalPredicateRef";
|
|
188
|
+
interface DynamicViewIncludePredicate extends AstNode {
|
|
189
|
+
readonly $container: DynamicViewBody | GlobalDynamicPredicateGroup;
|
|
184
190
|
readonly $type: 'DynamicViewIncludePredicate';
|
|
185
191
|
predicates: DynamicViewPredicateIterator;
|
|
186
192
|
}
|
|
@@ -331,7 +337,7 @@ interface ElementViewRef extends AstNode {
|
|
|
331
337
|
}
|
|
332
338
|
declare const ElementViewRef = "ElementViewRef";
|
|
333
339
|
interface ExcludePredicate extends AstNode {
|
|
334
|
-
readonly $container: ElementViewBody | ViewRuleGroup;
|
|
340
|
+
readonly $container: ElementViewBody | GlobalPredicateGroup | ViewRuleGroup;
|
|
335
341
|
readonly $type: 'ExcludePredicate';
|
|
336
342
|
predicates: Predicates;
|
|
337
343
|
}
|
|
@@ -364,10 +370,27 @@ interface FqnElementRef extends AstNode {
|
|
|
364
370
|
parent?: FqnElementRef;
|
|
365
371
|
}
|
|
366
372
|
declare const FqnElementRef = "FqnElementRef";
|
|
373
|
+
interface GlobalDynamicPredicateGroup extends AstNode {
|
|
374
|
+
readonly $container: Globals;
|
|
375
|
+
readonly $type: 'GlobalDynamicPredicateGroup';
|
|
376
|
+
name: string;
|
|
377
|
+
predicates: Array<DynamicViewIncludePredicate>;
|
|
378
|
+
}
|
|
379
|
+
declare const GlobalDynamicPredicateGroup = "GlobalDynamicPredicateGroup";
|
|
380
|
+
declare function isGlobalDynamicPredicateGroup(item: unknown): item is GlobalDynamicPredicateGroup;
|
|
381
|
+
interface GlobalPredicateGroup extends AstNode {
|
|
382
|
+
readonly $container: Globals;
|
|
383
|
+
readonly $type: 'GlobalPredicateGroup';
|
|
384
|
+
name: string;
|
|
385
|
+
predicates: Array<ViewRulePredicate>;
|
|
386
|
+
}
|
|
387
|
+
declare const GlobalPredicateGroup = "GlobalPredicateGroup";
|
|
388
|
+
declare function isGlobalPredicateGroup(item: unknown): item is GlobalPredicateGroup;
|
|
367
389
|
interface Globals extends AstNode {
|
|
368
390
|
readonly $container: LikeC4Grammar;
|
|
369
391
|
readonly $type: 'Globals';
|
|
370
392
|
name: 'global';
|
|
393
|
+
predicates: Array<GlobalDynamicPredicateGroup | GlobalPredicateGroup>;
|
|
371
394
|
styles: Array<GlobalStyle | GlobalStyleGroup>;
|
|
372
395
|
}
|
|
373
396
|
declare const Globals = "Globals";
|
|
@@ -400,11 +423,11 @@ interface IconProperty extends AstNode {
|
|
|
400
423
|
readonly $type: 'IconProperty';
|
|
401
424
|
key: 'icon';
|
|
402
425
|
libicon?: Reference<LibIcon>;
|
|
403
|
-
value?: Uri;
|
|
426
|
+
value?: 'none' | Uri;
|
|
404
427
|
}
|
|
405
428
|
declare const IconProperty = "IconProperty";
|
|
406
429
|
interface IncludePredicate extends AstNode {
|
|
407
|
-
readonly $container: ElementViewBody | ViewRuleGroup;
|
|
430
|
+
readonly $container: ElementViewBody | GlobalPredicateGroup | ViewRuleGroup;
|
|
408
431
|
readonly $type: 'IncludePredicate';
|
|
409
432
|
predicates: Predicates;
|
|
410
433
|
}
|
|
@@ -684,6 +707,12 @@ interface ViewRuleAutoLayout extends AstNode {
|
|
|
684
707
|
rankSep?: number;
|
|
685
708
|
}
|
|
686
709
|
declare const ViewRuleAutoLayout = "ViewRuleAutoLayout";
|
|
710
|
+
interface ViewRuleGlobalPredicateRef extends AstNode {
|
|
711
|
+
readonly $container: ElementViewBody;
|
|
712
|
+
readonly $type: 'ViewRuleGlobalPredicateRef';
|
|
713
|
+
predicate: Reference<GlobalPredicateGroup>;
|
|
714
|
+
}
|
|
715
|
+
declare const ViewRuleGlobalPredicateRef = "ViewRuleGlobalPredicateRef";
|
|
687
716
|
interface ViewRuleGlobalStyle extends AstNode {
|
|
688
717
|
readonly $container: DynamicViewBody | ElementViewBody | ModelViews;
|
|
689
718
|
readonly $type: 'ViewRuleGlobalStyle';
|
|
@@ -780,6 +809,7 @@ type LikeC4AstType = {
|
|
|
780
809
|
DirectedRelationExpression: DirectedRelationExpression;
|
|
781
810
|
DynamicView: DynamicView;
|
|
782
811
|
DynamicViewBody: DynamicViewBody;
|
|
812
|
+
DynamicViewGlobalPredicateRef: DynamicViewGlobalPredicateRef;
|
|
783
813
|
DynamicViewIncludePredicate: DynamicViewIncludePredicate;
|
|
784
814
|
DynamicViewParallelSteps: DynamicViewParallelSteps;
|
|
785
815
|
DynamicViewPredicateIterator: DynamicViewPredicateIterator;
|
|
@@ -810,6 +840,8 @@ type LikeC4AstType = {
|
|
|
810
840
|
ExtendElement: ExtendElement;
|
|
811
841
|
ExtendElementBody: ExtendElementBody;
|
|
812
842
|
FqnElementRef: FqnElementRef;
|
|
843
|
+
GlobalDynamicPredicateGroup: GlobalDynamicPredicateGroup;
|
|
844
|
+
GlobalPredicateGroup: GlobalPredicateGroup;
|
|
813
845
|
GlobalStyle: GlobalStyle;
|
|
814
846
|
GlobalStyleGroup: GlobalStyleGroup;
|
|
815
847
|
GlobalStyleId: GlobalStyleId;
|
|
@@ -865,6 +897,7 @@ type LikeC4AstType = {
|
|
|
865
897
|
ViewRef: ViewRef;
|
|
866
898
|
ViewRule: ViewRule;
|
|
867
899
|
ViewRuleAutoLayout: ViewRuleAutoLayout;
|
|
900
|
+
ViewRuleGlobalPredicateRef: ViewRuleGlobalPredicateRef;
|
|
868
901
|
ViewRuleGlobalStyle: ViewRuleGlobalStyle;
|
|
869
902
|
ViewRuleGroup: ViewRuleGroup;
|
|
870
903
|
ViewRulePredicate: ViewRulePredicate;
|
|
@@ -960,9 +993,7 @@ interface ParsedAstRelation {
|
|
|
960
993
|
[key: string]: string;
|
|
961
994
|
};
|
|
962
995
|
}
|
|
963
|
-
|
|
964
|
-
styles: Record<c4.GlobalStyleID, c4.NonEmptyArray<c4.ViewRuleStyle>>;
|
|
965
|
-
}
|
|
996
|
+
type ParsedAstGlobals = c4.ModelGlobals;
|
|
966
997
|
interface ParsedAstElementView {
|
|
967
998
|
__: 'element';
|
|
968
999
|
id: c4.ViewID;
|
|
@@ -1015,7 +1046,7 @@ interface ParsedLikeC4LangiumDocument extends Omit<LangiumDocument<LikeC4Grammar
|
|
|
1015
1046
|
}
|
|
1016
1047
|
type Guard<N extends AstNode> = (n: AstNode) => n is N;
|
|
1017
1048
|
type Guarded<G> = G extends Guard<infer N> ? N : never;
|
|
1018
|
-
declare const isValidatableAstNode: (n: AstNode) => n is Guarded<typeof isLikeC4View | typeof isRelation | typeof isExtendElement | typeof isElement | typeof isGlobals | 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>;
|
|
1049
|
+
declare const isValidatableAstNode: (n: AstNode) => n is Guarded<typeof isLikeC4View | typeof isRelation | typeof isExtendElement | typeof isElement | 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>;
|
|
1019
1050
|
type ValidatableAstNode = Guarded<typeof isValidatableAstNode>;
|
|
1020
1051
|
declare function checksFromDiagnostics(doc: LikeC4LangiumDocument): {
|
|
1021
1052
|
isValid: (n: ValidatableAstNode) => boolean;
|
|
@@ -1135,8 +1166,10 @@ declare class LikeC4ModelParser {
|
|
|
1135
1166
|
private parseElement;
|
|
1136
1167
|
private parseRelation;
|
|
1137
1168
|
private parseGlobal;
|
|
1169
|
+
private parseAndStoreGlobalPredicateGroupOrDynamic;
|
|
1170
|
+
private parseGlobalPredicateGroup;
|
|
1171
|
+
private parseGlobalDynamicPredicateGroup;
|
|
1138
1172
|
private parseGlobalStyleOrGroup;
|
|
1139
|
-
private parseGlobalStyle;
|
|
1140
1173
|
private parseViews;
|
|
1141
1174
|
private parseViewRulePredicate;
|
|
1142
1175
|
private parsePredicate;
|
|
@@ -1150,6 +1183,7 @@ declare class LikeC4ModelParser {
|
|
|
1150
1183
|
private parseRelationPredicateWith;
|
|
1151
1184
|
private parseRelationExpr;
|
|
1152
1185
|
private parseViewRule;
|
|
1186
|
+
private parseViewRuleGlobalPredicateRef;
|
|
1153
1187
|
private parseViewRuleStyleOrGlobalRef;
|
|
1154
1188
|
private parseViewRuleStyle;
|
|
1155
1189
|
private parseViewRuleGroup;
|