@likec4/language-server 1.32.2 → 1.34.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/README.md +27 -1
- package/dist/Rpc.d.ts +2 -0
- package/dist/Rpc.js +24 -6
- package/dist/ast.d.ts +6 -5
- package/dist/ast.js +3 -0
- package/dist/bundled.mjs +3194 -2547
- package/dist/formatting/LikeC4Formatter.d.ts +1 -0
- package/dist/formatting/LikeC4Formatter.js +25 -1
- package/dist/generated/ast.d.ts +21 -12
- package/dist/generated/ast.js +21 -9
- package/dist/generated/grammar.js +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -2
- package/dist/lsp/SemanticTokenProvider.js +1 -1
- package/dist/mcp/{LikeC4MCPServerFactory.d.ts → NoopLikeC4MCPServer.d.ts} +1 -9
- package/dist/mcp/interfaces.d.ts +11 -0
- package/dist/mcp/interfaces.js +0 -0
- package/dist/mcp/sseserver/MCPServer.d.ts +1 -1
- package/dist/mcp/sseserver/MCPServer.js +5 -5
- package/dist/mcp/sseserver/MCPServerFactory.js +30 -58
- package/dist/mcp/sseserver/{with-mcp-server.d.ts → WithMCPServer.d.ts} +1 -1
- package/dist/mcp/tools/_common.d.ts +68 -0
- package/dist/mcp/tools/_common.js +14 -0
- package/dist/mcp/tools/list-projects.d.ts +6 -0
- package/dist/mcp/tools/list-projects.js +31 -0
- package/dist/mcp/tools/open-view.d.ts +10 -0
- package/dist/mcp/tools/open-view.js +29 -0
- package/dist/mcp/tools/read-element.d.ts +10 -0
- package/dist/mcp/tools/read-element.js +135 -0
- package/dist/mcp/tools/read-project-elements.d.ts +8 -0
- package/dist/mcp/tools/read-project-elements.js +93 -0
- package/dist/mcp/tools/read-project-summary.d.ts +8 -0
- package/dist/mcp/tools/read-project-summary.js +68 -0
- package/dist/mcp/tools/read-view.d.ts +10 -0
- package/dist/mcp/tools/read-view.js +164 -0
- package/dist/mcp/tools/search-element.d.ts +8 -0
- package/dist/mcp/tools/search-element.js +105 -0
- package/dist/mcp/utils.d.ts +17 -34
- package/dist/mcp/utils.js +41 -101
- package/dist/model/builder/MergedSpecification.js +8 -4
- package/dist/model/index.d.ts +1 -0
- package/dist/model/index.js +1 -0
- package/dist/model/model-parser-where.d.ts +1 -0
- package/dist/model/model-parser-where.js +30 -24
- package/dist/model/model-parser.d.ts +140 -0
- package/dist/model/parser/Base.d.ts +30 -2
- package/dist/model/parser/Base.js +54 -3
- package/dist/model/parser/DeploymentModelParser.d.ts +17 -1
- package/dist/model/parser/DeploymentModelParser.js +24 -21
- package/dist/model/parser/DeploymentViewParser.d.ts +17 -1
- package/dist/model/parser/DeploymentViewParser.js +15 -6
- package/dist/model/parser/FqnRefParser.d.ts +17 -1
- package/dist/model/parser/FqnRefParser.js +42 -16
- package/dist/model/parser/GlobalsParser.d.ts +17 -1
- package/dist/model/parser/ImportsParser.d.ts +14 -0
- package/dist/model/parser/ModelParser.d.ts +17 -1
- package/dist/model/parser/ModelParser.js +22 -14
- package/dist/model/parser/PredicatesParser.d.ts +17 -1
- package/dist/model/parser/SpecificationParser.d.ts +14 -0
- package/dist/model/parser/SpecificationParser.js +16 -11
- package/dist/model/parser/ValueConverter.d.ts +4 -0
- package/dist/model/parser/ValueConverter.js +12 -0
- package/dist/model/parser/ViewsParser.d.ts +17 -1
- package/dist/model/parser/ViewsParser.js +21 -7
- package/dist/module.d.ts +5 -4
- package/dist/module.js +6 -7
- package/dist/protocol.d.ts +16 -0
- package/dist/protocol.js +4 -0
- package/dist/validation/property-checks.js +1 -1
- package/dist/views/configurable-layouter.js +22 -28
- package/dist/views/likec4-views.d.ts +5 -0
- package/dist/views/likec4-views.js +6 -1
- package/package.json +20 -19
- package/dist/mcp/LikeC4MCPTools.d.ts +0 -96
- package/dist/mcp/LikeC4MCPTools.js +0 -290
- /package/dist/mcp/{LikeC4MCPServerFactory.js → NoopLikeC4MCPServer.js} +0 -0
- /package/dist/mcp/sseserver/{with-mcp-server.js → WithMCPServer.js} +0 -0
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@ likec4-language-server --stdio
|
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
Valid arguments:
|
|
15
|
+
|
|
15
16
|
- `--node-ipc`
|
|
16
17
|
- `--stdio`
|
|
17
18
|
- `--socket={number}`
|
|
@@ -19,9 +20,34 @@ Valid arguments:
|
|
|
19
20
|
### Usage in code
|
|
20
21
|
|
|
21
22
|
```js
|
|
22
|
-
import { startLanguageServer } from '@likec4/language-server/bundled'
|
|
23
|
+
import { startLanguageServer } from '@likec4/language-server/bundled'
|
|
23
24
|
startLanguageServer().catch((e) => {
|
|
24
25
|
console.error(e)
|
|
25
26
|
process.exit(1)
|
|
26
27
|
})
|
|
27
28
|
```
|
|
29
|
+
|
|
30
|
+
## Getting help
|
|
31
|
+
|
|
32
|
+
We are always happy to help you get started:
|
|
33
|
+
|
|
34
|
+
- [Join Discord community](https://discord.gg/86ZSpjKAdA) – it is the easiest way to get help
|
|
35
|
+
- [GitHub Discussions](https://github.com/likec4/likec4/discussions) – ask anything about the project or give feedback
|
|
36
|
+
|
|
37
|
+
## Contributors
|
|
38
|
+
|
|
39
|
+
<a href="https://github.com/likec4/likec4/graphs/contributors">
|
|
40
|
+
<img src="https://contrib.rocks/image?repo=likec4/likec4" />
|
|
41
|
+
</a>
|
|
42
|
+
|
|
43
|
+
[Become a contributor](../../CONTRIBUTING.md)
|
|
44
|
+
|
|
45
|
+
## Support development
|
|
46
|
+
|
|
47
|
+
LikeC4 is a MIT-licensed open source project with its ongoing development made possible entirely by your support.\
|
|
48
|
+
If you like the project, please consider contributing financially to help grow and improve it.\
|
|
49
|
+
You can support us via [OpenCollective](https://opencollective.com/likec4) or [GitHub Sponsors](https://github.com/sponsors/likec4).
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
This project is released under the [MIT License](LICENSE)
|
package/dist/Rpc.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { LikeC4Services } from './module';
|
|
2
|
+
import { DidRequestOpenViewNotification } from './protocol';
|
|
2
3
|
import { ADisposable } from './utils';
|
|
3
4
|
export declare class Rpc extends ADisposable {
|
|
4
5
|
private services;
|
|
5
6
|
constructor(services: LikeC4Services);
|
|
6
7
|
init(): void;
|
|
8
|
+
openView(params: DidRequestOpenViewNotification.Params): Promise<void>;
|
|
7
9
|
}
|
package/dist/Rpc.js
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
ChangeView,
|
|
12
12
|
ComputeView,
|
|
13
13
|
DidChangeModelNotification,
|
|
14
|
+
DidRequestOpenViewNotification,
|
|
14
15
|
FetchComputedModel,
|
|
15
16
|
FetchLayoutedModel,
|
|
16
17
|
FetchProjects,
|
|
@@ -195,12 +196,15 @@ export class Rpc extends ADisposable {
|
|
|
195
196
|
return Promise.reject(new Error(`Model is empty`));
|
|
196
197
|
}
|
|
197
198
|
return {
|
|
198
|
-
elementKinds: keys(model
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
199
|
+
elementKinds: keys(model.specification.elements).length,
|
|
200
|
+
deploymentKinds: keys(model.specification.deployments).length,
|
|
201
|
+
relationshipKinds: keys(model.specification.relationships).length,
|
|
202
|
+
tags: keys(model.specification.tags).length,
|
|
203
|
+
customColors: keys(model.specification.customColors ?? {}).length,
|
|
204
|
+
elements: keys(model.$data.elements).length,
|
|
205
|
+
deploymentNodes: [...model.deployment.nodes()].length,
|
|
206
|
+
relationships: keys(model.$data.relations).length,
|
|
207
|
+
views: keys(model.$data.views).length,
|
|
204
208
|
projects: 1
|
|
205
209
|
};
|
|
206
210
|
});
|
|
@@ -209,9 +213,12 @@ export class Rpc extends ADisposable {
|
|
|
209
213
|
const values = results.filter((r) => r.status === "fulfilled").map((r) => r.value);
|
|
210
214
|
const metrics = values.length > 0 ? values.reduce((acc, r) => ({
|
|
211
215
|
elementKinds: acc.elementKinds + r.elementKinds,
|
|
216
|
+
deploymentKinds: acc.deploymentKinds + r.deploymentKinds,
|
|
212
217
|
relationshipKinds: acc.relationshipKinds + r.relationshipKinds,
|
|
213
218
|
tags: acc.tags + r.tags,
|
|
219
|
+
customColors: acc.customColors + r.customColors,
|
|
214
220
|
elements: acc.elements + r.elements,
|
|
221
|
+
deploymentNodes: acc.deploymentNodes + r.deploymentNodes,
|
|
215
222
|
relationships: acc.relationships + r.relationships,
|
|
216
223
|
views: acc.views + r.views,
|
|
217
224
|
projects: acc.projects + 1
|
|
@@ -246,4 +253,15 @@ export class Rpc extends ADisposable {
|
|
|
246
253
|
);
|
|
247
254
|
}
|
|
248
255
|
}
|
|
256
|
+
async openView(params) {
|
|
257
|
+
const lspConnection = this.services.shared.lsp.Connection;
|
|
258
|
+
if (!lspConnection) {
|
|
259
|
+
logger.error("No LSP connection");
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
await lspConnection.sendNotification(
|
|
263
|
+
DidRequestOpenViewNotification.type,
|
|
264
|
+
params
|
|
265
|
+
);
|
|
266
|
+
}
|
|
249
267
|
}
|
package/dist/ast.d.ts
CHANGED
|
@@ -71,7 +71,7 @@ export interface ParsedAstElement {
|
|
|
71
71
|
astPath: string;
|
|
72
72
|
kind: c4.ElementKind;
|
|
73
73
|
title: string;
|
|
74
|
-
description?:
|
|
74
|
+
description?: c4.MarkdownOrString;
|
|
75
75
|
technology?: string;
|
|
76
76
|
tags?: c4.NonEmptyArray<c4.Tag>;
|
|
77
77
|
links?: c4.NonEmptyArray<c4.Link>;
|
|
@@ -97,7 +97,7 @@ export interface ParsedAstRelation {
|
|
|
97
97
|
kind?: c4.RelationshipKind;
|
|
98
98
|
tags?: c4.NonEmptyArray<c4.Tag>;
|
|
99
99
|
title: string;
|
|
100
|
-
description?:
|
|
100
|
+
description?: c4.MarkdownOrString;
|
|
101
101
|
technology?: string;
|
|
102
102
|
color?: c4.Color;
|
|
103
103
|
line?: c4.RelationshipLineType;
|
|
@@ -126,7 +126,7 @@ export interface ParsedAstElementView {
|
|
|
126
126
|
extends?: c4.ViewId;
|
|
127
127
|
astPath: string;
|
|
128
128
|
title: string | null;
|
|
129
|
-
description:
|
|
129
|
+
description: c4.MarkdownOrString | null;
|
|
130
130
|
tags: c4.NonEmptyArray<c4.Tag> | null;
|
|
131
131
|
links: c4.NonEmptyArray<c4.Link> | null;
|
|
132
132
|
rules: c4.ElementViewRule[];
|
|
@@ -136,7 +136,7 @@ export interface ParsedAstDynamicView {
|
|
|
136
136
|
id: c4.ViewId;
|
|
137
137
|
astPath: string;
|
|
138
138
|
title: string | null;
|
|
139
|
-
description:
|
|
139
|
+
description: c4.MarkdownOrString | null;
|
|
140
140
|
tags: c4.NonEmptyArray<c4.Tag> | null;
|
|
141
141
|
links: c4.NonEmptyArray<c4.Link> | null;
|
|
142
142
|
steps: c4.DynamicViewStepOrParallel[];
|
|
@@ -147,7 +147,7 @@ export interface ParsedAstDeploymentView {
|
|
|
147
147
|
id: c4.ViewId;
|
|
148
148
|
astPath: string;
|
|
149
149
|
title: string | null;
|
|
150
|
-
description:
|
|
150
|
+
description: c4.MarkdownOrString | null;
|
|
151
151
|
tags: c4.NonEmptyArray<c4.Tag> | null;
|
|
152
152
|
links: c4.NonEmptyArray<c4.Link> | null;
|
|
153
153
|
rules: Array<c4.DeploymentViewRule>;
|
|
@@ -189,6 +189,7 @@ export interface ParsedLikeC4LangiumDocument extends LikeC4GrammarDocument, Requ
|
|
|
189
189
|
}
|
|
190
190
|
export declare function isLikeC4LangiumDocument(doc: LangiumDocument): doc is LikeC4LangiumDocument;
|
|
191
191
|
export declare function isParsedLikeC4LangiumDocument(doc: LangiumDocument): doc is ParsedLikeC4LangiumDocument;
|
|
192
|
+
export declare function parseMarkdownAsString(node?: ast.MarkdownOrString): string | undefined;
|
|
192
193
|
export declare function parseAstPercent(value: string): number;
|
|
193
194
|
export declare function parseAstOpacityProperty({ value }: ast.OpacityProperty): number;
|
|
194
195
|
export declare function parseAstSizeValue({ value }: {
|
package/dist/ast.js
CHANGED
|
@@ -33,6 +33,9 @@ export function isLikeC4LangiumDocument(doc) {
|
|
|
33
33
|
export function isParsedLikeC4LangiumDocument(doc) {
|
|
34
34
|
return isLikeC4LangiumDocument(doc) && doc.state == DocumentState.Validated && !!doc.c4Specification && !!doc.c4Elements && !!doc.c4ExtendElements && !!doc.c4ExtendDeployments && !!doc.c4Relations && !!doc.c4Views && !!doc.c4Deployments && !!doc.c4DeploymentRelations && !!doc.c4Imports;
|
|
35
35
|
}
|
|
36
|
+
export function parseMarkdownAsString(node) {
|
|
37
|
+
return node?.markdown || node?.text;
|
|
38
|
+
}
|
|
36
39
|
export function parseAstPercent(value) {
|
|
37
40
|
const opacity = parseFloat(value);
|
|
38
41
|
return isNaN(opacity) ? 100 : clamp(opacity, { min: 0, max: 100 });
|