@likec4/language-server 1.20.0 → 1.20.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -0
- package/bin/likec4-language-server.mjs +5 -0
- package/dist/LikeC4FileSystem.js +9 -9
- package/dist/Rpc.d.ts +2 -4
- package/dist/Rpc.js +27 -36
- package/dist/ast.d.ts +1 -0
- package/dist/ast.js +5 -1
- package/dist/bundled.mjs +5924 -0
- package/dist/formatting/LikeC4Formatter.d.ts +9 -0
- package/dist/formatting/LikeC4Formatter.js +131 -14
- package/dist/generated/ast.d.ts +13 -2
- package/dist/generated/ast.js +18 -1
- package/dist/generated/grammar.js +1 -1
- package/dist/lsp/CompletionProvider.js +11 -3
- package/dist/model/deployments-index.d.ts +2 -1
- package/dist/model/deployments-index.js +3 -10
- package/dist/model/fqn-index.d.ts +2 -1
- package/dist/model/fqn-index.js +24 -17
- package/dist/model/model-builder.d.ts +2 -1
- package/dist/model/model-builder.js +32 -30
- package/dist/model/model-parser.d.ts +1 -1
- package/dist/model/model-parser.js +9 -6
- package/dist/model/parser/PredicatesParser.js +7 -1
- package/dist/utils/disposable.d.ts +8 -0
- package/dist/utils/disposable.js +25 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/validation/_shared.js +4 -1
- package/dist/validation/index.d.ts +2 -2
- package/dist/validation/index.js +4 -1
- package/dist/validation/specification.d.ts +1 -0
- package/dist/validation/specification.js +30 -0
- package/package.json +33 -27
- package/src/LikeC4FileSystem.ts +14 -13
- package/src/Rpc.ts +28 -38
- package/src/ast.ts +6 -1
- package/src/formatting/LikeC4Formatter.ts +198 -17
- package/src/generated/ast.ts +35 -2
- package/src/generated/grammar.ts +1 -1
- package/src/like-c4.langium +14 -3
- package/src/lsp/CompletionProvider.ts +27 -18
- package/src/model/deployments-index.ts +4 -17
- package/src/model/fqn-index.ts +26 -19
- package/src/model/model-builder.ts +32 -31
- package/src/model/model-parser.ts +14 -11
- package/src/model/parser/PredicatesParser.ts +30 -24
- package/src/utils/disposable.ts +30 -0
- package/src/utils/index.ts +1 -0
- package/src/validation/_shared.ts +5 -2
- package/src/validation/index.ts +6 -2
- package/src/validation/specification.ts +34 -0
- package/contrib/likec4.tmLanguage.json +0 -73
- package/dist/like-c4.langium +0 -852
package/src/generated/ast.ts
CHANGED
|
@@ -71,6 +71,7 @@ export type LikeC4KeywordNames =
|
|
|
71
71
|
| "exclude"
|
|
72
72
|
| "extend"
|
|
73
73
|
| "extends"
|
|
74
|
+
| "false"
|
|
74
75
|
| "global"
|
|
75
76
|
| "gray"
|
|
76
77
|
| "green"
|
|
@@ -90,6 +91,7 @@ export type LikeC4KeywordNames =
|
|
|
90
91
|
| "metadata"
|
|
91
92
|
| "mobile"
|
|
92
93
|
| "model"
|
|
94
|
+
| "multiple"
|
|
93
95
|
| "muted"
|
|
94
96
|
| "navigateTo"
|
|
95
97
|
| "node"
|
|
@@ -130,6 +132,7 @@ export type LikeC4KeywordNames =
|
|
|
130
132
|
| "target"
|
|
131
133
|
| "technology"
|
|
132
134
|
| "title"
|
|
135
|
+
| "true"
|
|
133
136
|
| "vee"
|
|
134
137
|
| "view"
|
|
135
138
|
| "views"
|
|
@@ -146,6 +149,12 @@ export function isArrowType(item: unknown): item is ArrowType {
|
|
|
146
149
|
return item === 'none' || item === 'normal' || item === 'onormal' || item === 'dot' || item === 'odot' || item === 'diamond' || item === 'odiamond' || item === 'crow' || item === 'open' || item === 'vee';
|
|
147
150
|
}
|
|
148
151
|
|
|
152
|
+
export type Boolean = boolean;
|
|
153
|
+
|
|
154
|
+
export function isBoolean(item: unknown): item is Boolean {
|
|
155
|
+
return typeof item === 'boolean';
|
|
156
|
+
}
|
|
157
|
+
|
|
149
158
|
export type BorderStyleValue = 'none' | LineOptions;
|
|
150
159
|
|
|
151
160
|
export function isBorderStyleValue(item: unknown): item is BorderStyleValue {
|
|
@@ -384,7 +393,7 @@ export function isStringProperty(item: unknown): item is StringProperty {
|
|
|
384
393
|
return reflection.isInstance(item, StringProperty);
|
|
385
394
|
}
|
|
386
395
|
|
|
387
|
-
export type StyleProperty = BorderProperty | ColorProperty | IconProperty | OpacityProperty | ShapeProperty;
|
|
396
|
+
export type StyleProperty = BorderProperty | ColorProperty | IconProperty | MultipleProperty | OpacityProperty | ShapeProperty;
|
|
388
397
|
|
|
389
398
|
export const StyleProperty = 'StyleProperty';
|
|
390
399
|
|
|
@@ -1463,6 +1472,19 @@ export function isModelViews(item: unknown): item is ModelViews {
|
|
|
1463
1472
|
return reflection.isInstance(item, ModelViews);
|
|
1464
1473
|
}
|
|
1465
1474
|
|
|
1475
|
+
export interface MultipleProperty extends AstNode {
|
|
1476
|
+
readonly $container: CustomElementProperties | DeploymentViewRuleStyle | ElementStyleProperty | GlobalStyle | ViewRuleStyle;
|
|
1477
|
+
readonly $type: 'MultipleProperty';
|
|
1478
|
+
key: 'multiple';
|
|
1479
|
+
value: Boolean;
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
export const MultipleProperty = 'MultipleProperty';
|
|
1483
|
+
|
|
1484
|
+
export function isMultipleProperty(item: unknown): item is MultipleProperty {
|
|
1485
|
+
return reflection.isInstance(item, MultipleProperty);
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1466
1488
|
export interface NavigateToProperty extends AstNode {
|
|
1467
1489
|
readonly $container: CustomElementProperties;
|
|
1468
1490
|
readonly $type: 'NavigateToProperty';
|
|
@@ -2135,6 +2157,7 @@ export type LikeC4AstType = {
|
|
|
2135
2157
|
Model: Model
|
|
2136
2158
|
ModelDeployments: ModelDeployments
|
|
2137
2159
|
ModelViews: ModelViews
|
|
2160
|
+
MultipleProperty: MultipleProperty
|
|
2138
2161
|
NavigateToProperty: NavigateToProperty
|
|
2139
2162
|
NotationProperty: NotationProperty
|
|
2140
2163
|
NotesProperty: NotesProperty
|
|
@@ -2206,7 +2229,7 @@ export type LikeC4AstType = {
|
|
|
2206
2229
|
export class LikeC4AstReflection extends AbstractAstReflection {
|
|
2207
2230
|
|
|
2208
2231
|
getAllTypes(): string[] {
|
|
2209
|
-
return [ArrowProperty, BorderProperty, ColorProperty, CustomColor, CustomElementProperties, CustomRelationProperties, DeployedInstance, DeployedInstanceBody, DeploymentElement, DeploymentNode, DeploymentNodeBody, DeploymentNodeKind, DeploymentNodeOrElementKind, DeploymentRelation, DeploymentRelationBody, DeploymentView, DeploymentViewBody, DeploymentViewRule, DeploymentViewRulePredicate, DeploymentViewRulePredicateExpression, DeploymentViewRuleStyle, DirectedRelationExpr, DirectedRelationExpression, DynamicView, DynamicViewBody, DynamicViewGlobalPredicateRef, DynamicViewIncludePredicate, DynamicViewParallelSteps, DynamicViewPredicateIterator, DynamicViewRef, DynamicViewRule, DynamicViewStep, Element, ElementBody, ElementDescedantsExpression, ElementExpression, ElementExpressionsIterator, ElementKind, ElementKindExpression, ElementPredicate, ElementPredicateOrWhere, ElementPredicateWhere, ElementPredicateWith, ElementProperty, ElementRef, ElementStringProperty, ElementStyleProperty, ElementTagExpression, ElementView, ElementViewBody, ElementViewRef, ExcludePredicate, ExpandElementExpression, ExpressionV2, ExtendElement, ExtendElementBody, FqnElementRef, FqnExpr, FqnExpressions, FqnRef, FqnRefExpr, FqnReferenceable, GlobalDynamicPredicateGroup, GlobalPredicateGroup, GlobalStyle, GlobalStyleGroup, GlobalStyleId, Globals, IconProperty, InOutRelationExpr, InOutRelationExpression, IncludePredicate, IncomingRelationExpr, IncomingRelationExpression, LibIcon, LikeC4Grammar, LikeC4Lib, LikeC4View, LineProperty, LinkProperty, MetadataAttribute, MetadataBody, MetadataProperty, Model, ModelDeployments, ModelViews, NavigateToProperty, NotationProperty, NotesProperty, OpacityProperty, OutgoingRelationExpr, OutgoingRelationExpression, Predicate, Predicates, Referenceable, Relation, RelationBody, RelationExpr, RelationExpression, RelationNavigateToProperty, RelationPredicate, RelationPredicateOrWhere, RelationPredicateOrWhereV2, RelationPredicateWhere, RelationPredicateWhereV2, RelationPredicateWith, RelationProperty, RelationStringProperty, RelationStyleProperty, RelationshipKind, RelationshipStyleProperty, ShapeProperty, SpecificationColor, SpecificationDeploymentNodeKind, SpecificationElementKind, SpecificationElementStringProperty, SpecificationRelationshipKind, SpecificationRelationshipStringProperty, SpecificationRule, SpecificationTag, StringProperty, StyleProperty, Tag, Tags, ViewProperty, ViewRef, ViewRule, ViewRuleAutoLayout, ViewRuleGlobalPredicateRef, ViewRuleGlobalStyle, ViewRuleGroup, ViewRulePredicate, ViewRuleStyle, ViewRuleStyleOrGlobalRef, ViewStringProperty, WhereBinaryExpression, WhereElement, WhereElementExpression, WhereElementKind, WhereElementNegation, WhereElementTag, WhereExpression, WhereKindEqual, WhereRelation, WhereRelationExpression, WhereRelationKind, WhereRelationNegation, WhereRelationParticipantKind, WhereRelationParticipantTag, WhereRelationTag, WhereTagEqual, WildcardExpression];
|
|
2232
|
+
return [ArrowProperty, BorderProperty, ColorProperty, CustomColor, CustomElementProperties, CustomRelationProperties, DeployedInstance, DeployedInstanceBody, DeploymentElement, DeploymentNode, DeploymentNodeBody, DeploymentNodeKind, DeploymentNodeOrElementKind, DeploymentRelation, DeploymentRelationBody, DeploymentView, DeploymentViewBody, DeploymentViewRule, DeploymentViewRulePredicate, DeploymentViewRulePredicateExpression, DeploymentViewRuleStyle, DirectedRelationExpr, DirectedRelationExpression, DynamicView, DynamicViewBody, DynamicViewGlobalPredicateRef, DynamicViewIncludePredicate, DynamicViewParallelSteps, DynamicViewPredicateIterator, DynamicViewRef, DynamicViewRule, DynamicViewStep, Element, ElementBody, ElementDescedantsExpression, ElementExpression, ElementExpressionsIterator, ElementKind, ElementKindExpression, ElementPredicate, ElementPredicateOrWhere, ElementPredicateWhere, ElementPredicateWith, ElementProperty, ElementRef, ElementStringProperty, ElementStyleProperty, ElementTagExpression, ElementView, ElementViewBody, ElementViewRef, ExcludePredicate, ExpandElementExpression, ExpressionV2, ExtendElement, ExtendElementBody, FqnElementRef, FqnExpr, FqnExpressions, FqnRef, FqnRefExpr, FqnReferenceable, GlobalDynamicPredicateGroup, GlobalPredicateGroup, GlobalStyle, GlobalStyleGroup, GlobalStyleId, Globals, IconProperty, InOutRelationExpr, InOutRelationExpression, IncludePredicate, IncomingRelationExpr, IncomingRelationExpression, LibIcon, LikeC4Grammar, LikeC4Lib, LikeC4View, LineProperty, LinkProperty, MetadataAttribute, MetadataBody, MetadataProperty, Model, ModelDeployments, ModelViews, MultipleProperty, NavigateToProperty, NotationProperty, NotesProperty, OpacityProperty, OutgoingRelationExpr, OutgoingRelationExpression, Predicate, Predicates, Referenceable, Relation, RelationBody, RelationExpr, RelationExpression, RelationNavigateToProperty, RelationPredicate, RelationPredicateOrWhere, RelationPredicateOrWhereV2, RelationPredicateWhere, RelationPredicateWhereV2, RelationPredicateWith, RelationProperty, RelationStringProperty, RelationStyleProperty, RelationshipKind, RelationshipStyleProperty, ShapeProperty, SpecificationColor, SpecificationDeploymentNodeKind, SpecificationElementKind, SpecificationElementStringProperty, SpecificationRelationshipKind, SpecificationRelationshipStringProperty, SpecificationRule, SpecificationTag, StringProperty, StyleProperty, Tag, Tags, ViewProperty, ViewRef, ViewRule, ViewRuleAutoLayout, ViewRuleGlobalPredicateRef, ViewRuleGlobalStyle, ViewRuleGroup, ViewRulePredicate, ViewRuleStyle, ViewRuleStyleOrGlobalRef, ViewStringProperty, WhereBinaryExpression, WhereElement, WhereElementExpression, WhereElementKind, WhereElementNegation, WhereElementTag, WhereExpression, WhereKindEqual, WhereRelation, WhereRelationExpression, WhereRelationKind, WhereRelationNegation, WhereRelationParticipantKind, WhereRelationParticipantTag, WhereRelationTag, WhereTagEqual, WildcardExpression];
|
|
2210
2233
|
}
|
|
2211
2234
|
|
|
2212
2235
|
protected override computeIsSubtype(subtype: string, supertype: string): boolean {
|
|
@@ -2216,6 +2239,7 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
2216
2239
|
return this.isSubtype(RelationshipStyleProperty, supertype);
|
|
2217
2240
|
}
|
|
2218
2241
|
case BorderProperty:
|
|
2242
|
+
case MultipleProperty:
|
|
2219
2243
|
case OpacityProperty:
|
|
2220
2244
|
case ShapeProperty: {
|
|
2221
2245
|
return this.isSubtype(StyleProperty, supertype);
|
|
@@ -3129,6 +3153,15 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
3129
3153
|
]
|
|
3130
3154
|
};
|
|
3131
3155
|
}
|
|
3156
|
+
case MultipleProperty: {
|
|
3157
|
+
return {
|
|
3158
|
+
name: MultipleProperty,
|
|
3159
|
+
properties: [
|
|
3160
|
+
{ name: 'key' },
|
|
3161
|
+
{ name: 'value' }
|
|
3162
|
+
]
|
|
3163
|
+
};
|
|
3164
|
+
}
|
|
3132
3165
|
case NavigateToProperty: {
|
|
3133
3166
|
return {
|
|
3134
3167
|
name: NavigateToProperty,
|