@likec4/language-server 1.39.4 → 1.40.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/dist/ast.d.ts +1 -0
- package/dist/bundled.mjs +3304 -3292
- package/dist/formatting/LikeC4Formatter.mjs +13 -8
- package/dist/generated/ast.d.ts +18 -3
- package/dist/generated/ast.mjs +26 -2
- package/dist/generated/grammar.mjs +1 -1
- package/dist/lsp/CompletionProvider.mjs +34 -3
- package/dist/lsp/SemanticTokenProvider.mjs +1 -1
- package/dist/model/builder/buildModel.mjs +2 -1
- package/dist/model/parser/ViewsParser.mjs +3 -1
- package/dist/validation/{dynamic-view-step.d.ts → dynamic-view.d.ts} +2 -1
- package/dist/validation/{dynamic-view-step.mjs → dynamic-view.mjs} +19 -0
- package/dist/validation/index.d.ts +1 -1
- package/dist/validation/index.mjs +4 -2
- package/package.json +9 -9
|
@@ -427,14 +427,19 @@ export class LikeC4Formatter extends AbstractFormatter {
|
|
|
427
427
|
return (command, edits) => {
|
|
428
428
|
const quotesToReplace = quoteStyle === "single" ? '"' : "'";
|
|
429
429
|
const quotesToInsert = quoteStyle === "single" ? "'" : '"';
|
|
430
|
-
const
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
430
|
+
const markdownFence = quotesToInsert.repeat(3);
|
|
431
|
+
const plainFence = quotesToInsert;
|
|
432
|
+
const newEdits = command.region.nodes.map((node) => {
|
|
433
|
+
const fence = node.text.startsWith(`"""`) || node.text.startsWith(`'''`) ? markdownFence : plainFence;
|
|
434
|
+
return {
|
|
435
|
+
range: node.range,
|
|
436
|
+
newText: fence + this.escapeQuotesInternalQuotes(
|
|
437
|
+
node.text.slice(fence.length, -fence.length),
|
|
438
|
+
quotesToReplace,
|
|
439
|
+
quotesToInsert
|
|
440
|
+
) + fence
|
|
441
|
+
};
|
|
442
|
+
});
|
|
438
443
|
edits.push(...newEdits);
|
|
439
444
|
};
|
|
440
445
|
}
|
package/dist/generated/ast.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export declare const LikeC4Terminals: {
|
|
|
29
29
|
Hex: RegExp;
|
|
30
30
|
};
|
|
31
31
|
export type LikeC4TerminalNames = keyof typeof LikeC4Terminals;
|
|
32
|
-
export type LikeC4KeywordNames = "(" | ")" | "*" | "," | "->" | "-[" | ":" | ";" | "<-" | "<->" | "BottomTop" | "LeftRight" | "RightLeft" | "TopBottom" | "]->" | "amber" | "and" | "autoLayout" | "blue" | "border" | "browser" | "color" | "crow" | "cylinder" | "dashed" | "deployment" | "deploymentNode" | "description" | "diamond" | "dot" | "dotted" | "dynamic" | "dynamicPredicateGroup" | "element" | "element.kind" | "element.tag" | "exclude" | "extend" | "extends" | "from" | "global" | "gray" | "green" | "group" | "head" | "icon" | "icons" | "import" | "include" | "indigo" | "instance" | "instanceOf" | "is" | "kind" | "large" | "lg" | "likec4lib" | "line" | "link" | "md" | "medium" | "metadata" | "mobile" | "model" | "multiple" | "muted" | "navigateTo" | "node" | "none" | "normal" | "not" | "notation" | "notes" | "odiamond" | "odot" | "of" | "onormal" | "opacity" | "open" | "or" | "padding" | "par" | "parallel" | "person" | "predicate" | "predicateGroup" | "primary" | "queue" | "rectangle" | "red" | "relationship" | "rgb" | "rgba" | "secondary" | "shape" | "size" | "sky" | "slate" | "sm" | "small" | "solid" | "source" | "specification" | "storage" | "style" | "styleGroup" | "tag" | "tail" | "target" | "technology" | "textSize" | "title" | "vee" | "view" | "views" | "where" | "with" | "xl" | "xlarge" | "xs" | "xsmall" | "{" | "}";
|
|
32
|
+
export type LikeC4KeywordNames = "(" | ")" | "*" | "," | "->" | "-[" | ":" | ";" | "<-" | "<->" | "BottomTop" | "LeftRight" | "RightLeft" | "TopBottom" | "]->" | "amber" | "and" | "autoLayout" | "blue" | "border" | "browser" | "color" | "crow" | "cylinder" | "dashed" | "deployment" | "deploymentNode" | "description" | "diagram" | "diamond" | "dot" | "dotted" | "dynamic" | "dynamicPredicateGroup" | "element" | "element.kind" | "element.tag" | "exclude" | "extend" | "extends" | "from" | "global" | "gray" | "green" | "group" | "head" | "icon" | "icons" | "import" | "include" | "indigo" | "instance" | "instanceOf" | "is" | "kind" | "large" | "lg" | "likec4lib" | "line" | "link" | "md" | "medium" | "metadata" | "mobile" | "model" | "multiple" | "muted" | "navigateTo" | "node" | "none" | "normal" | "not" | "notation" | "notes" | "odiamond" | "odot" | "of" | "onormal" | "opacity" | "open" | "or" | "padding" | "par" | "parallel" | "person" | "predicate" | "predicateGroup" | "primary" | "queue" | "rectangle" | "red" | "relationship" | "rgb" | "rgba" | "secondary" | "sequence" | "shape" | "size" | "sky" | "slate" | "sm" | "small" | "solid" | "source" | "specification" | "storage" | "style" | "styleGroup" | "tag" | "tail" | "target" | "technology" | "textSize" | "title" | "variant" | "vee" | "view" | "views" | "where" | "with" | "xl" | "xlarge" | "xs" | "xsmall" | "{" | "}";
|
|
33
33
|
export type LikeC4TokenNames = LikeC4TerminalNames | LikeC4KeywordNames;
|
|
34
34
|
export type ArrowType = 'crow' | 'diamond' | 'dot' | 'none' | 'normal' | 'odiamond' | 'odot' | 'onormal' | 'open' | 'vee';
|
|
35
35
|
export declare function isArrowType(item: unknown): item is ArrowType;
|
|
@@ -49,6 +49,11 @@ export declare function isDeploymentNodeOrElementKind(item: unknown): item is De
|
|
|
49
49
|
export type DeploymentViewRule = DeploymentViewRulePredicate | DeploymentViewRuleStyle | ViewRuleAutoLayout;
|
|
50
50
|
export declare const DeploymentViewRule = "DeploymentViewRule";
|
|
51
51
|
export declare function isDeploymentViewRule(item: unknown): item is DeploymentViewRule;
|
|
52
|
+
export type DynamicViewDisplayVariantValue = 'diagram' | 'sequence';
|
|
53
|
+
export declare function isDynamicViewDisplayVariantValue(item: unknown): item is DynamicViewDisplayVariantValue;
|
|
54
|
+
export type DynamicViewProperty = DynamicViewDisplayVariantProperty | ViewProperty;
|
|
55
|
+
export declare const DynamicViewProperty = "DynamicViewProperty";
|
|
56
|
+
export declare function isDynamicViewProperty(item: unknown): item is DynamicViewProperty;
|
|
52
57
|
export type DynamicViewRule = DynamicViewGlobalPredicateRef | DynamicViewIncludePredicate | ViewRuleAutoLayout | ViewRuleStyleOrGlobalRef;
|
|
53
58
|
export declare const DynamicViewRule = "DynamicViewRule";
|
|
54
59
|
export declare function isDynamicViewRule(item: unknown): item is DynamicViewRule;
|
|
@@ -77,7 +82,7 @@ export declare const FqnReferenceable = "FqnReferenceable";
|
|
|
77
82
|
export declare function isFqnReferenceable(item: unknown): item is FqnReferenceable;
|
|
78
83
|
export type IconId = string;
|
|
79
84
|
export declare function isIconId(item: unknown): item is IconId;
|
|
80
|
-
export type Id = 'deployment' | 'element' | 'group' | 'instance' | 'model' | 'node' | ArrowType | ElementShape | LineOptions | Participant | SizeValue | ThemeColor | string;
|
|
85
|
+
export type Id = 'deployment' | 'element' | 'group' | 'instance' | 'model' | 'node' | ArrowType | DynamicViewDisplayVariantValue | ElementShape | LineOptions | Participant | SizeValue | ThemeColor | string;
|
|
81
86
|
export declare function isId(item: unknown): item is Id;
|
|
82
87
|
export type LikeC4View = DeploymentView | DynamicView | ElementView;
|
|
83
88
|
export declare const LikeC4View = "LikeC4View";
|
|
@@ -323,13 +328,21 @@ export declare function isDynamicView(item: unknown): item is DynamicView;
|
|
|
323
328
|
export interface DynamicViewBody extends langium.AstNode {
|
|
324
329
|
readonly $container: DynamicView;
|
|
325
330
|
readonly $type: 'DynamicViewBody';
|
|
326
|
-
props: Array<
|
|
331
|
+
props: Array<DynamicViewProperty>;
|
|
327
332
|
rules: Array<DynamicViewRule>;
|
|
328
333
|
steps: Array<DynamicViewParallelSteps | DynamicViewStep>;
|
|
329
334
|
tags?: Tags;
|
|
330
335
|
}
|
|
331
336
|
export declare const DynamicViewBody = "DynamicViewBody";
|
|
332
337
|
export declare function isDynamicViewBody(item: unknown): item is DynamicViewBody;
|
|
338
|
+
export interface DynamicViewDisplayVariantProperty extends langium.AstNode {
|
|
339
|
+
readonly $container: DynamicViewBody;
|
|
340
|
+
readonly $type: 'DynamicViewDisplayVariantProperty';
|
|
341
|
+
key: 'variant';
|
|
342
|
+
value: DynamicViewDisplayVariantValue;
|
|
343
|
+
}
|
|
344
|
+
export declare const DynamicViewDisplayVariantProperty = "DynamicViewDisplayVariantProperty";
|
|
345
|
+
export declare function isDynamicViewDisplayVariantProperty(item: unknown): item is DynamicViewDisplayVariantProperty;
|
|
333
346
|
export interface DynamicViewGlobalPredicateRef extends langium.AstNode {
|
|
334
347
|
readonly $container: DynamicViewBody;
|
|
335
348
|
readonly $type: 'DynamicViewGlobalPredicateRef';
|
|
@@ -1182,9 +1195,11 @@ export type LikeC4AstType = {
|
|
|
1182
1195
|
DirectedRelationExpr: DirectedRelationExpr;
|
|
1183
1196
|
DynamicView: DynamicView;
|
|
1184
1197
|
DynamicViewBody: DynamicViewBody;
|
|
1198
|
+
DynamicViewDisplayVariantProperty: DynamicViewDisplayVariantProperty;
|
|
1185
1199
|
DynamicViewGlobalPredicateRef: DynamicViewGlobalPredicateRef;
|
|
1186
1200
|
DynamicViewIncludePredicate: DynamicViewIncludePredicate;
|
|
1187
1201
|
DynamicViewParallelSteps: DynamicViewParallelSteps;
|
|
1202
|
+
DynamicViewProperty: DynamicViewProperty;
|
|
1188
1203
|
DynamicViewRef: DynamicViewRef;
|
|
1189
1204
|
DynamicViewRule: DynamicViewRule;
|
|
1190
1205
|
DynamicViewStep: DynamicViewStep;
|
package/dist/generated/ast.mjs
CHANGED
|
@@ -49,6 +49,13 @@ export const DeploymentViewRule = "DeploymentViewRule";
|
|
|
49
49
|
export function isDeploymentViewRule(item) {
|
|
50
50
|
return reflection.isInstance(item, DeploymentViewRule);
|
|
51
51
|
}
|
|
52
|
+
export function isDynamicViewDisplayVariantValue(item) {
|
|
53
|
+
return item === "diagram" || item === "sequence";
|
|
54
|
+
}
|
|
55
|
+
export const DynamicViewProperty = "DynamicViewProperty";
|
|
56
|
+
export function isDynamicViewProperty(item) {
|
|
57
|
+
return reflection.isInstance(item, DynamicViewProperty);
|
|
58
|
+
}
|
|
52
59
|
export const DynamicViewRule = "DynamicViewRule";
|
|
53
60
|
export function isDynamicViewRule(item) {
|
|
54
61
|
return reflection.isInstance(item, DynamicViewRule);
|
|
@@ -88,7 +95,7 @@ export function isIconId(item) {
|
|
|
88
95
|
return typeof item === "string" && /(aws|azure|gcp|tech):[-\w]*/.test(item);
|
|
89
96
|
}
|
|
90
97
|
export function isId(item) {
|
|
91
|
-
return isElementShape(item) || isThemeColor(item) || isArrowType(item) || isLineOptions(item) || isParticipant(item) || isSizeValue(item) || item === "element" || item === "model" || item === "group" || item === "node" || item === "deployment" || item === "instance" || typeof item === "string" && /[_]*[a-zA-Z][-\w]*/.test(item);
|
|
98
|
+
return isElementShape(item) || isThemeColor(item) || isArrowType(item) || isLineOptions(item) || isParticipant(item) || isSizeValue(item) || isDynamicViewDisplayVariantValue(item) || item === "element" || item === "model" || item === "group" || item === "node" || item === "deployment" || item === "instance" || typeof item === "string" && /[_]*[a-zA-Z][-\w]*/.test(item);
|
|
92
99
|
}
|
|
93
100
|
export const LikeC4View = "LikeC4View";
|
|
94
101
|
export function isLikeC4View(item) {
|
|
@@ -276,6 +283,10 @@ export const DynamicViewBody = "DynamicViewBody";
|
|
|
276
283
|
export function isDynamicViewBody(item) {
|
|
277
284
|
return reflection.isInstance(item, DynamicViewBody);
|
|
278
285
|
}
|
|
286
|
+
export const DynamicViewDisplayVariantProperty = "DynamicViewDisplayVariantProperty";
|
|
287
|
+
export function isDynamicViewDisplayVariantProperty(item) {
|
|
288
|
+
return reflection.isInstance(item, DynamicViewDisplayVariantProperty);
|
|
289
|
+
}
|
|
279
290
|
export const DynamicViewGlobalPredicateRef = "DynamicViewGlobalPredicateRef";
|
|
280
291
|
export function isDynamicViewGlobalPredicateRef(item) {
|
|
281
292
|
return reflection.isInstance(item, DynamicViewGlobalPredicateRef);
|
|
@@ -678,7 +689,7 @@ export function isWildcardExpression(item) {
|
|
|
678
689
|
}
|
|
679
690
|
export class LikeC4AstReflection extends langium.AbstractAstReflection {
|
|
680
691
|
getAllTypes() {
|
|
681
|
-
return [ArrowProperty, BorderProperty, ColorLiteral, ColorProperty, CustomColor, CustomElementProperties, CustomRelationProperties, DeployedInstance, DeployedInstanceBody, DeploymentElement, DeploymentNode, DeploymentNodeBody, DeploymentNodeKind, DeploymentNodeOrElementKind, DeploymentRelation, DeploymentRelationBody, DeploymentView, DeploymentViewBody, DeploymentViewRule, DeploymentViewRulePredicate, DeploymentViewRuleStyle, DirectedRelationExpr, DynamicView, DynamicViewBody, DynamicViewGlobalPredicateRef, DynamicViewIncludePredicate, DynamicViewParallelSteps, DynamicViewRef, DynamicViewRule, DynamicViewStep, Element, ElementBody, ElementKind, ElementKindExpression, ElementProperty, ElementRef, ElementStringProperty, ElementStyleProperty, ElementTagExpression, ElementView, ElementViewBody, ElementViewRef, ExpressionV2, Expressions, ExtendDeployment, ExtendDeploymentBody, ExtendElement, ExtendElementBody, ExtendElementProperty, FqnExpr, FqnExprOrWhere, FqnExprOrWith, FqnExprWhere, FqnExprWith, FqnExpressions, FqnRef, FqnRefExpr, FqnReferenceable, GlobalDynamicPredicateGroup, GlobalPredicateGroup, GlobalStyle, GlobalStyleGroup, GlobalStyleId, Globals, HexColor, IconProperty, Imported, ImportsFromPoject, InOutRelationExpr, IncomingRelationExpr, LibIcon, LikeC4Grammar, LikeC4Lib, LikeC4View, LineProperty, LinkProperty, MarkdownOrString, MetadataAttribute, MetadataBody, MetadataProperty, Model, ModelDeployments, ModelReferenceable, ModelViews, MultipleProperty, NavigateToProperty, NotationProperty, NotesProperty, OpacityProperty, OutgoingRelationExpr, PaddingSizeProperty, RGBAColor, Referenceable, Relation, RelationBody, RelationExpr, RelationExprOrWhere, RelationExprOrWith, RelationExprWhere, RelationExprWith, RelationKindDotRef, RelationNavigateToProperty, RelationProperty, RelationStringProperty, RelationStyleProperty, RelationshipKind, RelationshipStyleProperty, ShapeProperty, ShapeSizeProperty, SizeProperty, SpecificationColor, SpecificationDeploymentNodeKind, SpecificationElementKind, SpecificationElementStringProperty, SpecificationRelationshipKind, SpecificationRelationshipStringProperty, SpecificationRule, SpecificationTag, StrictFqnElementRef, StrictFqnRef, StringProperty, StyleProperty, Tag, TagRef, Tags, TextSizeProperty, 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];
|
|
692
|
+
return [ArrowProperty, BorderProperty, ColorLiteral, ColorProperty, CustomColor, CustomElementProperties, CustomRelationProperties, DeployedInstance, DeployedInstanceBody, DeploymentElement, DeploymentNode, DeploymentNodeBody, DeploymentNodeKind, DeploymentNodeOrElementKind, DeploymentRelation, DeploymentRelationBody, DeploymentView, DeploymentViewBody, DeploymentViewRule, DeploymentViewRulePredicate, DeploymentViewRuleStyle, DirectedRelationExpr, DynamicView, DynamicViewBody, DynamicViewDisplayVariantProperty, DynamicViewGlobalPredicateRef, DynamicViewIncludePredicate, DynamicViewParallelSteps, DynamicViewProperty, DynamicViewRef, DynamicViewRule, DynamicViewStep, Element, ElementBody, ElementKind, ElementKindExpression, ElementProperty, ElementRef, ElementStringProperty, ElementStyleProperty, ElementTagExpression, ElementView, ElementViewBody, ElementViewRef, ExpressionV2, Expressions, ExtendDeployment, ExtendDeploymentBody, ExtendElement, ExtendElementBody, ExtendElementProperty, FqnExpr, FqnExprOrWhere, FqnExprOrWith, FqnExprWhere, FqnExprWith, FqnExpressions, FqnRef, FqnRefExpr, FqnReferenceable, GlobalDynamicPredicateGroup, GlobalPredicateGroup, GlobalStyle, GlobalStyleGroup, GlobalStyleId, Globals, HexColor, IconProperty, Imported, ImportsFromPoject, InOutRelationExpr, IncomingRelationExpr, LibIcon, LikeC4Grammar, LikeC4Lib, LikeC4View, LineProperty, LinkProperty, MarkdownOrString, MetadataAttribute, MetadataBody, MetadataProperty, Model, ModelDeployments, ModelReferenceable, ModelViews, MultipleProperty, NavigateToProperty, NotationProperty, NotesProperty, OpacityProperty, OutgoingRelationExpr, PaddingSizeProperty, RGBAColor, Referenceable, Relation, RelationBody, RelationExpr, RelationExprOrWhere, RelationExprOrWith, RelationExprWhere, RelationExprWith, RelationKindDotRef, RelationNavigateToProperty, RelationProperty, RelationStringProperty, RelationStyleProperty, RelationshipKind, RelationshipStyleProperty, ShapeProperty, ShapeSizeProperty, SizeProperty, SpecificationColor, SpecificationDeploymentNodeKind, SpecificationElementKind, SpecificationElementStringProperty, SpecificationRelationshipKind, SpecificationRelationshipStringProperty, SpecificationRule, SpecificationTag, StrictFqnElementRef, StrictFqnRef, StringProperty, StyleProperty, Tag, TagRef, Tags, TextSizeProperty, 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];
|
|
682
693
|
}
|
|
683
694
|
computeIsSubtype(subtype, supertype) {
|
|
684
695
|
switch (subtype) {
|
|
@@ -718,6 +729,10 @@ export class LikeC4AstReflection extends langium.AbstractAstReflection {
|
|
|
718
729
|
case OutgoingRelationExpr: {
|
|
719
730
|
return this.isSubtype(RelationExpr, supertype);
|
|
720
731
|
}
|
|
732
|
+
case DynamicViewDisplayVariantProperty:
|
|
733
|
+
case ViewProperty: {
|
|
734
|
+
return this.isSubtype(DynamicViewProperty, supertype);
|
|
735
|
+
}
|
|
721
736
|
case DynamicViewGlobalPredicateRef:
|
|
722
737
|
case DynamicViewIncludePredicate: {
|
|
723
738
|
return this.isSubtype(DynamicViewRule, supertype);
|
|
@@ -1109,6 +1124,15 @@ export class LikeC4AstReflection extends langium.AbstractAstReflection {
|
|
|
1109
1124
|
]
|
|
1110
1125
|
};
|
|
1111
1126
|
}
|
|
1127
|
+
case DynamicViewDisplayVariantProperty: {
|
|
1128
|
+
return {
|
|
1129
|
+
name: DynamicViewDisplayVariantProperty,
|
|
1130
|
+
properties: [
|
|
1131
|
+
{ name: "key" },
|
|
1132
|
+
{ name: "value" }
|
|
1133
|
+
]
|
|
1134
|
+
};
|
|
1135
|
+
}
|
|
1112
1136
|
case DynamicViewGlobalPredicateRef: {
|
|
1113
1137
|
return {
|
|
1114
1138
|
name: DynamicViewGlobalPredicateRef,
|