@likec4/language-server 0.26.0 → 0.27.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 +3 -1
- package/contrib/likec4.tmLanguage.json +1 -1
- package/dist/ast.d.ts +1 -1
- package/dist/generated/ast.d.ts +14 -4
- package/dist/generated/ast.js +10 -3
- package/dist/generated/grammar.js +278 -134
- package/dist/lsp/DocumentSymbolProvider.js +16 -22
- package/dist/model/fqn-computation.js +1 -1
- package/dist/model/fqn-index.js +2 -2
- package/dist/model/model-builder.js +4 -4
- package/dist/module.js +3 -2
- package/dist/references/scope-computation.js +15 -12
- package/dist/shared/DocumentLinkProvider.d.ts +8 -0
- package/dist/shared/DocumentLinkProvider.js +37 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -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','kind','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','link','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
|
'*','.*'
|
|
@@ -10,6 +10,8 @@ export default {
|
|
|
10
10
|
|
|
11
11
|
tokenizer: {
|
|
12
12
|
initial: [
|
|
13
|
+
{ regex: /(\w+:\/\/)[^\s]+/, action: {"token":"URI_WITH_SCHEMA"} },
|
|
14
|
+
{ regex: /\/[^\s\/][^\s]*/, action: {"token":"URI_RELATIVE"} },
|
|
13
15
|
{ regex: /"[^"]*"|'[^']*'/, action: {"token":"string"} },
|
|
14
16
|
{ regex: /[^\W\d_]/, action: { cases: { '@keywords': {"token":"keyword"}, '@default': {"token":"LETTER"} }} },
|
|
15
17
|
{ regex: /[0-9]/, action: {"token":"DIGIT"} },
|
|
@@ -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|kind|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|link|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/ast.d.ts
CHANGED
|
@@ -61,7 +61,7 @@ export declare function cleanParsedModel(doc: LikeC4LangiumDocument): {
|
|
|
61
61
|
export declare function isLikeC4LangiumDocument(doc: LangiumDocument): doc is LikeC4LangiumDocument;
|
|
62
62
|
export declare function isParsedLikeC4LangiumDocument(doc: LangiumDocument): doc is LikeC4LangiumDocument;
|
|
63
63
|
export declare const isValidLikeC4LangiumDocument: (doc: LangiumDocument) => doc is LikeC4LangiumDocument;
|
|
64
|
-
export declare function streamModel(doc: LikeC4LangiumDocument): Generator<ast.
|
|
64
|
+
export declare function streamModel(doc: LikeC4LangiumDocument): Generator<ast.Relation | ast.Element, void, unknown>;
|
|
65
65
|
export declare function resolveRelationPoints(node: ast.Relation): {
|
|
66
66
|
source: ast.Element;
|
|
67
67
|
target: ast.Element;
|
package/dist/generated/ast.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
******************************************************************************/
|
|
5
5
|
import type { AstNode, Reference, ReferenceInfo, TypeMetaData } from 'langium';
|
|
6
6
|
import { AbstractAstReflection } from 'langium';
|
|
7
|
-
export type AnyStringProperty = ElementStringProperty | RelationStringProperty | ViewProperty;
|
|
7
|
+
export type AnyStringProperty = ElementStringProperty | LinkProperty | RelationStringProperty | ViewProperty;
|
|
8
8
|
export declare const AnyStringProperty = "AnyStringProperty";
|
|
9
9
|
export declare function isAnyStringProperty(item: unknown): item is AnyStringProperty;
|
|
10
10
|
export type AStyleProperty = ColorProperty | ShapeProperty;
|
|
@@ -27,6 +27,8 @@ export type RArrow = string;
|
|
|
27
27
|
export declare function isRArrow(item: unknown): item is RArrow;
|
|
28
28
|
export type ThemeColor = 'amber' | 'blue' | 'gray' | 'green' | 'indigo' | 'muted' | 'primary' | 'red' | 'secondary' | 'sky' | 'slate';
|
|
29
29
|
export declare function isThemeColor(item: unknown): item is ThemeColor;
|
|
30
|
+
export type Uri = string;
|
|
31
|
+
export declare function isUri(item: unknown): item is Uri;
|
|
30
32
|
export type View = ElementView;
|
|
31
33
|
export declare const View = "View";
|
|
32
34
|
export declare function isView(item: unknown): item is View;
|
|
@@ -57,7 +59,7 @@ export interface ElementBody extends AstNode {
|
|
|
57
59
|
readonly $container: Element;
|
|
58
60
|
readonly $type: 'ElementBody';
|
|
59
61
|
elements: Array<Element | Relation>;
|
|
60
|
-
props: Array<ElementProperty>;
|
|
62
|
+
props: Array<ElementProperty | LinkProperty>;
|
|
61
63
|
tags?: Tags;
|
|
62
64
|
}
|
|
63
65
|
export declare const ElementBody = "ElementBody";
|
|
@@ -166,6 +168,14 @@ export interface LikeC4Document extends AstNode {
|
|
|
166
168
|
}
|
|
167
169
|
export declare const LikeC4Document = "LikeC4Document";
|
|
168
170
|
export declare function isLikeC4Document(item: unknown): item is LikeC4Document;
|
|
171
|
+
export interface LinkProperty extends AstNode {
|
|
172
|
+
readonly $container: ElementBody | ElementView | RelationBody;
|
|
173
|
+
readonly $type: 'LinkProperty';
|
|
174
|
+
key: 'link';
|
|
175
|
+
value: Uri;
|
|
176
|
+
}
|
|
177
|
+
export declare const LinkProperty = "LinkProperty";
|
|
178
|
+
export declare function isLinkProperty(item: unknown): item is LinkProperty;
|
|
169
179
|
export interface Model extends AstNode {
|
|
170
180
|
readonly $container: LikeC4Document;
|
|
171
181
|
readonly $type: 'Model';
|
|
@@ -251,9 +261,8 @@ export declare function isSpecificationElementKindStyle(item: unknown): item is
|
|
|
251
261
|
export interface SpecificationRule extends AstNode {
|
|
252
262
|
readonly $container: LikeC4Document;
|
|
253
263
|
readonly $type: 'SpecificationRule';
|
|
254
|
-
elementKinds: Array<SpecificationElementKind>;
|
|
255
264
|
name: 'specification';
|
|
256
|
-
|
|
265
|
+
specs: Array<SpecificationElementKind | SpecificationTag>;
|
|
257
266
|
}
|
|
258
267
|
export declare const SpecificationRule = "SpecificationRule";
|
|
259
268
|
export declare function isSpecificationRule(item: unknown): item is SpecificationRule;
|
|
@@ -365,6 +374,7 @@ export type LikeC4AstType = {
|
|
|
365
374
|
InOutExpression: InOutExpression;
|
|
366
375
|
IncomingExpression: IncomingExpression;
|
|
367
376
|
LikeC4Document: LikeC4Document;
|
|
377
|
+
LinkProperty: LinkProperty;
|
|
368
378
|
Model: Model;
|
|
369
379
|
ModelViews: ModelViews;
|
|
370
380
|
OutgoingExpression: OutgoingExpression;
|
package/dist/generated/ast.js
CHANGED
|
@@ -35,6 +35,9 @@ export function isRArrow(item) {
|
|
|
35
35
|
export function isThemeColor(item) {
|
|
36
36
|
return item === 'primary' || item === 'secondary' || item === 'muted' || item === 'slate' || item === 'blue' || item === 'indigo' || item === 'sky' || item === 'red' || item === 'gray' || item === 'green' || item === 'amber';
|
|
37
37
|
}
|
|
38
|
+
export function isUri(item) {
|
|
39
|
+
return typeof item === 'string';
|
|
40
|
+
}
|
|
38
41
|
export const View = 'View';
|
|
39
42
|
export function isView(item) {
|
|
40
43
|
return reflection.isInstance(item, View);
|
|
@@ -110,6 +113,10 @@ export const LikeC4Document = 'LikeC4Document';
|
|
|
110
113
|
export function isLikeC4Document(item) {
|
|
111
114
|
return reflection.isInstance(item, LikeC4Document);
|
|
112
115
|
}
|
|
116
|
+
export const LinkProperty = 'LinkProperty';
|
|
117
|
+
export function isLinkProperty(item) {
|
|
118
|
+
return reflection.isInstance(item, LinkProperty);
|
|
119
|
+
}
|
|
113
120
|
export const Model = 'Model';
|
|
114
121
|
export function isModel(item) {
|
|
115
122
|
return reflection.isInstance(item, Model);
|
|
@@ -200,7 +207,7 @@ export function isRelationWithSource(item) {
|
|
|
200
207
|
}
|
|
201
208
|
export class LikeC4AstReflection extends AbstractAstReflection {
|
|
202
209
|
getAllTypes() {
|
|
203
|
-
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'];
|
|
210
|
+
return ['AStyleProperty', 'AnyStringProperty', 'ColorProperty', 'Element', 'ElementBody', 'ElementExpression', 'ElementKind', 'ElementKindExpression', 'ElementProperty', 'ElementRef', 'ElementRefExpression', 'ElementStringProperty', 'ElementStyleProperty', 'ElementTagExpression', 'ElementView', 'Expression', 'ExtendElement', 'ExtendElementBody', 'InOutExpression', 'IncomingExpression', 'LikeC4Document', 'LinkProperty', 'Model', 'ModelViews', 'OutgoingExpression', 'Relation', 'RelationBody', 'RelationExpression', 'RelationStringProperty', 'RelationWithSource', 'ShapeProperty', 'SpecificationElementKind', 'SpecificationElementKindStyle', 'SpecificationRule', 'SpecificationTag', 'SpecificationTagStyle', 'StrictElementRef', 'Tag', 'Tags', 'View', 'ViewProperty', 'ViewRule', 'ViewRuleAutoLayout', 'ViewRuleExpression', 'ViewRuleStyle', 'WildcardExpression'];
|
|
204
211
|
}
|
|
205
212
|
computeIsSubtype(subtype, supertype) {
|
|
206
213
|
switch (subtype) {
|
|
@@ -230,6 +237,7 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
230
237
|
case ElementView: {
|
|
231
238
|
return this.isSubtype(View, supertype);
|
|
232
239
|
}
|
|
240
|
+
case LinkProperty:
|
|
233
241
|
case RelationStringProperty:
|
|
234
242
|
case ViewProperty: {
|
|
235
243
|
return this.isSubtype(AnyStringProperty, supertype);
|
|
@@ -371,8 +379,7 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
371
379
|
return {
|
|
372
380
|
name: 'SpecificationRule',
|
|
373
381
|
mandatory: [
|
|
374
|
-
{ name: '
|
|
375
|
-
{ name: 'tags', type: 'array' }
|
|
382
|
+
{ name: 'specs', type: 'array' }
|
|
376
383
|
]
|
|
377
384
|
};
|
|
378
385
|
}
|