@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
|
@@ -31,6 +31,29 @@ export class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider {
|
|
|
31
31
|
keyword('->');
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
+
if (ast.isElementKindExpression(node) || ast.isElementTagExpression(node)) {
|
|
35
|
+
keyword('element');
|
|
36
|
+
if (ast.isElementKindExpression(node)) {
|
|
37
|
+
keyword('kind');
|
|
38
|
+
acceptor({
|
|
39
|
+
node,
|
|
40
|
+
property: 'kind',
|
|
41
|
+
type: SemanticTokenTypes.type,
|
|
42
|
+
modifier: [SemanticTokenModifiers.definition]
|
|
43
|
+
});
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (ast.isElementTagExpression(node)) {
|
|
47
|
+
keyword('tag');
|
|
48
|
+
acceptor({
|
|
49
|
+
node,
|
|
50
|
+
property: 'tag',
|
|
51
|
+
type: SemanticTokenTypes.type,
|
|
52
|
+
modifier: [SemanticTokenModifiers.definition]
|
|
53
|
+
});
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
34
57
|
if (ast.isInOutExpression(node)) {
|
|
35
58
|
keyword('->', 0);
|
|
36
59
|
keyword('->', 1);
|
|
@@ -56,37 +79,12 @@ export class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider {
|
|
|
56
79
|
});
|
|
57
80
|
return;
|
|
58
81
|
}
|
|
59
|
-
// if (ast.isElementKindSpec(node)) {
|
|
60
|
-
// keyword('element')
|
|
61
|
-
// // keyword('nested')
|
|
62
|
-
// // if (node.nested.length > 0) {
|
|
63
|
-
// // acceptor({
|
|
64
|
-
// // node,
|
|
65
|
-
// // property: 'nested',
|
|
66
|
-
// // type: SemanticTokenTypes.type,
|
|
67
|
-
// // })
|
|
68
|
-
// // }
|
|
69
|
-
// // acceptor({
|
|
70
|
-
// // node,
|
|
71
|
-
// // property: 'kind',
|
|
72
|
-
// // type: SemanticTokenTypes.type,
|
|
73
|
-
// // })
|
|
74
|
-
// return
|
|
75
|
-
// }
|
|
76
|
-
// if (ast.isTagSpec(node)) {
|
|
77
|
-
// keyword('tag')
|
|
78
|
-
// acceptor({
|
|
79
|
-
// node,
|
|
80
|
-
// property: 'tag',
|
|
81
|
-
// type: SemanticTokenTypes.enumMember
|
|
82
|
-
// })
|
|
83
|
-
// return
|
|
84
|
-
// }
|
|
85
82
|
if (ast.isTags(node)) {
|
|
86
83
|
acceptor({
|
|
87
84
|
node,
|
|
88
85
|
property: 'value',
|
|
89
|
-
type: SemanticTokenTypes.
|
|
86
|
+
type: SemanticTokenTypes.type,
|
|
87
|
+
modifier: [SemanticTokenModifiers.definition]
|
|
90
88
|
});
|
|
91
89
|
return;
|
|
92
90
|
}
|
|
@@ -94,7 +92,8 @@ export class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider {
|
|
|
94
92
|
acceptor({
|
|
95
93
|
node,
|
|
96
94
|
property: 'name',
|
|
97
|
-
type: SemanticTokenTypes.
|
|
95
|
+
type: SemanticTokenTypes.type,
|
|
96
|
+
modifier: [SemanticTokenModifiers.definition]
|
|
98
97
|
});
|
|
99
98
|
return;
|
|
100
99
|
}
|
|
@@ -236,6 +236,20 @@ export class LikeC4ModelBuilder {
|
|
|
236
236
|
wildcard: true
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
|
+
if (ast.isElementKindExpression(astNode)) {
|
|
240
|
+
invariant(astNode.kind.ref, 'ElementKindExpression kind is not resolved: ' + astNode.$cstNode?.text);
|
|
241
|
+
return {
|
|
242
|
+
elementKind: astNode.kind.ref.name,
|
|
243
|
+
isEqual: astNode.isEqual
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
if (ast.isElementTagExpression(astNode)) {
|
|
247
|
+
invariant(astNode.tag.ref, 'ElementTagExpression tag is not resolved: ' + astNode.$cstNode?.text);
|
|
248
|
+
return {
|
|
249
|
+
elementTag: astNode.tag.ref.name,
|
|
250
|
+
isEqual: astNode.isEqual
|
|
251
|
+
};
|
|
252
|
+
}
|
|
239
253
|
if (ast.isElementRefExpression(astNode)) {
|
|
240
254
|
const element = elementRef(astNode.id);
|
|
241
255
|
invariant(element, 'Element not found ' + astNode.id.$cstNode?.text);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@likec4/language-server",
|
|
3
3
|
"description": "LikeC4 Language Server",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.19.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bugs": "https://github.com/likec4/likec4/issues",
|
|
7
7
|
"homepage": "https://likec4.dev",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"test:watch": "run -T vitest"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@likec4/core": "0.
|
|
61
|
+
"@likec4/core": "0.19.0",
|
|
62
62
|
"@mobily/ts-belt": "^3.13.1",
|
|
63
63
|
"langium": "^1.2.0",
|
|
64
64
|
"nanoid": "^4.0.2",
|
package/dist/builtin.d.ts
DELETED