@likec4/language-server 1.49.0 → 1.51.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/LICENSE +21 -0
- package/README.md +5 -25
- package/bin/likec4-language-server.mjs +2 -3
- package/dist/_chunks/LikeC4FileSystem.mjs +3 -3
- package/dist/_chunks/common-exports.mjs +0 -0
- package/dist/_chunks/likec4lib.mjs +2 -0
- package/dist/_chunks/mcp.mjs +1154 -0
- package/dist/_chunks/{index.d.mts → module.d.mts} +326 -24
- package/dist/_chunks/module.mjs +35 -0
- package/dist/_chunks/noop.mjs +1 -0
- package/dist/_chunks/protocol.d.mts +315 -0
- package/dist/_chunks/utils.mjs +1 -1
- package/dist/_chunks/workspace.mjs +1 -0
- package/dist/browser/index.d.mts +8 -3
- package/dist/browser/index.mjs +1 -1
- package/dist/browser/worker.mjs +1 -1
- package/dist/filesystem/index.d.mts +3 -2
- package/dist/filesystem/index.mjs +1 -1
- package/dist/index.d.mts +3 -39
- package/dist/index.mjs +1 -1
- package/dist/likec4lib.mjs +1 -1
- package/dist/mcp/index.d.mts +3 -2
- package/dist/mcp/index.mjs +1 -1
- package/dist/module.d.mts +3 -126
- package/dist/module.mjs +1 -1
- package/dist/protocol.d.mts +1 -314
- package/dist/protocol.mjs +1 -1
- package/package.json +23 -33
- package/bundled/package.json +0 -4
- package/dist/THIRD-PARTY-LICENSES.md +0 -178
- package/dist/_chunks/ConfigurableLayouter.mjs +0 -1
- package/dist/_chunks/LikeC4Views.mjs +0 -34
- package/dist/_chunks/ProjectsManager.mjs +0 -1
- package/dist/_chunks/WithMCPServer.mjs +0 -481
- package/dist/_chunks/icons.mjs +0 -2
- package/dist/_chunks/libs/@msgpack/msgpack.mjs +0 -1
- package/dist/_chunks/libs/eventemitter3.mjs +0 -1
- package/dist/_chunks/libs/fast-equals.mjs +0 -1
- package/dist/_chunks/libs/p-queue.mjs +0 -1
- package/dist/_chunks/libs/parse-ms.mjs +0 -1
- package/dist/_chunks/libs/picomatch.mjs +0 -1
- package/dist/_chunks/libs/pretty-ms.mjs +0 -1
- package/dist/_chunks/libs/remeda.mjs +0 -1
- package/dist/_chunks/libs/strip-indent.mjs +0 -1
- package/dist/_chunks/libs/ufo.mjs +0 -1
- package/dist/_chunks/logger.mjs +0 -1
- package/dist/_chunks/rolldown-runtime.mjs +0 -1
- package/dist/bundled.d.mts +0 -27
- package/dist/bundled.mjs +0 -1
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { DiagnosticSeverity, DocumentUri, Location, Position, Range, URI } from "vscode-languageserver-types";
|
|
2
|
+
import { ColorLiteral, ComputedLikeC4ModelData, DeploymentFqn, DiagramView, Fqn, LayoutedLikeC4ModelData, LayoutedProjectsView, NonEmptyArray, ProjectId, RelationId, ViewChange, ViewId } from "@likec4/core";
|
|
3
|
+
import { LikeC4ProjectJsonConfig } from "@likec4/config";
|
|
4
|
+
import { NotificationType, NotificationType0, RequestType, RequestType0 } from "vscode-jsonrpc";
|
|
5
|
+
|
|
6
|
+
//#region src/protocol.d.ts
|
|
7
|
+
declare namespace DidChangeModelNotification {
|
|
8
|
+
const type: NotificationType<string>;
|
|
9
|
+
type Type = typeof type;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Triggered by the language server when projects changed
|
|
13
|
+
* (number of projects changed, names changed, etc)
|
|
14
|
+
*/
|
|
15
|
+
declare namespace DidChangeProjectsNotification {
|
|
16
|
+
const type: NotificationType0;
|
|
17
|
+
type Type = typeof type;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* When the snapshot of a manual layout changes
|
|
21
|
+
* Send by the editor to the language server
|
|
22
|
+
*/
|
|
23
|
+
declare namespace DidChangeSnapshotNotification {
|
|
24
|
+
type Params = {
|
|
25
|
+
snapshotUri: DocumentUri;
|
|
26
|
+
};
|
|
27
|
+
const Method: "likec4/onDidChangeSnapshot";
|
|
28
|
+
const type: NotificationType<Params>;
|
|
29
|
+
type Type = typeof type;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* When server requests to open a likec4 preview panel
|
|
33
|
+
* (available only in the editor).
|
|
34
|
+
* (not the best place, but seems to be working)
|
|
35
|
+
*/
|
|
36
|
+
declare namespace DidRequestOpenViewNotification {
|
|
37
|
+
type Params = {
|
|
38
|
+
viewId: ViewId;
|
|
39
|
+
projectId: ProjectId;
|
|
40
|
+
};
|
|
41
|
+
const type: NotificationType<Params>;
|
|
42
|
+
type Type = typeof type;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Request to fetch the computed model data
|
|
46
|
+
* If LSP has multiple projects, the projectId is required.
|
|
47
|
+
* otherwise throws an error.
|
|
48
|
+
*/
|
|
49
|
+
declare namespace FetchComputedModel {
|
|
50
|
+
type Params = {
|
|
51
|
+
projectId?: string | undefined;
|
|
52
|
+
cleanCaches?: boolean | undefined;
|
|
53
|
+
};
|
|
54
|
+
type Res = {
|
|
55
|
+
model: ComputedLikeC4ModelData | null;
|
|
56
|
+
};
|
|
57
|
+
const req: RequestType<Params, Res, void>;
|
|
58
|
+
type Req = typeof req;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Request to fetch all views of all projects
|
|
62
|
+
*/
|
|
63
|
+
declare namespace FetchViewsFromAllProjects {
|
|
64
|
+
type Res = {
|
|
65
|
+
views: Array<{
|
|
66
|
+
id: ViewId;
|
|
67
|
+
title: string;
|
|
68
|
+
projectId: ProjectId;
|
|
69
|
+
}>;
|
|
70
|
+
};
|
|
71
|
+
const req: RequestType0<Res, void>;
|
|
72
|
+
type Req = typeof req;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Request to fetch the layouted model data
|
|
76
|
+
* If LSP has multiple projects, the projectId is required.
|
|
77
|
+
* otherwise throws an error.
|
|
78
|
+
*/
|
|
79
|
+
declare namespace FetchLayoutedModel {
|
|
80
|
+
type Params = {
|
|
81
|
+
projectId?: string | undefined;
|
|
82
|
+
};
|
|
83
|
+
type Res = {
|
|
84
|
+
model: LayoutedLikeC4ModelData | null;
|
|
85
|
+
};
|
|
86
|
+
const req: RequestType<Params, Res, void>;
|
|
87
|
+
type Req = typeof req;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Request to layout a view.
|
|
91
|
+
* If LSP has multiple projects, the projectId is required.
|
|
92
|
+
*/
|
|
93
|
+
declare namespace LayoutView {
|
|
94
|
+
type Params = {
|
|
95
|
+
viewId: ViewId;
|
|
96
|
+
projectId?: string | undefined;
|
|
97
|
+
layoutType?: 'auto' | 'manual' | undefined;
|
|
98
|
+
};
|
|
99
|
+
type Res = {
|
|
100
|
+
result: {
|
|
101
|
+
dot: string;
|
|
102
|
+
diagram: DiagramView;
|
|
103
|
+
} | null;
|
|
104
|
+
};
|
|
105
|
+
const req: RequestType<Params, Res, void>;
|
|
106
|
+
type Req = typeof req;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Request to validate all views
|
|
110
|
+
* If projects ID is provided, it will validate only the views of that project.
|
|
111
|
+
*/
|
|
112
|
+
declare namespace ValidateLayout {
|
|
113
|
+
type Params = {
|
|
114
|
+
projectId?: string;
|
|
115
|
+
};
|
|
116
|
+
type Res = {
|
|
117
|
+
result: {
|
|
118
|
+
uri: string;
|
|
119
|
+
viewId: ViewId;
|
|
120
|
+
message: string;
|
|
121
|
+
severity: DiagnosticSeverity;
|
|
122
|
+
range: {
|
|
123
|
+
start: Position;
|
|
124
|
+
end: Position;
|
|
125
|
+
};
|
|
126
|
+
}[] | null;
|
|
127
|
+
};
|
|
128
|
+
const req: RequestType<Params, Res, void>;
|
|
129
|
+
type Req = typeof req;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Request to reload projects.
|
|
133
|
+
*/
|
|
134
|
+
declare namespace ReloadProjects {
|
|
135
|
+
type Params = never;
|
|
136
|
+
type Res = void;
|
|
137
|
+
const req: RequestType0<void, void>;
|
|
138
|
+
type Req = typeof req;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Fetch all non-empty projects.
|
|
142
|
+
*/
|
|
143
|
+
declare namespace FetchProjects {
|
|
144
|
+
type Params = never;
|
|
145
|
+
type Res = {
|
|
146
|
+
projects: {
|
|
147
|
+
[projectId: ProjectId]: {
|
|
148
|
+
folder: URI;
|
|
149
|
+
config: {
|
|
150
|
+
name: string;
|
|
151
|
+
title?: string | undefined;
|
|
152
|
+
};
|
|
153
|
+
docs: NonEmptyArray<DocumentUri>;
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
const req: RequestType0<Res, void>;
|
|
158
|
+
type Req = typeof req;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Request from the client to register a project.
|
|
162
|
+
*/
|
|
163
|
+
declare namespace RegisterProject {
|
|
164
|
+
type Params = {
|
|
165
|
+
folderUri: URI;
|
|
166
|
+
config: LikeC4ProjectJsonConfig;
|
|
167
|
+
configUri?: never;
|
|
168
|
+
} | {
|
|
169
|
+
configUri: URI;
|
|
170
|
+
folderUri?: never;
|
|
171
|
+
config?: never;
|
|
172
|
+
};
|
|
173
|
+
type Res = {
|
|
174
|
+
id: ProjectId;
|
|
175
|
+
};
|
|
176
|
+
const req: RequestType<Params, Res, void>;
|
|
177
|
+
type Req = typeof req;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Request to build documents.
|
|
181
|
+
*/
|
|
182
|
+
declare namespace BuildDocuments {
|
|
183
|
+
type Params = {
|
|
184
|
+
docs: DocumentUri[];
|
|
185
|
+
};
|
|
186
|
+
const req: RequestType<Params, void, void>;
|
|
187
|
+
type Req = typeof req;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Request to locate an element, relation, deployment or view.
|
|
191
|
+
* If LSP has multiple projects, the projectId is required.
|
|
192
|
+
*/
|
|
193
|
+
declare namespace Locate {
|
|
194
|
+
type Params =
|
|
195
|
+
/**
|
|
196
|
+
* Locate an element by its fqn
|
|
197
|
+
*/
|
|
198
|
+
{
|
|
199
|
+
element: Fqn;
|
|
200
|
+
projectId?: string | undefined;
|
|
201
|
+
property?: string;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Locate a relation by its id
|
|
205
|
+
*/
|
|
206
|
+
| {
|
|
207
|
+
projectId?: string | undefined;
|
|
208
|
+
relation: RelationId;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Locate a deployment by its fqn
|
|
212
|
+
*/
|
|
213
|
+
| {
|
|
214
|
+
deployment: DeploymentFqn;
|
|
215
|
+
projectId?: string | undefined;
|
|
216
|
+
property?: string;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Locate a step in a dynamic view by its astPath
|
|
220
|
+
*/
|
|
221
|
+
| {
|
|
222
|
+
view: ViewId;
|
|
223
|
+
astPath: string;
|
|
224
|
+
projectId?: string | undefined;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Locate a view by its id
|
|
228
|
+
*/
|
|
229
|
+
| {
|
|
230
|
+
view: ViewId;
|
|
231
|
+
projectId?: string | undefined;
|
|
232
|
+
};
|
|
233
|
+
type Res = Location | null;
|
|
234
|
+
const req: RequestType<Params, Res, void>;
|
|
235
|
+
type Req = typeof req;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Request to change the view
|
|
239
|
+
* If LSP has multiple projects, the projectId is required.
|
|
240
|
+
*/
|
|
241
|
+
declare namespace ChangeView {
|
|
242
|
+
type Params = {
|
|
243
|
+
viewId: ViewId;
|
|
244
|
+
change: ViewChange;
|
|
245
|
+
projectId?: string | undefined;
|
|
246
|
+
};
|
|
247
|
+
type Res = {
|
|
248
|
+
success: true;
|
|
249
|
+
location: Location | null;
|
|
250
|
+
} | {
|
|
251
|
+
success: false;
|
|
252
|
+
location?: Location | null;
|
|
253
|
+
error: string;
|
|
254
|
+
};
|
|
255
|
+
const req: RequestType<Params, Res, void>;
|
|
256
|
+
type Req = typeof req;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Request to fetch telemetry metrics
|
|
260
|
+
*/
|
|
261
|
+
declare namespace FetchTelemetryMetrics {
|
|
262
|
+
type Res = {
|
|
263
|
+
metrics: null | {
|
|
264
|
+
elementKinds: number;
|
|
265
|
+
deploymentKinds: number;
|
|
266
|
+
relationshipKinds: number;
|
|
267
|
+
tags: number;
|
|
268
|
+
customColors: number;
|
|
269
|
+
elements: number;
|
|
270
|
+
deploymentNodes: number;
|
|
271
|
+
relationships: number;
|
|
272
|
+
views: number;
|
|
273
|
+
projects: number;
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
const req: RequestType0<Res, void>;
|
|
277
|
+
type Req = typeof req;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Request to fetch all tags of a document
|
|
281
|
+
*/
|
|
282
|
+
declare namespace GetDocumentTags {
|
|
283
|
+
type Params = {
|
|
284
|
+
documentUri: DocumentUri;
|
|
285
|
+
};
|
|
286
|
+
type Res = {
|
|
287
|
+
/**
|
|
288
|
+
* Project ID this document belongs to (or default project if none).
|
|
289
|
+
*/
|
|
290
|
+
projectId: ProjectId;
|
|
291
|
+
/**
|
|
292
|
+
* Used tags in the document
|
|
293
|
+
*/
|
|
294
|
+
tags: Array<{
|
|
295
|
+
name: string;
|
|
296
|
+
range: Range;
|
|
297
|
+
color: ColorLiteral;
|
|
298
|
+
isSpecification?: boolean;
|
|
299
|
+
}>;
|
|
300
|
+
};
|
|
301
|
+
const req: RequestType<Params, Res, void>;
|
|
302
|
+
type Req = typeof req;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Request to fetch projects overview diagram
|
|
306
|
+
*/
|
|
307
|
+
declare namespace FetchProjectsOverview {
|
|
308
|
+
type Res = {
|
|
309
|
+
projectsView: LayoutedProjectsView | null;
|
|
310
|
+
};
|
|
311
|
+
const req: RequestType0<Res, void>;
|
|
312
|
+
type Req = typeof req;
|
|
313
|
+
}
|
|
314
|
+
//#endregion
|
|
315
|
+
export { ReloadProjects as _, DidChangeSnapshotNotification as a, FetchLayoutedModel as c, FetchTelemetryMetrics as d, FetchViewsFromAllProjects as f, RegisterProject as g, Locate as h, DidChangeProjectsNotification as i, FetchProjects as l, LayoutView as m, ChangeView as n, DidRequestOpenViewNotification as o, GetDocumentTags as p, DidChangeModelNotification as r, FetchComputedModel as s, BuildDocuments as t, FetchProjectsOverview as u, ValidateLayout as v };
|