@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.
@@ -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|kind|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"
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.5.0",
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.5.0",
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/tsconfig": "1.5.0",
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": "~1.6.0"
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.isCustomElementExpr,
211
- ast.isCustomRelationExpr,
212
- ast.isViewRulePredicateExpr,
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
- result.icon = prop.value as c4.IconUrl
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): {