@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
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type DiagramView, type NonEmptyArray, type ProjectId
|
|
1
|
+
import { type DiagramView, type NonEmptyArray, type ProjectId } from '@likec4/core';
|
|
2
|
+
import { LikeC4Model } from '@likec4/core/model';
|
|
2
3
|
import { URI } from 'langium';
|
|
3
4
|
import { type Range } from 'vscode-languageserver-types';
|
|
4
5
|
import type { ProjectConfig } from './config';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { nonexhaustive } from "@likec4/core";
|
|
2
|
+
import { LikeC4Model } from "@likec4/core/model";
|
|
2
3
|
import { loggable } from "@likec4/log";
|
|
3
4
|
import { URI } from "langium";
|
|
4
5
|
import { entries, hasAtLeast, indexBy, map, pipe, prop } from "remeda";
|
|
@@ -74,8 +75,8 @@ export class DefaultLikeC4LanguageServices {
|
|
|
74
75
|
}
|
|
75
76
|
const diagrams = await this.views.diagrams(projectId);
|
|
76
77
|
return LikeC4Model.create({
|
|
77
|
-
...parsed,
|
|
78
|
-
|
|
78
|
+
...parsed.$data,
|
|
79
|
+
_stage: "layouted",
|
|
79
80
|
views: indexBy(diagrams, prop("id"))
|
|
80
81
|
});
|
|
81
82
|
}
|
package/dist/Rpc.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { filter, flatMap, funnel, indexBy, keys, map, mapValues, pipe, sort } from "remeda";
|
|
2
2
|
import { logger as rootLogger } from "./logger.js";
|
|
3
3
|
import {
|
|
4
|
-
LikeC4Model,
|
|
5
4
|
nonexhaustive
|
|
6
5
|
} from "@likec4/core";
|
|
6
|
+
import { LikeC4Model } from "@likec4/core/model";
|
|
7
7
|
import { Disposable, interruptAndCheck, URI, UriUtils } from "langium";
|
|
8
8
|
import { DiagnosticSeverity } from "vscode-languageserver";
|
|
9
9
|
import {
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
FetchProjects,
|
|
17
17
|
FetchTelemetryMetrics,
|
|
18
18
|
FetchViewsFromAllProjects,
|
|
19
|
+
GetDocumentTags,
|
|
19
20
|
LayoutView,
|
|
20
21
|
Locate,
|
|
21
22
|
ValidateLayout
|
|
@@ -84,8 +85,8 @@ export class Rpc extends ADisposable {
|
|
|
84
85
|
const diagrams = await views.diagrams(projectId, cancelToken);
|
|
85
86
|
return {
|
|
86
87
|
model: {
|
|
87
|
-
...model,
|
|
88
|
-
|
|
88
|
+
...model.$data,
|
|
89
|
+
_stage: "layouted",
|
|
89
90
|
views: indexBy(diagrams, (d) => d.id)
|
|
90
91
|
}
|
|
91
92
|
};
|
|
@@ -196,7 +197,7 @@ export class Rpc extends ADisposable {
|
|
|
196
197
|
return {
|
|
197
198
|
elementKinds: keys(model.$model.specification.elements).length,
|
|
198
199
|
relationshipKinds: keys(model.$model.specification.relationships).length,
|
|
199
|
-
tags: model.$model.specification.tags.length,
|
|
200
|
+
tags: keys(model.$model.specification.tags ?? {}).length,
|
|
200
201
|
elements: keys(model.$model.elements).length,
|
|
201
202
|
relationships: keys(model.$model.relations).length,
|
|
202
203
|
views: keys(model.$model.views).length,
|
|
@@ -219,6 +220,12 @@ export class Rpc extends ADisposable {
|
|
|
219
220
|
metrics
|
|
220
221
|
};
|
|
221
222
|
}),
|
|
223
|
+
connection.onRequest(GetDocumentTags.req, async ({ documentUri }, cancelToken) => {
|
|
224
|
+
const tags = await modelLocator.locateDocumentTags(URI.parse(documentUri), cancelToken);
|
|
225
|
+
return {
|
|
226
|
+
tags
|
|
227
|
+
};
|
|
228
|
+
}),
|
|
222
229
|
Disposable.create(() => {
|
|
223
230
|
notifyModelParsed.cancel();
|
|
224
231
|
})
|
package/dist/ast.d.ts
CHANGED
|
@@ -48,12 +48,11 @@ export type ParsedElementStyle = {
|
|
|
48
48
|
textSize?: c4.TextSize;
|
|
49
49
|
};
|
|
50
50
|
export interface ParsedAstSpecification {
|
|
51
|
-
tags:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
notation?: string;
|
|
55
|
-
style: ParsedElementStyle;
|
|
51
|
+
tags: Record<c4.Tag, {
|
|
52
|
+
astPath: string;
|
|
53
|
+
color?: c4.ColorLiteral;
|
|
56
54
|
}>;
|
|
55
|
+
elements: Record<c4.ElementKind, c4.ElementSpecification>;
|
|
57
56
|
relationships: Record<c4.RelationshipKind, {
|
|
58
57
|
technology?: string;
|
|
59
58
|
notation?: string;
|
|
@@ -63,9 +62,9 @@ export interface ParsedAstSpecification {
|
|
|
63
62
|
tail?: c4.RelationshipArrowType;
|
|
64
63
|
}>;
|
|
65
64
|
colors: Record<c4.CustomColor, {
|
|
66
|
-
color: c4.
|
|
65
|
+
color: c4.ColorLiteral;
|
|
67
66
|
}>;
|
|
68
|
-
deployments: Record<c4.
|
|
67
|
+
deployments: Record<c4.DeploymentKind, c4.ElementSpecification>;
|
|
69
68
|
}
|
|
70
69
|
export interface ParsedAstElement {
|
|
71
70
|
id: c4.Fqn;
|
|
@@ -93,8 +92,8 @@ export interface ParsedAstExtend {
|
|
|
93
92
|
export interface ParsedAstRelation {
|
|
94
93
|
id: c4.RelationId;
|
|
95
94
|
astPath: string;
|
|
96
|
-
source: c4.FqnRef.ModelRef
|
|
97
|
-
target: c4.FqnRef.ModelRef
|
|
95
|
+
source: c4.FqnRef.ModelRef;
|
|
96
|
+
target: c4.FqnRef.ModelRef;
|
|
98
97
|
kind?: c4.RelationshipKind;
|
|
99
98
|
tags?: c4.NonEmptyArray<c4.Tag>;
|
|
100
99
|
title: string;
|
|
@@ -114,15 +113,14 @@ export type ParsedAstDeployment = Simplify<MergeExclusive<ParsedAstDeployment.No
|
|
|
114
113
|
export declare namespace ParsedAstDeployment {
|
|
115
114
|
type Node = c4.DeploymentNode;
|
|
116
115
|
type Instance = Omit<c4.DeployedInstance, 'element'> & {
|
|
117
|
-
readonly element: c4.FqnRef.ModelRef
|
|
116
|
+
readonly element: c4.FqnRef.ModelRef;
|
|
118
117
|
};
|
|
119
118
|
}
|
|
120
|
-
export type ParsedAstDeploymentRelation = c4.
|
|
119
|
+
export type ParsedAstDeploymentRelation = c4.DeploymentRelationship & {
|
|
121
120
|
astPath: string;
|
|
122
121
|
};
|
|
123
122
|
export type ParsedAstGlobals = Writable<c4.ModelGlobals>;
|
|
124
123
|
export interface ParsedAstElementView {
|
|
125
|
-
__: 'element';
|
|
126
124
|
id: c4.ViewId;
|
|
127
125
|
viewOf?: c4.Fqn;
|
|
128
126
|
extends?: c4.ViewId;
|
|
@@ -131,11 +129,10 @@ export interface ParsedAstElementView {
|
|
|
131
129
|
description: string | null;
|
|
132
130
|
tags: c4.NonEmptyArray<c4.Tag> | null;
|
|
133
131
|
links: c4.NonEmptyArray<c4.Link> | null;
|
|
134
|
-
rules: c4.
|
|
132
|
+
rules: c4.ElementViewRule[];
|
|
135
133
|
manualLayout?: c4.ViewManualLayout;
|
|
136
134
|
}
|
|
137
135
|
export interface ParsedAstDynamicView {
|
|
138
|
-
__: 'dynamic';
|
|
139
136
|
id: c4.ViewId;
|
|
140
137
|
astPath: string;
|
|
141
138
|
title: string | null;
|
|
@@ -147,7 +144,6 @@ export interface ParsedAstDynamicView {
|
|
|
147
144
|
manualLayout?: c4.ViewManualLayout;
|
|
148
145
|
}
|
|
149
146
|
export interface ParsedAstDeploymentView {
|
|
150
|
-
__: 'deployment';
|
|
151
147
|
id: c4.ViewId;
|
|
152
148
|
astPath: string;
|
|
153
149
|
title: string | null;
|
|
@@ -193,6 +189,7 @@ export interface ParsedLikeC4LangiumDocument extends LikeC4GrammarDocument, Requ
|
|
|
193
189
|
}
|
|
194
190
|
export declare function isLikeC4LangiumDocument(doc: LangiumDocument): doc is LikeC4LangiumDocument;
|
|
195
191
|
export declare function isParsedLikeC4LangiumDocument(doc: LangiumDocument): doc is ParsedLikeC4LangiumDocument;
|
|
192
|
+
export declare function parseAstPercent(value: string): number;
|
|
196
193
|
export declare function parseAstOpacityProperty({ value }: ast.OpacityProperty): number;
|
|
197
194
|
export declare function parseAstSizeValue({ value }: {
|
|
198
195
|
value: ast.SizeValue;
|
package/dist/ast.js
CHANGED
|
@@ -33,10 +33,13 @@ 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
|
|
36
|
+
export function parseAstPercent(value) {
|
|
37
37
|
const opacity = parseFloat(value);
|
|
38
38
|
return isNaN(opacity) ? 100 : clamp(opacity, { min: 0, max: 100 });
|
|
39
39
|
}
|
|
40
|
+
export function parseAstOpacityProperty({ value }) {
|
|
41
|
+
return parseAstPercent(value);
|
|
42
|
+
}
|
|
40
43
|
export function parseAstSizeValue({ value }) {
|
|
41
44
|
switch (value) {
|
|
42
45
|
case "xs":
|