@likec4/language-server 0.5.0 → 0.6.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 -1
- package/dist/ast.js +16 -15
- package/dist/generated/ast.d.ts +16 -12
- package/dist/generated/ast.js +15 -5
- package/dist/generated/grammar.js +1534 -1379
- package/dist/index.d.ts +1 -0
- package/dist/index.js +0 -1
- package/dist/lsp/DocumentSymbolProvider.d.ts +0 -1
- package/dist/lsp/SemanticTokenProvider.js +32 -58
- package/dist/model/model-builder.js +2 -1
- package/dist/validation/element.d.ts +0 -1
- package/package.json +7 -4
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// import { type DefaultSharedModuleContext, startLanguageServer as startLangiumLanguageServer } from 'langium'
|
|
2
2
|
export { createLanguageServices } from './module';
|
|
3
|
-
// export type { C4XServices }
|
|
4
3
|
// export type { C4XModel } from './c4x-model'
|
|
5
4
|
// export type { C4XLangiumDocument } from './ast'
|
|
6
5
|
// export {
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* This program and the accompanying materials are made available under the
|
|
4
4
|
* terms of the MIT License, which is available in the project root.
|
|
5
5
|
******************************************************************************/
|
|
6
|
-
/// <reference types="react" />
|
|
7
6
|
import { type DocumentSymbolProvider, type MaybePromise } from 'langium';
|
|
8
7
|
import { type DocumentSymbol } from 'vscode-languageserver-protocol';
|
|
9
8
|
import { type LikeC4LangiumDocument, ast } from '../ast';
|
|
@@ -15,17 +15,8 @@ export class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider {
|
|
|
15
15
|
property: 'el',
|
|
16
16
|
type: isElementRefHead(node) ? SemanticTokenTypes.variable : SemanticTokenTypes.property
|
|
17
17
|
});
|
|
18
|
-
// acceptor({
|
|
19
|
-
// node,
|
|
20
|
-
// property: 'el',
|
|
21
|
-
// type: SemanticTokenTypes.variable,
|
|
22
|
-
// })
|
|
23
18
|
return;
|
|
24
19
|
}
|
|
25
|
-
// if (ast.isSpec(node)) {
|
|
26
|
-
// keyword('spec')
|
|
27
|
-
// return
|
|
28
|
-
// }
|
|
29
20
|
if (ast.isWildcardExpression(node)) {
|
|
30
21
|
acceptor({
|
|
31
22
|
node,
|
|
@@ -56,21 +47,6 @@ export class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider {
|
|
|
56
47
|
}
|
|
57
48
|
return;
|
|
58
49
|
}
|
|
59
|
-
// if (ast.isDynamicViewStep(node)) {
|
|
60
|
-
// keyword(node.isReverse ? '<-' : '->')
|
|
61
|
-
// if (hasTitle(node)) {
|
|
62
|
-
// acceptor({
|
|
63
|
-
// node,
|
|
64
|
-
// property: 'title',
|
|
65
|
-
// type: SemanticTokenTypes.string
|
|
66
|
-
// })
|
|
67
|
-
// }
|
|
68
|
-
// return
|
|
69
|
-
// }
|
|
70
|
-
// if (ast.isStyleProperties(node)) {
|
|
71
|
-
// keyword('style')
|
|
72
|
-
// return
|
|
73
|
-
// }
|
|
74
50
|
if (ast.isElementKind(node)) {
|
|
75
51
|
acceptor({
|
|
76
52
|
node,
|
|
@@ -122,7 +98,7 @@ export class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider {
|
|
|
122
98
|
});
|
|
123
99
|
return;
|
|
124
100
|
}
|
|
125
|
-
if (ast.
|
|
101
|
+
if (ast.isAStyleProperty(node)) {
|
|
126
102
|
acceptor({
|
|
127
103
|
node,
|
|
128
104
|
property: 'key',
|
|
@@ -135,36 +111,34 @@ export class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider {
|
|
|
135
111
|
});
|
|
136
112
|
return;
|
|
137
113
|
}
|
|
138
|
-
if (ast.
|
|
114
|
+
if (ast.isAnyStringProperty(node)) {
|
|
139
115
|
acceptor({
|
|
140
116
|
node,
|
|
141
117
|
property: 'key',
|
|
142
118
|
type: SemanticTokenTypes.keyword
|
|
143
119
|
});
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
if (ast.isModel(node)) {
|
|
154
|
-
keyword('model');
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
if (ast.isModelViews(node)) {
|
|
158
|
-
keyword('views');
|
|
120
|
+
acceptor({
|
|
121
|
+
node,
|
|
122
|
+
property: 'value',
|
|
123
|
+
type: SemanticTokenTypes.string
|
|
124
|
+
});
|
|
159
125
|
return;
|
|
160
126
|
}
|
|
127
|
+
// if (ast.isModel(node)) {
|
|
128
|
+
// keyword('model')
|
|
129
|
+
// return
|
|
130
|
+
// }
|
|
131
|
+
// if (ast.isModelViews(node)) {
|
|
132
|
+
// keyword('views')
|
|
133
|
+
// return
|
|
134
|
+
// }
|
|
161
135
|
if (ast.isElement(node)) {
|
|
162
136
|
return this.highlightAstElement(node, acceptor);
|
|
163
137
|
}
|
|
164
|
-
if (ast.isExtendElement(node)) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
138
|
+
// if (ast.isExtendElement(node)) {
|
|
139
|
+
// keyword('extend')
|
|
140
|
+
// return
|
|
141
|
+
// }
|
|
168
142
|
// if (ast.isElementProperty(node) || ast.isRelationProperty(node) || ast.isViewProperty(node)) {
|
|
169
143
|
// acceptor({
|
|
170
144
|
// node,
|
|
@@ -188,19 +162,19 @@ export class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider {
|
|
|
188
162
|
// keyword('steps')
|
|
189
163
|
// return
|
|
190
164
|
// }
|
|
191
|
-
if (ast.isViewRuleAutoLayout(node)) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
if (ast.isViewRuleStyle(node)) {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
if (ast.isViewRuleExpression(node)) {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
//
|
|
165
|
+
// if (ast.isViewRuleAutoLayout(node)) {
|
|
166
|
+
// keyword('autoLayout')
|
|
167
|
+
// return
|
|
168
|
+
// }
|
|
169
|
+
// if (ast.isViewRuleStyle(node)) {
|
|
170
|
+
// keyword('style')
|
|
171
|
+
// return
|
|
172
|
+
// }
|
|
173
|
+
// if (ast.isViewRuleExpression(node)) {
|
|
174
|
+
// keyword(node.isInclude ? 'include' : 'exclude')
|
|
175
|
+
// return
|
|
176
|
+
// }
|
|
177
|
+
// //
|
|
204
178
|
}
|
|
205
179
|
highlightAstElement(node, acceptor) {
|
|
206
180
|
acceptor({
|
|
@@ -6,6 +6,7 @@ import { DocumentState, getDocument, interruptAndCheck } from 'langium';
|
|
|
6
6
|
import objectHash from 'object-hash';
|
|
7
7
|
import { clone, isNil, mergeDeepRight, omit, reduce } from 'rambdax';
|
|
8
8
|
import invariant from 'tiny-invariant';
|
|
9
|
+
import { toAutoLayout } from '../ast';
|
|
9
10
|
import { ElementViewOps, ast, c4hash, cleanParsedModel, isLikeC4LangiumDocument, isParsedLikeC4LangiumDocument, resolveRelationPoints, streamModel, toElementStyle } from '../ast';
|
|
10
11
|
import { elementRef, strictElementRefFqn } from '../elementRef';
|
|
11
12
|
import { logger } from '../logger';
|
|
@@ -277,7 +278,7 @@ export class LikeC4ModelBuilder {
|
|
|
277
278
|
}
|
|
278
279
|
if (ast.isViewRuleAutoLayout(astNode)) {
|
|
279
280
|
return {
|
|
280
|
-
autoLayout: astNode.direction
|
|
281
|
+
autoLayout: toAutoLayout(astNode.direction)
|
|
281
282
|
};
|
|
282
283
|
}
|
|
283
284
|
failExpectedNever(astNode);
|
package/package.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@likec4/language-server",
|
|
3
|
-
"
|
|
3
|
+
"description": "LikeC4 Language Server",
|
|
4
|
+
"version": "0.6.0",
|
|
5
|
+
"license": "MIT",
|
|
4
6
|
"type": "module",
|
|
5
7
|
"bugs": "https://github.com/likec4/likec4/issues",
|
|
6
8
|
"homepage": "https://like-c4.dev",
|
|
@@ -10,7 +12,8 @@
|
|
|
10
12
|
],
|
|
11
13
|
"repository": {
|
|
12
14
|
"type": "git",
|
|
13
|
-
"url": "https://github.com/likec4/likec4.git"
|
|
15
|
+
"url": "https://github.com/likec4/likec4.git",
|
|
16
|
+
"directory": "packages/language-server"
|
|
14
17
|
},
|
|
15
18
|
"main": "./dist/index.js",
|
|
16
19
|
"types": "./dist/index.d.ts",
|
|
@@ -70,7 +73,7 @@
|
|
|
70
73
|
"test:watch": "vitest"
|
|
71
74
|
},
|
|
72
75
|
"dependencies": {
|
|
73
|
-
"@likec4/core": "0.
|
|
76
|
+
"@likec4/core": "0.6.0",
|
|
74
77
|
"@mobily/ts-belt": "^3.13.1",
|
|
75
78
|
"langium": "^1.1.0",
|
|
76
79
|
"nanoid": "^4.0.2",
|
|
@@ -88,7 +91,7 @@
|
|
|
88
91
|
"langium-cli": "^1.1.0",
|
|
89
92
|
"npm-run-all": "^4.1.5",
|
|
90
93
|
"typescript": "^5.0.4",
|
|
91
|
-
"vite": "^4.2.
|
|
94
|
+
"vite": "^4.2.2",
|
|
92
95
|
"vitest": "^0.30.1"
|
|
93
96
|
}
|
|
94
97
|
}
|