@likec4/language-server 1.31.0 → 1.32.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/dist/LikeC4LanguageServices.d.ts +2 -1
- package/dist/LikeC4LanguageServices.js +4 -3
- package/dist/Rpc.js +11 -4
- package/dist/ast.d.ts +12 -15
- package/dist/ast.js +4 -1
- package/dist/bundled.mjs +2545 -2476
- package/dist/formatting/LikeC4Formatter.js +7 -6
- package/dist/generated/ast.d.ts +60 -19
- package/dist/generated/ast.js +79 -24
- package/dist/generated/grammar.js +1 -1
- package/dist/lsp/CompletionProvider.js +1 -1
- package/dist/lsp/DocumentLinkProvider.js +4 -3
- package/dist/lsp/HoverProvider.js +9 -1
- package/dist/lsp/SemanticTokenProvider.js +18 -4
- package/dist/mcp/LikeC4MCPServerFactory.d.ts +5 -2
- package/dist/mcp/LikeC4MCPServerFactory.js +2 -72
- package/dist/mcp/LikeC4MCPTools.js +5 -3
- package/dist/mcp/sseserver/MCPServerFactory.d.ts +8 -0
- package/dist/mcp/sseserver/MCPServerFactory.js +78 -0
- package/dist/mcp/sseserver/with-mcp-server.d.ts +2 -0
- package/dist/mcp/sseserver/with-mcp-server.js +5 -1
- package/dist/mcp/utils.d.ts +5 -4
- package/dist/mcp/utils.js +2 -2
- package/dist/model/builder/MergedExtends.d.ts +4 -4
- package/dist/model/builder/MergedExtends.js +1 -1
- package/dist/model/builder/MergedSpecification.d.ts +4 -3
- package/dist/model/builder/MergedSpecification.js +9 -8
- package/dist/model/builder/assignTagColors.d.ts +7 -0
- package/dist/model/builder/assignTagColors.js +51 -0
- package/dist/model/builder/buildModel.d.ts +2 -2
- package/dist/model/builder/buildModel.js +40 -18
- package/dist/model/deployments-index.js +2 -2
- package/dist/model/fqn-index.d.ts +1 -1
- package/dist/model/fqn-index.js +6 -6
- package/dist/model/model-builder.d.ts +10 -4
- package/dist/model/model-builder.js +22 -19
- package/dist/model/model-locator.d.ts +10 -2
- package/dist/model/model-locator.js +65 -9
- package/dist/model/model-parser-where.d.ts +1 -1
- package/dist/model/model-parser-where.js +1 -1
- package/dist/model/model-parser.d.ts +19 -11
- package/dist/model/model-parser.js +11 -7
- package/dist/model/parser/Base.d.ts +1 -0
- package/dist/model/parser/Base.js +24 -3
- package/dist/model/parser/DeploymentModelParser.d.ts +2 -1
- package/dist/model/parser/DeploymentModelParser.js +7 -5
- package/dist/model/parser/DeploymentViewParser.d.ts +4 -3
- package/dist/model/parser/DeploymentViewParser.js +2 -1
- package/dist/model/parser/FqnRefParser.d.ts +2 -1
- package/dist/model/parser/FqnRefParser.js +2 -5
- package/dist/model/parser/GlobalsParser.d.ts +24 -24
- package/dist/model/parser/GlobalsParser.js +4 -4
- package/dist/model/parser/ImportsParser.d.ts +1 -0
- package/dist/model/parser/ModelParser.d.ts +2 -1
- package/dist/model/parser/ModelParser.js +1 -1
- package/dist/model/parser/PredicatesParser.d.ts +13 -12
- package/dist/model/parser/SpecificationParser.d.ts +6 -2
- package/dist/model/parser/SpecificationParser.js +21 -31
- package/dist/model/parser/ViewsParser.d.ts +24 -23
- package/dist/model/parser/ViewsParser.js +12 -19
- package/dist/model-change/changeElementStyle.d.ts +2 -2
- package/dist/model-change/changeElementStyle.js +6 -2
- package/dist/module.d.ts +1 -1
- package/dist/module.js +5 -2
- package/dist/protocol.d.ts +24 -3
- package/dist/protocol.js +4 -0
- package/dist/references/scope-computation.js +2 -3
- package/dist/test/testServices.d.ts +15 -0
- package/dist/test/testServices.js +1 -1
- package/dist/validation/index.d.ts +1 -1
- package/dist/validation/index.js +10 -3
- package/dist/validation/property-checks.d.ts +1 -0
- package/dist/validation/property-checks.js +62 -0
- package/dist/validation/relation.js +1 -1
- package/dist/validation/specification.js +1 -1
- package/dist/view-utils/assignNavigateTo.d.ts +1 -1
- package/dist/view-utils/assignNavigateTo.js +3 -3
- package/dist/views/likec4-views.d.ts +1 -3
- package/dist/views/likec4-views.js +68 -44
- package/package.json +23 -21
- /package/dist/mcp/sseserver/{SSELikeC4MCPServer.d.ts → MCPServer.d.ts} +0 -0
- /package/dist/mcp/sseserver/{SSELikeC4MCPServer.js → MCPServer.js} +0 -0
|
@@ -12,52 +12,62 @@ export class DefaultLikeC4Views {
|
|
|
12
12
|
cache = /* @__PURE__ */ new WeakMap();
|
|
13
13
|
viewsWithReportedErrors = /* @__PURE__ */ new Set();
|
|
14
14
|
ModelBuilder;
|
|
15
|
-
queue = new PQueue({ concurrency:
|
|
15
|
+
queue = new PQueue({ concurrency: 2, timeout: 2e4, throwOnTimeout: true });
|
|
16
16
|
get layouter() {
|
|
17
17
|
return this.services.likec4.Layouter;
|
|
18
18
|
}
|
|
19
19
|
async computedViews(projectId, cancelToken = CancellationToken.None) {
|
|
20
20
|
const likeC4Model = await this.ModelBuilder.buildLikeC4Model(projectId, cancelToken);
|
|
21
|
-
return values(likeC4Model.$
|
|
21
|
+
return values(likeC4Model.$data.views);
|
|
22
22
|
}
|
|
23
23
|
async layoutAllViews(projectId, cancelToken = CancellationToken.None) {
|
|
24
|
-
const
|
|
24
|
+
const likeC4Model = await this.ModelBuilder.buildLikeC4Model(projectId, cancelToken);
|
|
25
|
+
const views = values(likeC4Model.$data.views);
|
|
25
26
|
if (views.length === 0) {
|
|
26
27
|
return [];
|
|
27
28
|
}
|
|
28
29
|
const logger = rootLogger.getChild(["views", projectId ?? ""]);
|
|
29
30
|
logger.debug`layoutAll: ${views.length} views`;
|
|
31
|
+
if (this.queue.pending + this.queue.size > 0) {
|
|
32
|
+
logger.debug`wait for previous layouts to finish`;
|
|
33
|
+
await this.queue.onIdle();
|
|
34
|
+
}
|
|
35
|
+
if (this.layouter.port.concurrency !== this.queue.concurrency) {
|
|
36
|
+
this.queue.concurrency = this.layouter.port.concurrency;
|
|
37
|
+
logger.debug`set queue concurrency to ${this.layouter.port.concurrency}`;
|
|
38
|
+
}
|
|
39
|
+
const specification = likeC4Model.$data.specification;
|
|
30
40
|
const results = [];
|
|
31
|
-
const tasks = [];
|
|
32
41
|
for (const view of views) {
|
|
33
|
-
this.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return await this.layouter.layout(view);
|
|
39
|
-
});
|
|
40
|
-
if (!result) {
|
|
41
|
-
return Promise.reject(new Error(`Failed to layout view ${view.id}`));
|
|
42
|
-
}
|
|
43
|
-
logger.debug`done layout view ${view.id}`;
|
|
44
|
-
this.viewsWithReportedErrors.delete(view.id);
|
|
45
|
-
this.cache.set(view, result);
|
|
46
|
-
return result;
|
|
47
|
-
}).catch((e) => {
|
|
48
|
-
logger.warn(`fail layout view ${view.id}`, { e });
|
|
49
|
-
this.cache.delete(view);
|
|
50
|
-
return Promise.reject(e);
|
|
51
|
-
})
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
for (const task of await Promise.allSettled(tasks)) {
|
|
55
|
-
if (task.status === "fulfilled") {
|
|
56
|
-
results.push(task.value);
|
|
57
|
-
} else {
|
|
58
|
-
logger.error(loggable(task.reason));
|
|
42
|
+
let cached = this.cache.get(view);
|
|
43
|
+
if (cached) {
|
|
44
|
+
logger.debug`layout ${view.id} from cache`;
|
|
45
|
+
results.push(cached);
|
|
46
|
+
continue;
|
|
59
47
|
}
|
|
48
|
+
if (this.queue.pending > this.queue.concurrency + 4) {
|
|
49
|
+
await this.queue.onSizeLessThan(this.queue.concurrency + 1);
|
|
50
|
+
}
|
|
51
|
+
this.queue.add(async () => {
|
|
52
|
+
logger.debug`layouting view ${view.id}...`;
|
|
53
|
+
return await this.layouter.layout({
|
|
54
|
+
view,
|
|
55
|
+
specification
|
|
56
|
+
});
|
|
57
|
+
}).then((result) => {
|
|
58
|
+
if (!result) {
|
|
59
|
+
throw new Error(`Layout queue returned null for view ${view.id}`);
|
|
60
|
+
}
|
|
61
|
+
this.viewsWithReportedErrors.delete(view.id);
|
|
62
|
+
logger.debug`done layout view ${view.id}`;
|
|
63
|
+
this.cache.set(view, result);
|
|
64
|
+
results.push(result);
|
|
65
|
+
}).catch((e) => {
|
|
66
|
+
logger.error(`Fail layout view ${view.id}`, { e });
|
|
67
|
+
this.cache.delete(view);
|
|
68
|
+
});
|
|
60
69
|
}
|
|
70
|
+
await this.queue.onIdle();
|
|
61
71
|
if (results.length !== views.length) {
|
|
62
72
|
logger.warn`layouted ${results.length} of ${views.length} views`;
|
|
63
73
|
} else if (results.length > 0) {
|
|
@@ -80,9 +90,16 @@ export class DefaultLikeC4Views {
|
|
|
80
90
|
}
|
|
81
91
|
try {
|
|
82
92
|
const start = performance.now();
|
|
93
|
+
if (this.queue.pending + this.queue.size > 0) {
|
|
94
|
+
logger.debug`wait for previous layouts to finish`;
|
|
95
|
+
await this.queue.onIdle();
|
|
96
|
+
}
|
|
83
97
|
const result = await this.queue.add(async () => {
|
|
84
98
|
logger.debug`layouting view ${view.id}...`;
|
|
85
|
-
return await this.layouter.layout(
|
|
99
|
+
return await this.layouter.layout({
|
|
100
|
+
view,
|
|
101
|
+
specification: model.$data.specification
|
|
102
|
+
});
|
|
86
103
|
});
|
|
87
104
|
if (!result) {
|
|
88
105
|
throw new Error(`Failed to layout view ${viewId}`);
|
|
@@ -111,9 +128,16 @@ export class DefaultLikeC4Views {
|
|
|
111
128
|
if (cache.has(KEY)) {
|
|
112
129
|
return await Promise.resolve(cache.get(KEY));
|
|
113
130
|
}
|
|
114
|
-
const
|
|
131
|
+
const likeC4Model = await this.ModelBuilder.buildLikeC4Model(projectId, cancelToken);
|
|
132
|
+
const views = values(likeC4Model.$data.views);
|
|
133
|
+
if (views.length === 0) {
|
|
134
|
+
return [];
|
|
135
|
+
}
|
|
115
136
|
const tasks = views.map(async (view) => {
|
|
116
|
-
const { dot, svg } = await this.layouter.svg(
|
|
137
|
+
const { dot, svg } = await this.layouter.svg({
|
|
138
|
+
view,
|
|
139
|
+
specification: likeC4Model.$data.specification
|
|
140
|
+
});
|
|
117
141
|
return {
|
|
118
142
|
id: view.id,
|
|
119
143
|
dot,
|
|
@@ -132,15 +156,15 @@ export class DefaultLikeC4Views {
|
|
|
132
156
|
cache.set(KEY, succeed);
|
|
133
157
|
return succeed;
|
|
134
158
|
}
|
|
135
|
-
async overviewGraph() {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
159
|
+
// async overviewGraph(): Promise<OverviewGraph> {
|
|
160
|
+
// const KEY = 'OverviewGraph'
|
|
161
|
+
// const cache = this.services.ValidatedWorkspaceCache as WorkspaceCache<string, OverviewGraph>
|
|
162
|
+
// if (cache.has(KEY)) {
|
|
163
|
+
// return await Promise.resolve(cache.get(KEY)!)
|
|
164
|
+
// }
|
|
165
|
+
// const views = await this.computedViews()
|
|
166
|
+
// const overviewGraph = await this.layouter.layoutOverviewGraph(views)
|
|
167
|
+
// cache.set(KEY, overviewGraph)
|
|
168
|
+
// return overviewGraph
|
|
169
|
+
// }
|
|
146
170
|
}
|
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.32.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bugs": "https://github.com/likec4/likec4/issues",
|
|
7
7
|
"homepage": "https://likec4.dev",
|
|
@@ -89,21 +89,20 @@
|
|
|
89
89
|
"access": "public"
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@hpcc-js/wasm-graphviz": "1.7.0"
|
|
93
|
-
"vscode-jsonrpc": "8.2.0",
|
|
94
|
-
"vscode-uri": "3.1.0"
|
|
92
|
+
"@hpcc-js/wasm-graphviz": "1.7.0"
|
|
95
93
|
},
|
|
96
94
|
"devDependencies": {
|
|
97
|
-
"@
|
|
98
|
-
"
|
|
95
|
+
"@types/chroma-js": "^3.1.1",
|
|
96
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
99
97
|
"@msgpack/msgpack": "^3.1.1",
|
|
100
98
|
"@smithy/util-base64": "^4.0.0",
|
|
101
|
-
"@types/express": "^5.0.
|
|
102
|
-
"@types/node": "
|
|
99
|
+
"@types/express": "^5.0.2",
|
|
100
|
+
"@types/node": "~20.19.0",
|
|
103
101
|
"@types/picomatch": "^4.0.0",
|
|
104
|
-
"picomatch": "^4.0.2",
|
|
105
102
|
"@types/which": "^3.0.4",
|
|
103
|
+
"chroma-js": "^3.1.2",
|
|
106
104
|
"esm-env": "^1.2.2",
|
|
105
|
+
"express": "^5.1.0",
|
|
107
106
|
"fast-equals": "^5.2.2",
|
|
108
107
|
"fdir": "^6.4.4",
|
|
109
108
|
"indent-string": "^5.0.0",
|
|
@@ -114,27 +113,30 @@
|
|
|
114
113
|
"p-debounce": "^4.0.0",
|
|
115
114
|
"p-queue": "^8.1.0",
|
|
116
115
|
"p-timeout": "^6.1.4",
|
|
116
|
+
"picomatch": "^4.0.2",
|
|
117
117
|
"pretty-ms": "^9.2.0",
|
|
118
|
-
"remeda": "^2.
|
|
118
|
+
"remeda": "^2.23.0",
|
|
119
119
|
"strip-indent": "^4.0.0",
|
|
120
|
-
"tsx": "~4.
|
|
121
|
-
"turbo": "^2.5.
|
|
122
|
-
"type-fest": "^4.
|
|
120
|
+
"tsx": "~4.20.1",
|
|
121
|
+
"turbo": "^2.5.4",
|
|
122
|
+
"type-fest": "^4.41.0",
|
|
123
123
|
"typescript": "^5.8.3",
|
|
124
124
|
"ufo": "^1.6.1",
|
|
125
125
|
"unbuild": "^3.5.0",
|
|
126
126
|
"valibot": "^1.0.0",
|
|
127
|
-
"
|
|
128
|
-
"
|
|
127
|
+
"vitest": "3.2.3",
|
|
128
|
+
"vscode-jsonrpc": "8.2.0",
|
|
129
129
|
"vscode-languageserver": "9.0.1",
|
|
130
130
|
"vscode-languageserver-protocol": "3.17.5",
|
|
131
131
|
"vscode-languageserver-types": "3.17.5",
|
|
132
|
+
"vscode-uri": "3.1.0",
|
|
132
133
|
"which": "^5.0.0",
|
|
133
|
-
"
|
|
134
|
-
"@likec4/
|
|
135
|
-
"@likec4/
|
|
136
|
-
"@likec4/
|
|
137
|
-
"@likec4/tsconfig": "1.
|
|
134
|
+
"zod": "^3.24.3",
|
|
135
|
+
"@likec4/core": "1.32.1",
|
|
136
|
+
"@likec4/icons": "1.32.1",
|
|
137
|
+
"@likec4/layouts": "1.32.1",
|
|
138
|
+
"@likec4/tsconfig": "1.32.1",
|
|
139
|
+
"@likec4/log": "1.32.1"
|
|
138
140
|
},
|
|
139
141
|
"scripts": {
|
|
140
142
|
"typecheck": "tsc -b --verbose",
|
|
@@ -146,7 +148,7 @@
|
|
|
146
148
|
"generate": "langium generate && tsx scripts/generate-icons.ts",
|
|
147
149
|
"dev": "run-p \"watch:*\"",
|
|
148
150
|
"lint": "run -T eslint src/ --fix",
|
|
149
|
-
"clean": "
|
|
151
|
+
"clean": "pnpm rimraf dist contrib lib src/generated src/generated-lib",
|
|
150
152
|
"test": "vitest run --no-isolate",
|
|
151
153
|
"test-dbg": "vitest run --no-isolate -t formating",
|
|
152
154
|
"vitest:ui": "vitest --no-isolate --ui",
|
|
File without changes
|
|
File without changes
|