@likec4/language-server 0.18.0 → 0.19.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.monarch.ts +1 -1
- package/contrib/likec4.tmLanguage.json +1 -1
- package/dist/generated/ast.d.ts +30 -3
- package/dist/generated/ast.js +42 -2
- package/dist/generated/grammar.js +424 -143
- package/dist/lsp/SemanticTokenProvider.js +27 -28
- package/dist/model/model-builder.js +14 -0
- package/package.json +2 -2
- package/dist/builtin.d.ts +0 -5
- package/dist/builtin.js +0 -9
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Monarch syntax highlighting for the likec4 language.
|
|
2
2
|
export default {
|
|
3
3
|
keywords: [
|
|
4
|
-
'BottomTop','LeftRight','RightLeft','TopBottom','amber','autoLayout','blue','browser','color','cylinder','description','element','exclude','extend','gray','green','include','indigo','it','mobile','model','muted','of','person','primary','queue','rectangle','red','secondary','shape','sky','slate','specification','storage','style','tag','technology','this','title','view','views'
|
|
4
|
+
'BottomTop','LeftRight','RightLeft','TopBottom','amber','autoLayout','blue','browser','color','cylinder','description','element','exclude','extend','gray','green','include','indigo','it','kind','mobile','model','muted','of','person','primary','queue','rectangle','red','secondary','shape','sky','slate','specification','storage','style','tag','technology','this','title','view','views'
|
|
5
5
|
],
|
|
6
6
|
operators: [
|
|
7
7
|
'*','->','.*'
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"name": "keyword.control.likec4",
|
|
15
|
-
"match": "\\b(BottomTop|LeftRight|RightLeft|TopBottom|amber|autoLayout|blue|browser|color|cylinder|description|element|exclude|extend|gray|green|include|indigo|it|mobile|model|muted|of|person|primary|queue|rectangle|red|secondary|shape|sky|slate|specification|storage|style|tag|technology|this|title|view|views)\\b"
|
|
15
|
+
"match": "\\b(BottomTop|LeftRight|RightLeft|TopBottom|amber|autoLayout|blue|browser|color|cylinder|description|element|exclude|extend|gray|green|include|indigo|it|kind|mobile|model|muted|of|person|primary|queue|rectangle|red|secondary|shape|sky|slate|specification|storage|style|tag|technology|this|title|view|views)\\b"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
"name": "string.quoted.double.likec4",
|
package/dist/generated/ast.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare function isAnyStringProperty(item: unknown): item is AnyStringPro
|
|
|
10
10
|
export type AStyleProperty = ColorProperty | ShapeProperty;
|
|
11
11
|
export declare const AStyleProperty = "AStyleProperty";
|
|
12
12
|
export declare function isAStyleProperty(item: unknown): item is AStyleProperty;
|
|
13
|
-
export type ElementExpression = ElementRefExpression | WildcardExpression;
|
|
13
|
+
export type ElementExpression = ElementKindExpression | ElementRefExpression | ElementTagExpression | WildcardExpression;
|
|
14
14
|
export declare const ElementExpression = "ElementExpression";
|
|
15
15
|
export declare function isElementExpression(item: unknown): item is ElementExpression;
|
|
16
16
|
export type ElementProperty = ElementStringProperty | ElementStyleProperty;
|
|
@@ -34,7 +34,7 @@ export declare function isViewRule(item: unknown): item is ViewRule;
|
|
|
34
34
|
export type ViewRuleLayoutDirection = 'BottomTop' | 'LeftRight' | 'RightLeft' | 'TopBottom';
|
|
35
35
|
export declare function isViewRuleLayoutDirection(item: unknown): item is ViewRuleLayoutDirection;
|
|
36
36
|
export interface ColorProperty extends AstNode {
|
|
37
|
-
readonly $container: ElementStyleProperty | SpecificationElementKindStyle | ViewRuleStyle;
|
|
37
|
+
readonly $container: ElementStyleProperty | SpecificationElementKindStyle | SpecificationTagStyle | ViewRuleStyle;
|
|
38
38
|
readonly $type: 'ColorProperty';
|
|
39
39
|
key: 'color';
|
|
40
40
|
value: ThemeColor;
|
|
@@ -67,6 +67,14 @@ export interface ElementKind extends AstNode {
|
|
|
67
67
|
}
|
|
68
68
|
export declare const ElementKind = "ElementKind";
|
|
69
69
|
export declare function isElementKind(item: unknown): item is ElementKind;
|
|
70
|
+
export interface ElementKindExpression extends AstNode {
|
|
71
|
+
readonly $container: InOutExpression | IncomingExpression | OutgoingExpression | RelationExpression | ViewRuleExpression | ViewRuleStyle;
|
|
72
|
+
readonly $type: 'ElementKindExpression';
|
|
73
|
+
isEqual: boolean;
|
|
74
|
+
kind: Reference<ElementKind>;
|
|
75
|
+
}
|
|
76
|
+
export declare const ElementKindExpression = "ElementKindExpression";
|
|
77
|
+
export declare function isElementKindExpression(item: unknown): item is ElementKindExpression;
|
|
70
78
|
export interface ElementRef extends AstNode {
|
|
71
79
|
readonly $container: ElementRef | ElementRefExpression | ElementView | Relation | RelationWithSource;
|
|
72
80
|
readonly $type: 'ElementRef';
|
|
@@ -99,6 +107,14 @@ export interface ElementStyleProperty extends AstNode {
|
|
|
99
107
|
}
|
|
100
108
|
export declare const ElementStyleProperty = "ElementStyleProperty";
|
|
101
109
|
export declare function isElementStyleProperty(item: unknown): item is ElementStyleProperty;
|
|
110
|
+
export interface ElementTagExpression extends AstNode {
|
|
111
|
+
readonly $container: InOutExpression | IncomingExpression | OutgoingExpression | RelationExpression | ViewRuleExpression | ViewRuleStyle;
|
|
112
|
+
readonly $type: 'ElementTagExpression';
|
|
113
|
+
isEqual: boolean;
|
|
114
|
+
tag: Reference<Tag>;
|
|
115
|
+
}
|
|
116
|
+
export declare const ElementTagExpression = "ElementTagExpression";
|
|
117
|
+
export declare function isElementTagExpression(item: unknown): item is ElementTagExpression;
|
|
102
118
|
export interface ElementView extends AstNode {
|
|
103
119
|
readonly $container: ModelViews;
|
|
104
120
|
readonly $type: 'ElementView';
|
|
@@ -203,7 +219,7 @@ export interface RelationStringProperty extends AstNode {
|
|
|
203
219
|
export declare const RelationStringProperty = "RelationStringProperty";
|
|
204
220
|
export declare function isRelationStringProperty(item: unknown): item is RelationStringProperty;
|
|
205
221
|
export interface ShapeProperty extends AstNode {
|
|
206
|
-
readonly $container: ElementStyleProperty | SpecificationElementKindStyle | ViewRuleStyle;
|
|
222
|
+
readonly $container: ElementStyleProperty | SpecificationElementKindStyle | SpecificationTagStyle | ViewRuleStyle;
|
|
207
223
|
readonly $type: 'ShapeProperty';
|
|
208
224
|
key: 'shape';
|
|
209
225
|
value: ElementShape;
|
|
@@ -237,10 +253,18 @@ export declare function isSpecificationRule(item: unknown): item is Specificatio
|
|
|
237
253
|
export interface SpecificationTag extends AstNode {
|
|
238
254
|
readonly $container: SpecificationRule;
|
|
239
255
|
readonly $type: 'SpecificationTag';
|
|
256
|
+
style?: SpecificationTagStyle;
|
|
240
257
|
tag: Tag;
|
|
241
258
|
}
|
|
242
259
|
export declare const SpecificationTag = "SpecificationTag";
|
|
243
260
|
export declare function isSpecificationTag(item: unknown): item is SpecificationTag;
|
|
261
|
+
export interface SpecificationTagStyle extends AstNode {
|
|
262
|
+
readonly $container: SpecificationTag;
|
|
263
|
+
readonly $type: 'SpecificationTagStyle';
|
|
264
|
+
props: Array<ColorProperty | ShapeProperty>;
|
|
265
|
+
}
|
|
266
|
+
export declare const SpecificationTagStyle = "SpecificationTagStyle";
|
|
267
|
+
export declare function isSpecificationTagStyle(item: unknown): item is SpecificationTagStyle;
|
|
244
268
|
export interface StrictElementRef extends AstNode {
|
|
245
269
|
readonly $container: ExtendElement | StrictElementRef;
|
|
246
270
|
readonly $type: 'StrictElementRef';
|
|
@@ -319,11 +343,13 @@ export type LikeC4AstType = {
|
|
|
319
343
|
ElementBody: ElementBody;
|
|
320
344
|
ElementExpression: ElementExpression;
|
|
321
345
|
ElementKind: ElementKind;
|
|
346
|
+
ElementKindExpression: ElementKindExpression;
|
|
322
347
|
ElementProperty: ElementProperty;
|
|
323
348
|
ElementRef: ElementRef;
|
|
324
349
|
ElementRefExpression: ElementRefExpression;
|
|
325
350
|
ElementStringProperty: ElementStringProperty;
|
|
326
351
|
ElementStyleProperty: ElementStyleProperty;
|
|
352
|
+
ElementTagExpression: ElementTagExpression;
|
|
327
353
|
ElementView: ElementView;
|
|
328
354
|
Expression: Expression;
|
|
329
355
|
ExtendElement: ExtendElement;
|
|
@@ -344,6 +370,7 @@ export type LikeC4AstType = {
|
|
|
344
370
|
SpecificationElementKindStyle: SpecificationElementKindStyle;
|
|
345
371
|
SpecificationRule: SpecificationRule;
|
|
346
372
|
SpecificationTag: SpecificationTag;
|
|
373
|
+
SpecificationTagStyle: SpecificationTagStyle;
|
|
347
374
|
StrictElementRef: StrictElementRef;
|
|
348
375
|
Tag: Tag;
|
|
349
376
|
Tags: Tags;
|
package/dist/generated/ast.js
CHANGED
|
@@ -59,6 +59,10 @@ export const ElementKind = 'ElementKind';
|
|
|
59
59
|
export function isElementKind(item) {
|
|
60
60
|
return reflection.isInstance(item, ElementKind);
|
|
61
61
|
}
|
|
62
|
+
export const ElementKindExpression = 'ElementKindExpression';
|
|
63
|
+
export function isElementKindExpression(item) {
|
|
64
|
+
return reflection.isInstance(item, ElementKindExpression);
|
|
65
|
+
}
|
|
62
66
|
export const ElementRef = 'ElementRef';
|
|
63
67
|
export function isElementRef(item) {
|
|
64
68
|
return reflection.isInstance(item, ElementRef);
|
|
@@ -75,6 +79,10 @@ export const ElementStyleProperty = 'ElementStyleProperty';
|
|
|
75
79
|
export function isElementStyleProperty(item) {
|
|
76
80
|
return reflection.isInstance(item, ElementStyleProperty);
|
|
77
81
|
}
|
|
82
|
+
export const ElementTagExpression = 'ElementTagExpression';
|
|
83
|
+
export function isElementTagExpression(item) {
|
|
84
|
+
return reflection.isInstance(item, ElementTagExpression);
|
|
85
|
+
}
|
|
78
86
|
export const ElementView = 'ElementView';
|
|
79
87
|
export function isElementView(item) {
|
|
80
88
|
return reflection.isInstance(item, ElementView);
|
|
@@ -147,6 +155,10 @@ export const SpecificationTag = 'SpecificationTag';
|
|
|
147
155
|
export function isSpecificationTag(item) {
|
|
148
156
|
return reflection.isInstance(item, SpecificationTag);
|
|
149
157
|
}
|
|
158
|
+
export const SpecificationTagStyle = 'SpecificationTagStyle';
|
|
159
|
+
export function isSpecificationTagStyle(item) {
|
|
160
|
+
return reflection.isInstance(item, SpecificationTagStyle);
|
|
161
|
+
}
|
|
150
162
|
export const StrictElementRef = 'StrictElementRef';
|
|
151
163
|
export function isStrictElementRef(item) {
|
|
152
164
|
return reflection.isInstance(item, StrictElementRef);
|
|
@@ -185,7 +197,7 @@ export function isRelationWithSource(item) {
|
|
|
185
197
|
}
|
|
186
198
|
export class LikeC4AstReflection extends AbstractAstReflection {
|
|
187
199
|
getAllTypes() {
|
|
188
|
-
return ['AStyleProperty', 'AnyStringProperty', 'ColorProperty', 'Element', 'ElementBody', 'ElementExpression', 'ElementKind', 'ElementProperty', 'ElementRef', 'ElementRefExpression', 'ElementStringProperty', 'ElementStyleProperty', 'ElementView', 'Expression', 'ExtendElement', 'ExtendElementBody', 'InOutExpression', 'IncomingExpression', 'LikeC4Document', 'Model', 'ModelViews', 'OutgoingExpression', 'Relation', 'RelationBody', 'RelationExpression', 'RelationStringProperty', 'RelationWithSource', 'ShapeProperty', 'SpecificationElementKind', 'SpecificationElementKindStyle', 'SpecificationRule', 'SpecificationTag', 'StrictElementRef', 'Tag', 'Tags', 'View', 'ViewProperty', 'ViewRule', 'ViewRuleAutoLayout', 'ViewRuleExpression', 'ViewRuleStyle', 'WildcardExpression'];
|
|
200
|
+
return ['AStyleProperty', 'AnyStringProperty', 'ColorProperty', 'Element', 'ElementBody', 'ElementExpression', 'ElementKind', 'ElementKindExpression', 'ElementProperty', 'ElementRef', 'ElementRefExpression', 'ElementStringProperty', 'ElementStyleProperty', 'ElementTagExpression', 'ElementView', 'Expression', 'ExtendElement', 'ExtendElementBody', 'InOutExpression', 'IncomingExpression', 'LikeC4Document', 'Model', 'ModelViews', 'OutgoingExpression', 'Relation', 'RelationBody', 'RelationExpression', 'RelationStringProperty', 'RelationWithSource', 'ShapeProperty', 'SpecificationElementKind', 'SpecificationElementKindStyle', 'SpecificationRule', 'SpecificationTag', 'SpecificationTagStyle', 'StrictElementRef', 'Tag', 'Tags', 'View', 'ViewProperty', 'ViewRule', 'ViewRuleAutoLayout', 'ViewRuleExpression', 'ViewRuleStyle', 'WildcardExpression'];
|
|
189
201
|
}
|
|
190
202
|
computeIsSubtype(subtype, supertype) {
|
|
191
203
|
switch (subtype) {
|
|
@@ -200,7 +212,9 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
200
212
|
case RelationExpression: {
|
|
201
213
|
return this.isSubtype(Expression, supertype);
|
|
202
214
|
}
|
|
215
|
+
case ElementKindExpression:
|
|
203
216
|
case ElementRefExpression:
|
|
217
|
+
case ElementTagExpression:
|
|
204
218
|
case WildcardExpression: {
|
|
205
219
|
return this.isSubtype(ElementExpression, supertype);
|
|
206
220
|
}
|
|
@@ -233,13 +247,15 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
233
247
|
getReferenceType(refInfo) {
|
|
234
248
|
const referenceId = `${refInfo.container.$type}:${refInfo.property}`;
|
|
235
249
|
switch (referenceId) {
|
|
236
|
-
case 'Element:kind':
|
|
250
|
+
case 'Element:kind':
|
|
251
|
+
case 'ElementKindExpression:kind': {
|
|
237
252
|
return ElementKind;
|
|
238
253
|
}
|
|
239
254
|
case 'ElementRef:el':
|
|
240
255
|
case 'StrictElementRef:el': {
|
|
241
256
|
return Element;
|
|
242
257
|
}
|
|
258
|
+
case 'ElementTagExpression:tag':
|
|
243
259
|
case 'Tags:value': {
|
|
244
260
|
return Tag;
|
|
245
261
|
}
|
|
@@ -267,6 +283,14 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
267
283
|
]
|
|
268
284
|
};
|
|
269
285
|
}
|
|
286
|
+
case 'ElementKindExpression': {
|
|
287
|
+
return {
|
|
288
|
+
name: 'ElementKindExpression',
|
|
289
|
+
mandatory: [
|
|
290
|
+
{ name: 'isEqual', type: 'boolean' }
|
|
291
|
+
]
|
|
292
|
+
};
|
|
293
|
+
}
|
|
270
294
|
case 'ElementRefExpression': {
|
|
271
295
|
return {
|
|
272
296
|
name: 'ElementRefExpression',
|
|
@@ -283,6 +307,14 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
283
307
|
]
|
|
284
308
|
};
|
|
285
309
|
}
|
|
310
|
+
case 'ElementTagExpression': {
|
|
311
|
+
return {
|
|
312
|
+
name: 'ElementTagExpression',
|
|
313
|
+
mandatory: [
|
|
314
|
+
{ name: 'isEqual', type: 'boolean' }
|
|
315
|
+
]
|
|
316
|
+
};
|
|
317
|
+
}
|
|
286
318
|
case 'ElementView': {
|
|
287
319
|
return {
|
|
288
320
|
name: 'ElementView',
|
|
@@ -341,6 +373,14 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
341
373
|
]
|
|
342
374
|
};
|
|
343
375
|
}
|
|
376
|
+
case 'SpecificationTagStyle': {
|
|
377
|
+
return {
|
|
378
|
+
name: 'SpecificationTagStyle',
|
|
379
|
+
mandatory: [
|
|
380
|
+
{ name: 'props', type: 'array' }
|
|
381
|
+
]
|
|
382
|
+
};
|
|
383
|
+
}
|
|
344
384
|
case 'Tags': {
|
|
345
385
|
return {
|
|
346
386
|
name: 'Tags',
|