@likec4/language-server 1.35.0 → 1.36.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/dist/LikeC4FileSystem.js +2 -2
- package/dist/bundled.mjs +2457 -2454
- package/dist/config/schema.d.ts +1 -0
- package/dist/config/schema.js +7 -0
- package/dist/generated/ast.d.ts +1 -1
- package/dist/generated/grammar.d.ts +1 -1
- package/dist/generated/module.d.ts +1 -1
- package/dist/logger.js +4 -0
- package/dist/mcp/tools/list-projects.js +3 -0
- package/dist/mcp/tools/read-project-summary.js +3 -0
- package/dist/model/builder/buildModel.d.ts +7 -1
- package/dist/model/builder/buildModel.js +8 -2
- package/dist/model/model-builder.js +2 -1
- package/dist/model/model-parser.d.ts +9 -9
- package/dist/model/parser/DeploymentModelParser.d.ts +1 -1
- package/dist/model/parser/DeploymentViewParser.d.ts +1 -1
- package/dist/model/parser/FqnRefParser.d.ts +1 -1
- package/dist/model/parser/GlobalsParser.d.ts +1 -1
- package/dist/model/parser/ImportsParser.d.ts +1 -1
- package/dist/model/parser/ModelParser.d.ts +1 -1
- package/dist/model/parser/PredicatesParser.d.ts +1 -1
- package/dist/model/parser/SpecificationParser.d.ts +1 -1
- package/dist/model/parser/ViewsParser.d.ts +1 -1
- package/dist/model/parser/ViewsParser.js +7 -2
- package/dist/protocol.d.ts +1 -1
- package/dist/protocol.js +1 -1
- package/dist/views/likec4-views.d.ts +29 -8
- package/dist/views/likec4-views.js +5 -6
- package/dist/workspace/IndexManager.d.ts +1 -1
- package/dist/workspace/IndexManager.js +1 -2
- package/package.json +10 -9
package/dist/config/schema.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
2
|
export declare const ProjectConfig: v.ObjectSchema<{
|
|
3
3
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, "Project name cannot be empty">, v.ExcludesAction<string, "default", "Project name cannot be \"default\"">, v.ExcludesAction<string, ".", "Project name cannot contain \".\", try to use A-z, 0-9, _ and -">, v.ExcludesAction<string, "@", "Project name cannot contain \"@\", try to use A-z, 0-9, _ and -">, v.ExcludesAction<string, "#", "Project name cannot contain \"#\", try to use A-z, 0-9, _ and -">, v.DescriptionAction<string, "Project name, must be unique in the workspace">]>;
|
|
4
|
+
readonly title: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, "Project title cannot be empty if specified">, v.DescriptionAction<string, "A human readable title for the project">]>, undefined>;
|
|
4
5
|
readonly contactPerson: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, "Contact person cannot be empty if specified">, v.DescriptionAction<string, "A person who has been involved in creating or maintaining this project">]>, undefined>;
|
|
5
6
|
readonly exclude: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "List of file patterns to exclude from the project, default is [\"**/node_modules/**/*\"]">]>, undefined>;
|
|
6
7
|
}, undefined>;
|
package/dist/config/schema.js
CHANGED
|
@@ -10,6 +10,13 @@ export const ProjectConfig = v.object({
|
|
|
10
10
|
v.excludes("#", 'Project name cannot contain "#", try to use A-z, 0-9, _ and -'),
|
|
11
11
|
v.description("Project name, must be unique in the workspace")
|
|
12
12
|
),
|
|
13
|
+
title: v.optional(
|
|
14
|
+
v.pipe(
|
|
15
|
+
v.string(),
|
|
16
|
+
v.nonEmpty("Project title cannot be empty if specified"),
|
|
17
|
+
v.description("A human readable title for the project")
|
|
18
|
+
)
|
|
19
|
+
),
|
|
13
20
|
contactPerson: v.optional(
|
|
14
21
|
v.pipe(
|
|
15
22
|
v.string(),
|
package/dist/generated/ast.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
|
-
* This file was generated by langium-cli 3.5.
|
|
2
|
+
* This file was generated by langium-cli 3.5.2.
|
|
3
3
|
* DO NOT EDIT MANUALLY!
|
|
4
4
|
******************************************************************************/
|
|
5
5
|
import * as langium from 'langium';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
|
-
* This file was generated by langium-cli 3.5.
|
|
2
|
+
* This file was generated by langium-cli 3.5.2.
|
|
3
3
|
* DO NOT EDIT MANUALLY!
|
|
4
4
|
******************************************************************************/
|
|
5
5
|
import type { Grammar } from 'langium';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
|
-
* This file was generated by langium-cli 3.5.
|
|
2
|
+
* This file was generated by langium-cli 3.5.2.
|
|
3
3
|
* DO NOT EDIT MANUALLY!
|
|
4
4
|
******************************************************************************/
|
|
5
5
|
import type { LangiumSharedCoreServices, LangiumCoreServices, LangiumGeneratedCoreServices, LangiumGeneratedSharedCoreServices, Module, IParserConfig } from 'langium';
|
package/dist/logger.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { nonexhaustive } from "@likec4/core";
|
|
1
2
|
import {
|
|
2
3
|
errorFromLogRecord,
|
|
3
4
|
getMessageOnlyFormatter,
|
|
@@ -21,6 +22,7 @@ export function getLspConnectionSink(connection, props) {
|
|
|
21
22
|
return (logObj) => {
|
|
22
23
|
try {
|
|
23
24
|
switch (logObj.level) {
|
|
25
|
+
case "trace":
|
|
24
26
|
case "debug":
|
|
25
27
|
connection.console.debug(format(logObj));
|
|
26
28
|
break;
|
|
@@ -35,6 +37,8 @@ export function getLspConnectionSink(connection, props) {
|
|
|
35
37
|
connection.console.error(format(logObj));
|
|
36
38
|
break;
|
|
37
39
|
}
|
|
40
|
+
default:
|
|
41
|
+
nonexhaustive(logObj.level);
|
|
38
42
|
}
|
|
39
43
|
} catch (e) {
|
|
40
44
|
console.error("Error while logging to LSP connection:", e);
|
|
@@ -6,6 +6,7 @@ export const listProjects = likec4Tool({
|
|
|
6
6
|
Lists all available LikeC4 projects in the workspace.
|
|
7
7
|
Returns array of projects with:
|
|
8
8
|
- name: project name (project id)
|
|
9
|
+
- title: human readable title
|
|
9
10
|
- folder: project folder
|
|
10
11
|
- sources: array of project sources
|
|
11
12
|
`,
|
|
@@ -15,6 +16,7 @@ Returns array of projects with:
|
|
|
15
16
|
outputSchema: {
|
|
16
17
|
projects: z.array(z.object({
|
|
17
18
|
name: z.string(),
|
|
19
|
+
title: z.string().optional(),
|
|
18
20
|
folder: z.string(),
|
|
19
21
|
sources: z.array(z.string())
|
|
20
22
|
}))
|
|
@@ -24,6 +26,7 @@ Returns array of projects with:
|
|
|
24
26
|
return {
|
|
25
27
|
projects: projects.map((p) => ({
|
|
26
28
|
name: p.id,
|
|
29
|
+
title: p.config?.title,
|
|
27
30
|
folder: p.folder.toString(),
|
|
28
31
|
sources: p.documents?.map((d) => d.toString()) ?? []
|
|
29
32
|
}))
|
|
@@ -11,6 +11,7 @@ export const readProjectSummary = likec4Tool({
|
|
|
11
11
|
},
|
|
12
12
|
description: `
|
|
13
13
|
Searches for LikeC4 project by name in workspace and returns its summary:
|
|
14
|
+
- project human readable title
|
|
14
15
|
- project folder
|
|
15
16
|
- array of the source filenames
|
|
16
17
|
- specification:
|
|
@@ -28,6 +29,7 @@ Searches for LikeC4 project by name in workspace and returns its summary:
|
|
|
28
29
|
project: z.string().optional().describe('Project name (optional, will use "default" if not specified)')
|
|
29
30
|
},
|
|
30
31
|
outputSchema: {
|
|
32
|
+
title: z.string().optional(),
|
|
31
33
|
folder: z.string(),
|
|
32
34
|
sources: z.array(z.string()),
|
|
33
35
|
specification: z.object({
|
|
@@ -50,6 +52,7 @@ Searches for LikeC4 project by name in workspace and returns its summary:
|
|
|
50
52
|
invariant(project, `Project "${projectId}" not found`);
|
|
51
53
|
const model = await languageServices.computedModel(project.id);
|
|
52
54
|
return {
|
|
55
|
+
title: project.config?.title,
|
|
53
56
|
folder: project.folder.toString(),
|
|
54
57
|
sources: project.documents?.map((d) => d.toString()) ?? [],
|
|
55
58
|
specification: {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as c4 from '@likec4/core';
|
|
2
2
|
import { type MultiMap } from '@likec4/core';
|
|
3
|
+
import type { URI } from 'langium';
|
|
3
4
|
import type { ParsedLikeC4LangiumDocument } from '../../ast';
|
|
5
|
+
import type { ProjectConfig } from '../../config';
|
|
4
6
|
export type BuildModelData = {
|
|
5
7
|
data: c4.ParsedLikeC4ModelData;
|
|
6
8
|
imports: MultiMap<c4.ProjectId, c4.Fqn, Set<c4.Fqn>>;
|
|
@@ -12,4 +14,8 @@ export type BuildModelData = {
|
|
|
12
14
|
* This function builds a model from all documents, merging the specifications
|
|
13
15
|
* and globals, and applying the extends to the elements.
|
|
14
16
|
*/
|
|
15
|
-
export declare function buildModelData(
|
|
17
|
+
export declare function buildModelData(project: {
|
|
18
|
+
id: c4.ProjectId;
|
|
19
|
+
folder: URI;
|
|
20
|
+
config: Readonly<ProjectConfig>;
|
|
21
|
+
}, docs: ParsedLikeC4LangiumDocument[]): BuildModelData;
|
|
@@ -26,7 +26,7 @@ import { logger } from "../../logger.js";
|
|
|
26
26
|
import { resolveRelativePaths } from "../../view-utils/index.js";
|
|
27
27
|
import { MergedExtends } from "./MergedExtends.js";
|
|
28
28
|
import { MergedSpecification } from "./MergedSpecification.js";
|
|
29
|
-
export function buildModelData(
|
|
29
|
+
export function buildModelData(project, docs) {
|
|
30
30
|
const c4Specification = new MergedSpecification(docs);
|
|
31
31
|
const customColors = mapValues(
|
|
32
32
|
c4Specification.specs.colors,
|
|
@@ -190,10 +190,16 @@ export function buildModelData(projectId, docs) {
|
|
|
190
190
|
indexBy(prop("id")),
|
|
191
191
|
resolveRulesExtendedViews
|
|
192
192
|
);
|
|
193
|
+
const projectInfo = {
|
|
194
|
+
id: project.id,
|
|
195
|
+
name: project.config.name,
|
|
196
|
+
...project.config.title && { title: project.config.title }
|
|
197
|
+
};
|
|
193
198
|
return {
|
|
194
199
|
data: {
|
|
195
200
|
[c4._stage]: "parsed",
|
|
196
|
-
projectId,
|
|
201
|
+
projectId: project.id,
|
|
202
|
+
project: projectInfo,
|
|
197
203
|
specification: {
|
|
198
204
|
tags: c4Specification.tags,
|
|
199
205
|
elements: c4Specification.specs.elements,
|
|
@@ -82,13 +82,14 @@ export class DefaultLikeC4ModelBuilder extends ADisposable {
|
|
|
82
82
|
}
|
|
83
83
|
return cache.get(key, () => {
|
|
84
84
|
try {
|
|
85
|
+
const project = this.projects.getProject(projectId);
|
|
85
86
|
const docs = this.documents(projectId);
|
|
86
87
|
if (docs.length === 0) {
|
|
87
88
|
logger.debug`no documents to build model`;
|
|
88
89
|
return null;
|
|
89
90
|
}
|
|
90
91
|
logger.debug`unsafeSyncBuildModelData`;
|
|
91
|
-
return buildModelData(
|
|
92
|
+
return buildModelData(project, docs);
|
|
92
93
|
} catch (e) {
|
|
93
94
|
logWarnError(e);
|
|
94
95
|
return null;
|
|
@@ -55,7 +55,7 @@ declare const DocumentParserFromMixins: {
|
|
|
55
55
|
isValid: import("../validation").IsValidFn;
|
|
56
56
|
readonly services: LikeC4Services;
|
|
57
57
|
readonly doc: ParsedLikeC4LangiumDocument;
|
|
58
|
-
|
|
58
|
+
get project(): {
|
|
59
59
|
id: ProjectId;
|
|
60
60
|
folder: ProjectId;
|
|
61
61
|
config: Readonly<import("../config").ProjectConfig>;
|
|
@@ -148,7 +148,7 @@ declare const DocumentParserFromMixins: {
|
|
|
148
148
|
isValid: import("../validation").IsValidFn;
|
|
149
149
|
readonly services: LikeC4Services;
|
|
150
150
|
readonly doc: ParsedLikeC4LangiumDocument;
|
|
151
|
-
|
|
151
|
+
get project(): {
|
|
152
152
|
id: ProjectId;
|
|
153
153
|
folder: ProjectId;
|
|
154
154
|
config: Readonly<import("../config").ProjectConfig>;
|
|
@@ -203,7 +203,7 @@ declare const DocumentParserFromMixins: {
|
|
|
203
203
|
isValid: import("../validation").IsValidFn;
|
|
204
204
|
readonly services: LikeC4Services;
|
|
205
205
|
readonly doc: ParsedLikeC4LangiumDocument;
|
|
206
|
-
|
|
206
|
+
get project(): {
|
|
207
207
|
id: ProjectId;
|
|
208
208
|
folder: ProjectId;
|
|
209
209
|
config: Readonly<import("../config").ProjectConfig>;
|
|
@@ -272,7 +272,7 @@ declare const DocumentParserFromMixins: {
|
|
|
272
272
|
isValid: import("../validation").IsValidFn;
|
|
273
273
|
readonly services: LikeC4Services;
|
|
274
274
|
readonly doc: ParsedLikeC4LangiumDocument;
|
|
275
|
-
|
|
275
|
+
get project(): {
|
|
276
276
|
id: ProjectId;
|
|
277
277
|
folder: ProjectId;
|
|
278
278
|
config: Readonly<import("../config").ProjectConfig>;
|
|
@@ -334,7 +334,7 @@ declare const DocumentParserFromMixins: {
|
|
|
334
334
|
isValid: import("../validation").IsValidFn;
|
|
335
335
|
readonly services: LikeC4Services;
|
|
336
336
|
readonly doc: ParsedLikeC4LangiumDocument;
|
|
337
|
-
|
|
337
|
+
get project(): {
|
|
338
338
|
id: ProjectId;
|
|
339
339
|
folder: ProjectId;
|
|
340
340
|
config: Readonly<import("../config").ProjectConfig>;
|
|
@@ -404,7 +404,7 @@ declare const DocumentParserFromMixins: {
|
|
|
404
404
|
isValid: import("../validation").IsValidFn;
|
|
405
405
|
readonly services: LikeC4Services;
|
|
406
406
|
readonly doc: ParsedLikeC4LangiumDocument;
|
|
407
|
-
|
|
407
|
+
get project(): {
|
|
408
408
|
id: ProjectId;
|
|
409
409
|
folder: ProjectId;
|
|
410
410
|
config: Readonly<import("../config").ProjectConfig>;
|
|
@@ -467,7 +467,7 @@ declare const DocumentParserFromMixins: {
|
|
|
467
467
|
isValid: import("../validation").IsValidFn;
|
|
468
468
|
readonly services: LikeC4Services;
|
|
469
469
|
readonly doc: ParsedLikeC4LangiumDocument;
|
|
470
|
-
|
|
470
|
+
get project(): {
|
|
471
471
|
id: ProjectId;
|
|
472
472
|
folder: ProjectId;
|
|
473
473
|
config: Readonly<import("../config").ProjectConfig>;
|
|
@@ -510,7 +510,7 @@ declare const DocumentParserFromMixins: {
|
|
|
510
510
|
isValid: import("../validation").IsValidFn;
|
|
511
511
|
readonly services: LikeC4Services;
|
|
512
512
|
readonly doc: ParsedLikeC4LangiumDocument;
|
|
513
|
-
|
|
513
|
+
get project(): {
|
|
514
514
|
id: ProjectId;
|
|
515
515
|
folder: ProjectId;
|
|
516
516
|
config: Readonly<import("../config").ProjectConfig>;
|
|
@@ -568,7 +568,7 @@ declare const DocumentParserFromMixins: {
|
|
|
568
568
|
isValid: import("../validation").IsValidFn;
|
|
569
569
|
readonly services: LikeC4Services;
|
|
570
570
|
readonly doc: ParsedLikeC4LangiumDocument;
|
|
571
|
-
|
|
571
|
+
get project(): {
|
|
572
572
|
id: ProjectId;
|
|
573
573
|
folder: ProjectId;
|
|
574
574
|
config: Readonly<import("../config").ProjectConfig>;
|
|
@@ -30,7 +30,7 @@ export declare function DeploymentModelParser<TBase extends WithExpressionV2>(B:
|
|
|
30
30
|
isValid: import("../../validation").IsValidFn;
|
|
31
31
|
readonly services: import("../..").LikeC4Services;
|
|
32
32
|
readonly doc: import("../../ast").ParsedLikeC4LangiumDocument;
|
|
33
|
-
|
|
33
|
+
get project(): {
|
|
34
34
|
id: c4.ProjectId;
|
|
35
35
|
folder: c4;
|
|
36
36
|
config: Readonly<import("../../config").ProjectConfig>;
|
|
@@ -28,7 +28,7 @@ export declare function DeploymentViewParser<TBase extends WithExpressionV2 & Wi
|
|
|
28
28
|
isValid: import("../../validation").IsValidFn;
|
|
29
29
|
readonly services: import("../..").LikeC4Services;
|
|
30
30
|
readonly doc: import("../../ast").ParsedLikeC4LangiumDocument;
|
|
31
|
-
|
|
31
|
+
get project(): {
|
|
32
32
|
id: c4.ProjectId;
|
|
33
33
|
folder: c4;
|
|
34
34
|
config: Readonly<import("../../config").ProjectConfig>;
|
|
@@ -23,7 +23,7 @@ export declare function ExpressionV2Parser<TBase extends Base>(B: TBase): {
|
|
|
23
23
|
isValid: import("../../validation").IsValidFn;
|
|
24
24
|
readonly services: import("../..").LikeC4Services;
|
|
25
25
|
readonly doc: import("../../ast").ParsedLikeC4LangiumDocument;
|
|
26
|
-
|
|
26
|
+
get project(): {
|
|
27
27
|
id: c4.ProjectId;
|
|
28
28
|
folder: c4;
|
|
29
29
|
config: Readonly<import("../../config").ProjectConfig>;
|
|
@@ -52,7 +52,7 @@ export declare function GlobalsParser<TBase extends WithViewsParser>(B: TBase):
|
|
|
52
52
|
isValid: import("../../validation").IsValidFn;
|
|
53
53
|
readonly services: import("../..").LikeC4Services;
|
|
54
54
|
readonly doc: import("../../ast").ParsedLikeC4LangiumDocument;
|
|
55
|
-
|
|
55
|
+
get project(): {
|
|
56
56
|
id: c4.ProjectId;
|
|
57
57
|
folder: c4;
|
|
58
58
|
config: Readonly<import("../../config").ProjectConfig>;
|
|
@@ -7,7 +7,7 @@ export declare function ImportsParser<TBase extends Base>(B: TBase): {
|
|
|
7
7
|
isValid: import("../../validation").IsValidFn;
|
|
8
8
|
readonly services: import("../..").LikeC4Services;
|
|
9
9
|
readonly doc: import("../../ast").ParsedLikeC4LangiumDocument;
|
|
10
|
-
|
|
10
|
+
get project(): {
|
|
11
11
|
id: ProjectId;
|
|
12
12
|
folder: ProjectId;
|
|
13
13
|
config: Readonly<import("../../config").ProjectConfig>;
|
|
@@ -29,7 +29,7 @@ export declare function ModelParser<TBase extends WithExpressionV2>(B: TBase): {
|
|
|
29
29
|
isValid: import("../../validation").IsValidFn;
|
|
30
30
|
readonly services: import("../..").LikeC4Services;
|
|
31
31
|
readonly doc: import("../../ast").ParsedLikeC4LangiumDocument;
|
|
32
|
-
|
|
32
|
+
get project(): {
|
|
33
33
|
id: c4.ProjectId;
|
|
34
34
|
folder: c4;
|
|
35
35
|
config: Readonly<import("../../config").ProjectConfig>;
|
|
@@ -34,7 +34,7 @@ export declare function PredicatesParser<TBase extends WithExpressionV2>(B: TBas
|
|
|
34
34
|
isValid: import("../../validation").IsValidFn;
|
|
35
35
|
readonly services: import("../..").LikeC4Services;
|
|
36
36
|
readonly doc: import("../../ast").ParsedLikeC4LangiumDocument;
|
|
37
|
-
|
|
37
|
+
get project(): {
|
|
38
38
|
id: c4.ProjectId;
|
|
39
39
|
folder: c4;
|
|
40
40
|
config: Readonly<import("../../config").ProjectConfig>;
|
|
@@ -13,7 +13,7 @@ export declare function SpecificationParser<TBase extends Base>(B: TBase): {
|
|
|
13
13
|
isValid: import("../../validation").IsValidFn;
|
|
14
14
|
readonly services: import("../..").LikeC4Services;
|
|
15
15
|
readonly doc: import("../../ast").ParsedLikeC4LangiumDocument;
|
|
16
|
-
|
|
16
|
+
get project(): {
|
|
17
17
|
id: c4.ProjectId;
|
|
18
18
|
folder: c4;
|
|
19
19
|
config: Readonly<import("../../config").ProjectConfig>;
|
|
@@ -50,7 +50,7 @@ export declare function ViewsParser<TBase extends WithPredicates & WithDeploymen
|
|
|
50
50
|
isValid: import("../../validation").IsValidFn;
|
|
51
51
|
readonly services: import("../..").LikeC4Services;
|
|
52
52
|
readonly doc: import("../../ast").ParsedLikeC4LangiumDocument;
|
|
53
|
-
|
|
53
|
+
get project(): {
|
|
54
54
|
id: c4.ProjectId;
|
|
55
55
|
folder: c4;
|
|
56
56
|
config: Readonly<import("../../config").ProjectConfig>;
|
|
@@ -354,13 +354,18 @@ export function ViewsParser(B) {
|
|
|
354
354
|
break;
|
|
355
355
|
}
|
|
356
356
|
case ast.isRelationStringProperty(prop):
|
|
357
|
-
case ast.isNotationProperty(prop):
|
|
358
|
-
case ast.isNotesProperty(prop): {
|
|
357
|
+
case ast.isNotationProperty(prop): {
|
|
359
358
|
if (isDefined(prop.value)) {
|
|
360
359
|
step[prop.key] = removeIndent(parseMarkdownAsString(prop.value)) ?? "";
|
|
361
360
|
}
|
|
362
361
|
break;
|
|
363
362
|
}
|
|
363
|
+
case ast.isNotesProperty(prop): {
|
|
364
|
+
if (isDefined(prop.value)) {
|
|
365
|
+
step[prop.key] = removeIndent(prop.value);
|
|
366
|
+
}
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
364
369
|
case ast.isArrowProperty(prop): {
|
|
365
370
|
if (isDefined(prop.value)) {
|
|
366
371
|
step[prop.key] = prop.value;
|
package/dist/protocol.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComputedLikeC4ModelData, ComputedView, DeploymentFqn, DiagramView, Fqn, LayoutedLikeC4ModelData, NonEmptyArray, ProjectId, RelationId, ViewChange, ViewId } from '@likec4/core';
|
|
2
|
-
import { NotificationType, RequestType, RequestType0 } from 'vscode-
|
|
2
|
+
import { NotificationType, RequestType, RequestType0 } from 'vscode-languageserver';
|
|
3
3
|
import type { DiagnosticSeverity, DocumentUri, Location, Position, Range } from 'vscode-languageserver-types';
|
|
4
4
|
export declare namespace DidChangeModelNotification {
|
|
5
5
|
const type: NotificationType<string>;
|
package/dist/protocol.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NotificationType, RequestType, RequestType0 } from "vscode-
|
|
1
|
+
import { NotificationType, RequestType, RequestType0 } from "vscode-languageserver";
|
|
2
2
|
export var DidChangeModelNotification;
|
|
3
3
|
((DidChangeModelNotification2) => {
|
|
4
4
|
DidChangeModelNotification2.type = new NotificationType("likec4/onDidChangeModel");
|
|
@@ -1,23 +1,44 @@
|
|
|
1
1
|
import type { ComputedView, DiagramView, ProjectId, ViewId } from '@likec4/core';
|
|
2
2
|
import { type QueueGraphvizLayoter, GraphvizLayouter } from '@likec4/layouts';
|
|
3
|
-
import { CancellationToken } from 'vscode-
|
|
3
|
+
import type { CancellationToken } from 'vscode-languageserver';
|
|
4
4
|
import type { LikeC4Services } from '../module';
|
|
5
5
|
export type GraphvizOut = {
|
|
6
|
-
dot: string;
|
|
7
|
-
diagram: DiagramView;
|
|
6
|
+
readonly dot: string;
|
|
7
|
+
readonly diagram: DiagramView;
|
|
8
8
|
};
|
|
9
9
|
type GraphvizSvgOut = {
|
|
10
|
-
id: ViewId;
|
|
11
|
-
dot: string;
|
|
12
|
-
svg: string;
|
|
10
|
+
readonly id: ViewId;
|
|
11
|
+
readonly dot: string;
|
|
12
|
+
readonly svg: string;
|
|
13
13
|
};
|
|
14
14
|
export interface LikeC4Views {
|
|
15
15
|
readonly layouter: GraphvizLayouter;
|
|
16
|
+
/**
|
|
17
|
+
* Returns computed views (i.e. views with predicates computed)
|
|
18
|
+
*/
|
|
16
19
|
computedViews(projectId?: ProjectId | undefined, cancelToken?: CancellationToken): Promise<ComputedView[]>;
|
|
17
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Returns all layouted views (i.e. views with layout computed)
|
|
22
|
+
* Result includes dot and diagram
|
|
23
|
+
*/
|
|
24
|
+
layoutAllViews(projectId?: ProjectId | undefined, cancelToken?: CancellationToken): Promise<GraphvizOut[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Returns layouted view (i.e. view with layout computed)
|
|
27
|
+
* Result includes dot and diagram
|
|
28
|
+
*/
|
|
18
29
|
layoutView(viewId: ViewId, projectId?: ProjectId | undefined, cancelToken?: CancellationToken): Promise<GraphvizOut | null>;
|
|
30
|
+
/**
|
|
31
|
+
* Returns diagrams (i.e. views with layout computed)
|
|
32
|
+
*/
|
|
19
33
|
diagrams(projectId?: ProjectId | undefined, cancelToken?: CancellationToken): Promise<Array<DiagramView>>;
|
|
34
|
+
/**
|
|
35
|
+
* Returns all layouted views as Graphviz output (i.e. views with layout computed)
|
|
36
|
+
*/
|
|
20
37
|
viewsAsGraphvizOut(projectId?: ProjectId | undefined, cancelToken?: CancellationToken): Promise<Array<GraphvizSvgOut>>;
|
|
38
|
+
/**
|
|
39
|
+
* Open view in the preview panel.
|
|
40
|
+
* (works only if running as a vscode extension)
|
|
41
|
+
*/
|
|
21
42
|
openView(viewId: ViewId, projectId?: ProjectId | undefined): Promise<void>;
|
|
22
43
|
}
|
|
23
44
|
export declare class DefaultLikeC4Views implements LikeC4Views {
|
|
@@ -28,7 +49,7 @@ export declare class DefaultLikeC4Views implements LikeC4Views {
|
|
|
28
49
|
constructor(services: LikeC4Services);
|
|
29
50
|
get layouter(): QueueGraphvizLayoter;
|
|
30
51
|
computedViews(projectId?: ProjectId | undefined, cancelToken?: CancellationToken): Promise<ComputedView[]>;
|
|
31
|
-
layoutAllViews(projectId?: ProjectId | undefined, cancelToken?: CancellationToken): Promise<
|
|
52
|
+
layoutAllViews(projectId?: ProjectId | undefined, cancelToken?: CancellationToken): Promise<GraphvizOut[]>;
|
|
32
53
|
layoutView(viewId: ViewId, projectId?: ProjectId | undefined, cancelToken?: CancellationToken): Promise<GraphvizOut | null>;
|
|
33
54
|
diagrams(projectId?: ProjectId | undefined, cancelToken?: CancellationToken): Promise<Array<DiagramView>>;
|
|
34
55
|
viewsAsGraphvizOut(projectId?: ProjectId | undefined, cancelToken?: CancellationToken): Promise<Array<GraphvizSvgOut>>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { loggable } from "@likec4/log";
|
|
2
2
|
import { values } from "remeda";
|
|
3
|
-
import { CancellationToken } from "vscode-jsonrpc";
|
|
4
3
|
import { logError, logger as rootLogger, logWarnError } from "../logger.js";
|
|
5
4
|
import { performanceMark } from "../utils/index.js";
|
|
6
5
|
const viewsLogger = rootLogger.getChild("views");
|
|
@@ -15,11 +14,11 @@ export class DefaultLikeC4Views {
|
|
|
15
14
|
get layouter() {
|
|
16
15
|
return this.services.likec4.Layouter;
|
|
17
16
|
}
|
|
18
|
-
async computedViews(projectId, cancelToken
|
|
17
|
+
async computedViews(projectId, cancelToken) {
|
|
19
18
|
const likeC4Model = await this.ModelBuilder.buildLikeC4Model(projectId, cancelToken);
|
|
20
19
|
return values(likeC4Model.$data.views);
|
|
21
20
|
}
|
|
22
|
-
async layoutAllViews(projectId, cancelToken
|
|
21
|
+
async layoutAllViews(projectId, cancelToken) {
|
|
23
22
|
const likeC4Model = await this.ModelBuilder.buildLikeC4Model(projectId, cancelToken);
|
|
24
23
|
const views = values(likeC4Model.$data.views);
|
|
25
24
|
if (views.length === 0) {
|
|
@@ -63,7 +62,7 @@ export class DefaultLikeC4Views {
|
|
|
63
62
|
}
|
|
64
63
|
return results;
|
|
65
64
|
}
|
|
66
|
-
async layoutView(viewId, projectId, cancelToken
|
|
65
|
+
async layoutView(viewId, projectId, cancelToken) {
|
|
67
66
|
const model = await this.ModelBuilder.buildLikeC4Model(projectId, cancelToken);
|
|
68
67
|
const view = model.findView(viewId)?.$view;
|
|
69
68
|
const logger = projectId ? viewsLogger.getChild(projectId) : viewsLogger;
|
|
@@ -96,11 +95,11 @@ export class DefaultLikeC4Views {
|
|
|
96
95
|
return Promise.reject(e);
|
|
97
96
|
}
|
|
98
97
|
}
|
|
99
|
-
async diagrams(projectId, cancelToken
|
|
98
|
+
async diagrams(projectId, cancelToken) {
|
|
100
99
|
const layouted = await this.layoutAllViews(projectId, cancelToken);
|
|
101
100
|
return layouted.map((l) => l.diagram);
|
|
102
101
|
}
|
|
103
|
-
async viewsAsGraphvizOut(projectId, cancelToken
|
|
102
|
+
async viewsAsGraphvizOut(projectId, cancelToken) {
|
|
104
103
|
const KEY = "All-LayoutedViews-DotWithSvg";
|
|
105
104
|
const cache = this.services.ValidatedWorkspaceCache;
|
|
106
105
|
if (cache.has(KEY)) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ProjectId } from '@likec4/core';
|
|
2
2
|
import { type AstNodeDescription, type LangiumDocument, type Stream, DefaultIndexManager } from 'langium';
|
|
3
|
-
import { CancellationToken } from 'vscode-
|
|
3
|
+
import type { CancellationToken } from 'vscode-languageserver';
|
|
4
4
|
import type { LikeC4SharedServices } from '../module';
|
|
5
5
|
export declare class IndexManager extends DefaultIndexManager {
|
|
6
6
|
protected services: LikeC4SharedServices;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { DefaultIndexManager, stream } from "langium";
|
|
2
|
-
import { CancellationToken } from "vscode-jsonrpc";
|
|
3
2
|
export class IndexManager extends DefaultIndexManager {
|
|
4
3
|
constructor(services) {
|
|
5
4
|
super(services);
|
|
6
5
|
this.services = services;
|
|
7
6
|
}
|
|
8
|
-
async updateContent(document, cancelToken
|
|
7
|
+
async updateContent(document, cancelToken) {
|
|
9
8
|
const projects = this.services.workspace.ProjectsManager;
|
|
10
9
|
document.likec4ProjectId = projects.belongsTo(document.uri);
|
|
11
10
|
await super.updateContent(document, cancelToken);
|
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.36.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bugs": "https://github.com/likec4/likec4/issues",
|
|
7
7
|
"homepage": "https://likec4.dev",
|
|
@@ -89,10 +89,11 @@
|
|
|
89
89
|
"access": "public"
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@hpcc-js/wasm-graphviz": "1.
|
|
92
|
+
"@hpcc-js/wasm-graphviz": "1.10.0"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
95
|
"@types/chroma-js": "^3.1.1",
|
|
96
|
+
"@types/natural-compare-lite": "^1.4.2",
|
|
96
97
|
"@modelcontextprotocol/sdk": "^1.13.2",
|
|
97
98
|
"@msgpack/msgpack": "^3.1.2",
|
|
98
99
|
"@smithy/util-base64": "^4.0.0",
|
|
@@ -108,7 +109,7 @@
|
|
|
108
109
|
"indent-string": "^5.0.0",
|
|
109
110
|
"json5": "^2.2.3",
|
|
110
111
|
"langium": "3.5.0",
|
|
111
|
-
"langium-cli": "3.5.
|
|
112
|
+
"langium-cli": "3.5.2",
|
|
112
113
|
"natural-compare-lite": "^1.4.0",
|
|
113
114
|
"p-debounce": "4.0.0",
|
|
114
115
|
"p-queue": "8.1.0",
|
|
@@ -120,7 +121,7 @@
|
|
|
120
121
|
"tsx": "4.20.3",
|
|
121
122
|
"turbo": "2.5.5",
|
|
122
123
|
"type-fest": "^4.41.0",
|
|
123
|
-
"typescript": "5.
|
|
124
|
+
"typescript": "5.9.2",
|
|
124
125
|
"ufo": "1.6.1",
|
|
125
126
|
"unbuild": "3.5.0",
|
|
126
127
|
"valibot": "^1.1.0",
|
|
@@ -132,11 +133,11 @@
|
|
|
132
133
|
"vscode-uri": "3.1.0",
|
|
133
134
|
"which": "^5.0.0",
|
|
134
135
|
"zod": "3.25.67",
|
|
135
|
-
"@likec4/
|
|
136
|
-
"@likec4/
|
|
137
|
-
"@likec4/layouts": "1.
|
|
138
|
-
"@likec4/
|
|
139
|
-
"@likec4/
|
|
136
|
+
"@likec4/icons": "1.36.0",
|
|
137
|
+
"@likec4/tsconfig": "1.36.0",
|
|
138
|
+
"@likec4/layouts": "1.36.0",
|
|
139
|
+
"@likec4/log": "1.36.0",
|
|
140
|
+
"@likec4/core": "1.36.0"
|
|
140
141
|
},
|
|
141
142
|
"scripts": {
|
|
142
143
|
"typecheck": "tsc -b --verbose",
|