@likec4/language-server 1.5.0 → 1.6.1
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.tmLanguage.json +1 -1
- package/package.json +17 -5
- package/src/Rpc.ts +2 -1
- package/src/ast.ts +10 -5
- package/src/generated/ast.ts +355 -238
- package/src/generated/grammar.ts +1 -1
- package/src/generated-lib/icons.ts +952 -0
- package/src/like-c4.langium +85 -54
- package/src/likec4lib.ts +7 -0
- package/src/lsp/DocumentSymbolProvider.ts +28 -1
- package/src/lsp/SemanticTokenProvider.ts +30 -9
- package/src/model/model-parser.ts +126 -74
- package/src/model-change/changeElementStyle.ts +4 -4
- package/src/model-graph/compute-view/__test__/fixture.ts +3 -3
- package/src/model-graph/compute-view/compute.ts +4 -4
- package/src/model-graph/dynamic-view/__test__/fixture.ts +2 -2
- package/src/references/scope-computation.ts +113 -60
- package/src/shared/NodeKindProvider.ts +1 -0
- package/src/shared/WorkspaceManager.ts +15 -6
- package/src/validation/dynamic-view-rule.ts +19 -24
- package/src/validation/index.ts +8 -7
- package/src/validation/property-checks.ts +23 -1
- package/src/validation/view-predicates/custom-element-expr.ts +9 -7
- package/src/validation/view-predicates/custom-relation-expr.ts +4 -3
- package/src/validation/view-predicates/expanded-element.ts +13 -24
- package/src/validation/view-predicates/incoming.ts +5 -5
- package/src/validation/view-predicates/outgoing.ts +5 -5
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"name": "keyword.control.likec4",
|
|
15
|
-
"match": "\\b(BottomTop|LeftRight|RightLeft|TopBottom|amber|autoLayout|blue|border|browser|color|crow|cylinder|dashed|description|diamond|dot|dotted|dynamic|element|exclude|extend|extends|gray|green|head|icon|include|indigo|it|
|
|
15
|
+
"match": "\\b(BottomTop|LeftRight|RightLeft|TopBottom|amber|autoLayout|blue|border|browser|color|crow|cylinder|dashed|description|diamond|dot|dotted|dynamic|element|element\\.kind|element\\.tag|exclude|extend|extends|gray|green|head|icon|icons|include|indigo|it|likec4lib|line|link|mobile|model|muted|navigateTo|none|normal|odiamond|odot|of|onormal|opacity|open|person|primary|queue|rectangle|red|relationship|secondary|shape|sky|slate|solid|specification|storage|style|tag|tail|technology|this|title|vee|view|views|with)\\b"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
"name": "string.quoted.double.likec4",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@likec4/language-server",
|
|
3
3
|
"description": "LikeC4 Language Server",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.6.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bugs": "https://github.com/likec4/likec4/issues",
|
|
7
7
|
"homepage": "https://likec4.dev",
|
|
@@ -26,6 +26,10 @@
|
|
|
26
26
|
"types": "./dist/index.d.ts",
|
|
27
27
|
"default": "./dist/index.js"
|
|
28
28
|
},
|
|
29
|
+
"./likec4lib": {
|
|
30
|
+
"types": "./dist/likec4lib.d.ts",
|
|
31
|
+
"default": "./dist/likec4lib.js"
|
|
32
|
+
},
|
|
29
33
|
"./browser": {
|
|
30
34
|
"types": "./dist/browser/index.d.ts",
|
|
31
35
|
"default": "./dist/browser/index.js"
|
|
@@ -51,6 +55,10 @@
|
|
|
51
55
|
"types": "./dist/index.d.ts",
|
|
52
56
|
"default": "./dist/index.js"
|
|
53
57
|
},
|
|
58
|
+
"./likec4lib": {
|
|
59
|
+
"types": "./dist/likec4lib.d.ts",
|
|
60
|
+
"default": "./dist/likec4lib.js"
|
|
61
|
+
},
|
|
54
62
|
"./browser": {
|
|
55
63
|
"types": "./dist/browser/index.d.ts",
|
|
56
64
|
"default": "./dist/browser/index.js"
|
|
@@ -71,9 +79,10 @@
|
|
|
71
79
|
},
|
|
72
80
|
"scripts": {
|
|
73
81
|
"typecheck": "tsc --noEmit",
|
|
82
|
+
"pregenerate": "rm -f src/generated/*",
|
|
74
83
|
"watch:langium": "langium generate --watch",
|
|
75
84
|
"watch:ts": "tsc --watch",
|
|
76
|
-
"generate": "langium generate",
|
|
85
|
+
"generate": "langium generate && tsx scripts/generate-icons.ts",
|
|
77
86
|
"dev": "run-p 'watch:*'",
|
|
78
87
|
"lint": "run -T eslint src/ --fix",
|
|
79
88
|
"clean": "run -T rimraf dist contrib",
|
|
@@ -83,7 +92,7 @@
|
|
|
83
92
|
},
|
|
84
93
|
"dependencies": {
|
|
85
94
|
"@dagrejs/graphlib": "^2.2.2",
|
|
86
|
-
"@likec4/core": "1.
|
|
95
|
+
"@likec4/core": "1.6.1",
|
|
87
96
|
"@total-typescript/ts-reset": "^0.5.1",
|
|
88
97
|
"fast-equals": "^5.0.1",
|
|
89
98
|
"indent-string": "^5.0.0",
|
|
@@ -101,15 +110,18 @@
|
|
|
101
110
|
"vscode-uri": "3.0.8"
|
|
102
111
|
},
|
|
103
112
|
"devDependencies": {
|
|
104
|
-
"@likec4/
|
|
113
|
+
"@likec4/icons": "1.6.1",
|
|
114
|
+
"@likec4/tsconfig": "1.6.1",
|
|
105
115
|
"@types/node": "^20.14.10",
|
|
106
116
|
"@types/object-hash": "^3.0.6",
|
|
107
117
|
"@types/string-hash": "^1.1.3",
|
|
108
118
|
"execa": "^9.3.0",
|
|
119
|
+
"glob": "^11.0.0",
|
|
109
120
|
"langium-cli": "3.1.0",
|
|
110
121
|
"npm-run-all2": "^6.2.2",
|
|
122
|
+
"tsx": "~4.9.3",
|
|
111
123
|
"typescript": "^5.5.3",
|
|
112
|
-
"vitest": "~
|
|
124
|
+
"vitest": "~2.0.3"
|
|
113
125
|
},
|
|
114
126
|
"packageManager": "yarn@4.3.1"
|
|
115
127
|
}
|
package/src/Rpc.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { LikeC4Services } from './module'
|
|
|
5
5
|
import { nonexhaustive } from '@likec4/core'
|
|
6
6
|
import { Disposable, interruptAndCheck, URI, UriUtils } from 'langium'
|
|
7
7
|
import { isLikeC4LangiumDocument } from './ast'
|
|
8
|
+
import { Scheme } from './likec4lib'
|
|
8
9
|
import {
|
|
9
10
|
buildDocuments,
|
|
10
11
|
changeView,
|
|
@@ -69,7 +70,7 @@ export class Rpc implements Disposable {
|
|
|
69
70
|
const changed = docs.map(d => URI.parse(d))
|
|
70
71
|
const notChanged = (uri: URI) => changed.every(c => !UriUtils.equals(c, uri))
|
|
71
72
|
const deleted = LangiumDocuments.all
|
|
72
|
-
.filter(d => isLikeC4LangiumDocument(d) && notChanged(d.uri))
|
|
73
|
+
.filter(d => isLikeC4LangiumDocument(d) && notChanged(d.uri) && d.uri.scheme !== Scheme)
|
|
73
74
|
.map(d => d.uri)
|
|
74
75
|
.toArray()
|
|
75
76
|
logger.debug(
|
package/src/ast.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from '@likec4/core'
|
|
9
9
|
import type { AstNode, AstNodeDescription, DiagnosticInfo, LangiumDocument, MultiMap } from 'langium'
|
|
10
10
|
import { AstUtils, DocumentState } from 'langium'
|
|
11
|
-
import { clamp, isNullish } from 'remeda'
|
|
11
|
+
import { clamp, isNullish, isTruthy } from 'remeda'
|
|
12
12
|
import type { ConditionalPick, SetRequired, ValueOf } from 'type-fest'
|
|
13
13
|
import type { Diagnostic } from 'vscode-languageserver-protocol'
|
|
14
14
|
import { DiagnosticSeverity } from 'vscode-languageserver-protocol'
|
|
@@ -207,9 +207,11 @@ function validatableAstNodeGuards<const Predicates extends Guard<AstNode>[]>(
|
|
|
207
207
|
return (n: AstNode): n is Guarded<Predicates[number]> => predicates.some(p => p(n))
|
|
208
208
|
}
|
|
209
209
|
const isValidatableAstNode = validatableAstNodeGuards([
|
|
210
|
-
ast.
|
|
211
|
-
ast.
|
|
212
|
-
ast.
|
|
210
|
+
ast.isDynamicViewRulePredicateIterator,
|
|
211
|
+
ast.isCustomElementExpression,
|
|
212
|
+
ast.isCustomRelationExpression,
|
|
213
|
+
ast.isElementExpression,
|
|
214
|
+
ast.isRelationExpression,
|
|
213
215
|
ast.isDynamicViewRulePredicate,
|
|
214
216
|
ast.isDynamicViewStep,
|
|
215
217
|
ast.isViewProperty,
|
|
@@ -336,7 +338,10 @@ export function toElementStyle(props?: Array<ast.StyleProperty>) {
|
|
|
336
338
|
break
|
|
337
339
|
}
|
|
338
340
|
case ast.isIconProperty(prop): {
|
|
339
|
-
|
|
341
|
+
const icon = prop.libicon?.ref?.name ?? prop.value
|
|
342
|
+
if (isTruthy(icon)) {
|
|
343
|
+
result.icon = icon as c4.IconUrl
|
|
344
|
+
}
|
|
340
345
|
break
|
|
341
346
|
}
|
|
342
347
|
case ast.isOpacityProperty(prop): {
|