@likec4/language-server 1.44.0 → 1.46.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/LikeC4LanguageServices.d.ts +4 -15
- package/dist/LikeC4LanguageServices.js +4 -32
- package/dist/Rpc.js +44 -21
- package/dist/ast.d.ts +10 -0
- package/dist/ast.js +13 -2
- package/dist/browser.js +2 -2
- package/dist/bundled.js +2 -0
- package/dist/bundled.mjs +3838 -4059
- package/dist/filesystem/ChokidarWatcher.d.ts +2 -0
- package/dist/filesystem/ChokidarWatcher.js +29 -18
- package/dist/filesystem/LikeC4FileSystem.js +4 -0
- package/dist/filesystem/index.d.ts +2 -0
- package/dist/generated/ast.d.ts +46 -9
- package/dist/generated/ast.js +56 -4
- package/dist/generated/grammar.js +1 -1
- package/dist/generated-lib/icons.js +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +5 -3
- package/dist/lsp/DocumentSymbolProvider.js +12 -1
- package/dist/mcp/server/StdioLikeC4MCPServer.js +10 -6
- package/dist/mcp/server/StreamableLikeC4MCPServer.js +97 -97
- package/dist/mcp/server/WithMCPServer.js +4 -6
- package/dist/mcp/tools/read-deployment.js +18 -0
- package/dist/mcp/tools/read-element.js +24 -0
- package/dist/mcp/tools/search-element.js +5 -5
- package/dist/mcp/utils.js +1 -1
- package/dist/model/builder/buildModel.js +70 -1
- package/dist/model/deployments-index.js +2 -2
- package/dist/model/fqn-index.d.ts +1 -2
- package/dist/model/fqn-index.js +21 -18
- package/dist/model/model-builder.js +0 -2
- package/dist/model/model-parser.d.ts +3 -0
- package/dist/model/model-parser.js +41 -27
- package/dist/model/parser/Base.js +8 -3
- package/dist/model/parser/GlobalsParser.d.ts +1 -0
- package/dist/model/parser/ModelParser.d.ts +2 -1
- package/dist/model/parser/ModelParser.js +45 -1
- package/dist/model/parser/SpecificationParser.js +4 -0
- package/dist/model/parser/ViewsParser.d.ts +1 -0
- package/dist/model/parser/ViewsParser.js +16 -1
- package/dist/model-change/ModelChanges.d.ts +2 -2
- package/dist/model-change/ModelChanges.js +41 -11
- package/dist/protocol.d.ts +33 -10
- package/dist/protocol.js +13 -4
- package/dist/validation/index.d.ts +1 -1
- package/dist/validation/index.js +11 -1
- package/dist/validation/relation.d.ts +1 -0
- package/dist/validation/relation.js +87 -1
- package/dist/validation/view-checks.d.ts +4 -0
- package/dist/validation/view-checks.js +46 -0
- package/dist/view-utils/manual-layout.js +2 -4
- package/dist/views/LikeC4ManualLayouts.d.ts +16 -2
- package/dist/views/LikeC4ManualLayouts.js +100 -23
- package/dist/views/LikeC4Views.d.ts +26 -5
- package/dist/views/LikeC4Views.js +49 -33
- package/dist/workspace/AstNodeDescriptionProvider.js +6 -3
- package/dist/workspace/IndexManager.js +1 -1
- package/dist/workspace/LangiumDocuments.d.ts +3 -2
- package/dist/workspace/LangiumDocuments.js +29 -15
- package/dist/workspace/ProjectsManager.d.ts +45 -16
- package/dist/workspace/ProjectsManager.js +227 -45
- package/dist/workspace/WorkspaceManager.js +43 -0
- package/package.json +22 -21
|
@@ -5,6 +5,7 @@ import { URI } from 'langium';
|
|
|
5
5
|
import type { CancellationToken } from 'vscode-jsonrpc';
|
|
6
6
|
import type { Range } from 'vscode-languageserver-types';
|
|
7
7
|
import type { LikeC4ModelBuilder } from './model';
|
|
8
|
+
import type { LikeC4ModelChanges } from './model-change/ModelChanges';
|
|
8
9
|
import type { LikeC4Services } from './module';
|
|
9
10
|
import type { Locate } from './protocol';
|
|
10
11
|
import type { LikeC4Views } from './views/LikeC4Views';
|
|
@@ -14,6 +15,7 @@ export interface LikeC4LanguageServices {
|
|
|
14
15
|
readonly builder: LikeC4ModelBuilder;
|
|
15
16
|
readonly workspaceUri: URI;
|
|
16
17
|
readonly projectsManager: ProjectsManager;
|
|
18
|
+
readonly editor: LikeC4ModelChanges;
|
|
17
19
|
/**
|
|
18
20
|
* Returns all projects with relevant documents
|
|
19
21
|
*/
|
|
@@ -37,6 +39,7 @@ export interface LikeC4LanguageServices {
|
|
|
37
39
|
};
|
|
38
40
|
/**
|
|
39
41
|
* Returns diagrams (i.e. views with layout computed) for the specified project
|
|
42
|
+
* if diagram has manual layout, it will be used
|
|
40
43
|
* If no project is specified, returns diagrams for default project
|
|
41
44
|
*/
|
|
42
45
|
diagrams(project?: ProjectId | undefined, cancelToken?: CancellationToken): Promise<DiagramView[]>;
|
|
@@ -48,14 +51,6 @@ export interface LikeC4LanguageServices {
|
|
|
48
51
|
range: Range;
|
|
49
52
|
sourceFsPath: string;
|
|
50
53
|
}>;
|
|
51
|
-
/**
|
|
52
|
-
* Notifies the language server about changes in the workspace
|
|
53
|
-
* @deprecated use watcher instead
|
|
54
|
-
*/
|
|
55
|
-
notifyUpdate(update: {
|
|
56
|
-
changed?: string;
|
|
57
|
-
removed?: string;
|
|
58
|
-
}): Promise<boolean>;
|
|
59
54
|
/**
|
|
60
55
|
* Returns the location of the specified element, relation, view or deployment element
|
|
61
56
|
*/
|
|
@@ -68,6 +63,7 @@ export interface LikeC4LanguageServices {
|
|
|
68
63
|
export declare class DefaultLikeC4LanguageServices implements LikeC4LanguageServices {
|
|
69
64
|
private services;
|
|
70
65
|
readonly builder: LikeC4ModelBuilder;
|
|
66
|
+
readonly editor: LikeC4ModelChanges;
|
|
71
67
|
readonly projectsManager: ProjectsManager;
|
|
72
68
|
constructor(services: LikeC4Services);
|
|
73
69
|
get views(): LikeC4Views;
|
|
@@ -108,13 +104,6 @@ export declare class DefaultLikeC4LanguageServices implements LikeC4LanguageServ
|
|
|
108
104
|
range: Range;
|
|
109
105
|
sourceFsPath: string;
|
|
110
106
|
}>;
|
|
111
|
-
/**
|
|
112
|
-
* TODO Replace with watcher
|
|
113
|
-
*/
|
|
114
|
-
notifyUpdate({ changed, removed }: {
|
|
115
|
-
changed?: string;
|
|
116
|
-
removed?: string;
|
|
117
|
-
}): Promise<boolean>;
|
|
118
107
|
locate(params: Locate.Params): Locate.Res;
|
|
119
108
|
dispose(): Promise<void>;
|
|
120
109
|
}
|
|
@@ -4,8 +4,7 @@ import { loggable } from '@likec4/log';
|
|
|
4
4
|
import { URI } from 'langium';
|
|
5
5
|
import { entries, hasAtLeast, indexBy, map, pipe, prop } from 'remeda';
|
|
6
6
|
import { DiagnosticSeverity } from 'vscode-languageserver-types';
|
|
7
|
-
import {
|
|
8
|
-
import { logger as mainLogger, logWarnError } from './logger';
|
|
7
|
+
import { logger as mainLogger } from './logger';
|
|
9
8
|
import { ProjectsManager } from './workspace';
|
|
10
9
|
const logger = mainLogger.getChild('LanguageServices');
|
|
11
10
|
/**
|
|
@@ -14,11 +13,13 @@ const logger = mainLogger.getChild('LanguageServices');
|
|
|
14
13
|
export class DefaultLikeC4LanguageServices {
|
|
15
14
|
services;
|
|
16
15
|
builder;
|
|
16
|
+
editor;
|
|
17
17
|
projectsManager;
|
|
18
18
|
constructor(services) {
|
|
19
19
|
this.services = services;
|
|
20
20
|
this.builder = services.likec4.ModelBuilder;
|
|
21
21
|
this.projectsManager = services.shared.workspace.ProjectsManager;
|
|
22
|
+
this.editor = services.likec4.ModelChanges;
|
|
22
23
|
}
|
|
23
24
|
get views() {
|
|
24
25
|
return this.services.likec4.Views;
|
|
@@ -99,7 +100,7 @@ export class DefaultLikeC4LanguageServices {
|
|
|
99
100
|
const projectId = this.projectsManager.ensureProjectId(project);
|
|
100
101
|
const model = await this.builder.computeModel(projectId, cancelToken);
|
|
101
102
|
if (!model) {
|
|
102
|
-
throw new Error('Failed to
|
|
103
|
+
throw new Error('Failed to compute model, empty project?');
|
|
103
104
|
}
|
|
104
105
|
const layouted = await this.views.layoutAllViews(projectId, cancelToken);
|
|
105
106
|
return LikeC4Model.create({
|
|
@@ -121,35 +122,6 @@ export class DefaultLikeC4LanguageServices {
|
|
|
121
122
|
}));
|
|
122
123
|
});
|
|
123
124
|
}
|
|
124
|
-
/**
|
|
125
|
-
* TODO Replace with watcher
|
|
126
|
-
*/
|
|
127
|
-
async notifyUpdate({ changed, removed }) {
|
|
128
|
-
if (!changed && !removed) {
|
|
129
|
-
return false;
|
|
130
|
-
}
|
|
131
|
-
const _changed = changed ? URI.file(changed) : undefined;
|
|
132
|
-
const _removed = removed ? URI.file(removed) : undefined;
|
|
133
|
-
const pm = this.services.shared.workspace.ProjectsManager;
|
|
134
|
-
if ((_changed && pm.isConfigFile(_changed)) || (_removed && pm.isConfigFile(_removed))) {
|
|
135
|
-
await pm.reloadProjects();
|
|
136
|
-
return true;
|
|
137
|
-
}
|
|
138
|
-
const mutex = this.services.shared.workspace.WorkspaceLock;
|
|
139
|
-
try {
|
|
140
|
-
let completed = false;
|
|
141
|
-
await mutex.write(async (token) => {
|
|
142
|
-
await this.services.shared.workspace.DocumentBuilder.update(_changed ? [_changed] : [], _removed ? [_removed] : [], token);
|
|
143
|
-
// we come here if only the update was successful, did not throw and not cancelled
|
|
144
|
-
completed = !token.isCancellationRequested;
|
|
145
|
-
});
|
|
146
|
-
return completed;
|
|
147
|
-
}
|
|
148
|
-
catch (e) {
|
|
149
|
-
logger.error(loggable(e));
|
|
150
|
-
return false;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
125
|
locate(params) {
|
|
154
126
|
switch (true) {
|
|
155
127
|
case 'element' in params:
|
package/dist/Rpc.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { filter, flatMap, funnel, indexBy, keys, map, mapValues, pipe, sort } from 'remeda';
|
|
2
2
|
import { logger as rootLogger } from './logger';
|
|
3
|
-
import { serializableLikeC4ProjectConfig } from '@likec4/config';
|
|
4
3
|
import { invariant, nonexhaustive, } from '@likec4/core';
|
|
5
4
|
import { LikeC4Model } from '@likec4/core/model';
|
|
6
5
|
import { Disposable, interruptAndCheck, URI, UriUtils } from 'langium';
|
|
7
6
|
import { DiagnosticSeverity } from 'vscode-languageserver-protocol';
|
|
8
|
-
import { BuildDocuments, ChangeView, DidChangeModelNotification, DidRequestOpenViewNotification, FetchComputedModel, FetchLayoutedModel, FetchProjects, FetchTelemetryMetrics, FetchViewsFromAllProjects, GetDocumentTags, LayoutView, Locate, RegisterProject, ReloadProjects, ValidateLayout, } from './protocol';
|
|
7
|
+
import { BuildDocuments, ChangeView, DidChangeModelNotification, DidChangeSnapshotNotification, DidRequestOpenViewNotification, FetchComputedModel, FetchLayoutedModel, FetchProjects, FetchTelemetryMetrics, FetchViewsFromAllProjects, GetDocumentTags, LayoutView, Locate, RegisterProject, ReloadProjects, ValidateLayout, } from './protocol';
|
|
9
8
|
import { ADisposable } from './utils';
|
|
10
9
|
const logger = rootLogger.getChild('rpc');
|
|
11
10
|
export class Rpc extends ADisposable {
|
|
@@ -17,28 +16,33 @@ export class Rpc extends ADisposable {
|
|
|
17
16
|
init() {
|
|
18
17
|
const connection = this.services.shared.lsp.Connection;
|
|
19
18
|
if (!connection) {
|
|
20
|
-
logger.info(`
|
|
19
|
+
logger.info(`no connection, skip init ServerRpc`);
|
|
21
20
|
return;
|
|
22
21
|
}
|
|
23
|
-
logger.info(`
|
|
22
|
+
logger.info(`init ServerRpc`);
|
|
24
23
|
const likec4Services = this.services.likec4;
|
|
25
24
|
const projects = this.services.shared.workspace.ProjectsManager;
|
|
26
25
|
const LangiumDocuments = this.services.shared.workspace.LangiumDocuments;
|
|
27
26
|
const DocumentBuilder = this.services.shared.workspace.DocumentBuilder;
|
|
28
|
-
const notifyModelParsed = funnel(() => {
|
|
29
|
-
|
|
27
|
+
const notifyModelParsed = funnel((batch) => {
|
|
28
|
+
if (batch > 1) {
|
|
29
|
+
logger.debug `send ${'onDidChangeModel'} (${batch} batched)`;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
logger.debug `send ${'onDidChangeModel'}`;
|
|
33
|
+
}
|
|
30
34
|
connection.sendNotification(DidChangeModelNotification.type, '').catch(error => {
|
|
31
35
|
logger.warn(`[ServerRpc] error sending onDidChangeModel:`, { error });
|
|
32
36
|
return;
|
|
33
37
|
});
|
|
34
38
|
}, {
|
|
39
|
+
reducer: (accumulator, req) => (accumulator ?? 0) + req,
|
|
35
40
|
triggerAt: 'end',
|
|
36
|
-
minQuietPeriodMs:
|
|
37
|
-
maxBurstDurationMs:
|
|
38
|
-
minGapMs: 300,
|
|
41
|
+
minQuietPeriodMs: 200,
|
|
42
|
+
maxBurstDurationMs: 400,
|
|
39
43
|
});
|
|
40
44
|
let isFirstBuild = true;
|
|
41
|
-
this.onDispose(likec4Services.ModelBuilder.onModelParsed(() => notifyModelParsed.call()), connection.onRequest(FetchComputedModel.req, async ({ projectId, cleanCaches }, cancelToken) => {
|
|
45
|
+
this.onDispose(likec4Services.ModelBuilder.onModelParsed(() => notifyModelParsed.call(1)), connection.onRequest(FetchComputedModel.req, async ({ projectId, cleanCaches }, cancelToken) => {
|
|
42
46
|
logger.debug `received request ${'fetchComputedModel'} for project ${projectId}`;
|
|
43
47
|
if (cleanCaches) {
|
|
44
48
|
const docs = projectId
|
|
@@ -52,6 +56,10 @@ export class Rpc extends ADisposable {
|
|
|
52
56
|
return { model: likec4model.$model };
|
|
53
57
|
}
|
|
54
58
|
return { model: null };
|
|
59
|
+
}), connection.onNotification(DidChangeSnapshotNotification.type, async ({ snapshotUri }) => {
|
|
60
|
+
logger.debug `received notification ${'onDidChangeSnapshot'} for snapshot ${snapshotUri}`;
|
|
61
|
+
const uri = URI.parse(snapshotUri);
|
|
62
|
+
await projects.rebuidProject(projects.belongsTo(uri.path));
|
|
55
63
|
}), connection.onRequest(FetchLayoutedModel.req, async ({ projectId }, cancelToken) => {
|
|
56
64
|
logger.debug `received request ${'fetchLayoutedModel'} for project ${projectId}`;
|
|
57
65
|
const model = await likec4Services.LanguageServices.layoutedModel(projectId);
|
|
@@ -66,24 +74,33 @@ export class Rpc extends ADisposable {
|
|
|
66
74
|
views: indexBy(diagrams, d => d.id),
|
|
67
75
|
},
|
|
68
76
|
};
|
|
69
|
-
}), connection.onRequest(LayoutView.req, async ({ viewId, projectId }, cancelToken) => {
|
|
70
|
-
logger
|
|
71
|
-
|
|
77
|
+
}), connection.onRequest(LayoutView.req, async ({ viewId, projectId, layoutType, }, cancelToken) => {
|
|
78
|
+
logger
|
|
79
|
+
.debug `received request ${'layoutView'} for ${viewId} from project ${projectId} (layout type: ${layoutType ?? 'not set'})`;
|
|
80
|
+
const result = await likec4Services.Views.layoutView({
|
|
81
|
+
viewId,
|
|
82
|
+
projectId: projectId,
|
|
83
|
+
layoutType,
|
|
84
|
+
cancelToken,
|
|
85
|
+
});
|
|
72
86
|
return { result };
|
|
73
|
-
}), connection.onRequest(ValidateLayout.
|
|
87
|
+
}), connection.onRequest(ValidateLayout.req, async ({ projectId }, cancelToken) => {
|
|
74
88
|
logger.debug `received request ${'validateLayout'} for project ${projectId}`;
|
|
75
89
|
const layouts = await likec4Services.Views.layoutAllViews(projectId, cancelToken);
|
|
76
90
|
const result = reportLayoutDrift(layouts.map(l => l.diagram));
|
|
77
91
|
return { result };
|
|
78
|
-
}), connection.onRequest(FetchProjects.req, async (
|
|
92
|
+
}), connection.onRequest(FetchProjects.req, async () => {
|
|
79
93
|
logger.debug `received request ${'FetchProjects'}`;
|
|
80
94
|
const docsByProject = LangiumDocuments.groupedByProject();
|
|
81
95
|
return {
|
|
82
96
|
projects: mapValues(docsByProject, (docs, projectId) => {
|
|
83
|
-
const { folderUri, config, } = projects.getProject(projectId);
|
|
97
|
+
const { folderUri, config: { name, title, }, } = projects.getProject(projectId);
|
|
84
98
|
return {
|
|
85
99
|
folder: folderUri.toString(),
|
|
86
|
-
config:
|
|
100
|
+
config: {
|
|
101
|
+
name,
|
|
102
|
+
title,
|
|
103
|
+
},
|
|
87
104
|
docs: map(docs, d => d.uri.toString()),
|
|
88
105
|
};
|
|
89
106
|
}),
|
|
@@ -120,7 +137,7 @@ export class Rpc extends ADisposable {
|
|
|
120
137
|
return {
|
|
121
138
|
views: pipe(results, filter(r => r.status === 'fulfilled'), flatMap(r => r.value)),
|
|
122
139
|
};
|
|
123
|
-
}), connection.onRequest(BuildDocuments.
|
|
140
|
+
}), connection.onRequest(BuildDocuments.req, async ({ docs }, cancelToken) => {
|
|
124
141
|
const changed = docs.map(d => URI.parse(d));
|
|
125
142
|
const notChanged = (uri) => changed.every(c => !UriUtils.equals(c, uri));
|
|
126
143
|
const deleted = LangiumDocuments.allExcludingBuiltin
|
|
@@ -149,7 +166,7 @@ export class Rpc extends ADisposable {
|
|
|
149
166
|
isFirstBuild = false;
|
|
150
167
|
await interruptAndCheck(cancelToken);
|
|
151
168
|
await DocumentBuilder.update(changed, deleted, cancelToken);
|
|
152
|
-
}), connection.onRequest(Locate.
|
|
169
|
+
}), connection.onRequest(Locate.req, params => {
|
|
153
170
|
logger.debug `received request ${'locate'}, ${params}`;
|
|
154
171
|
switch (true) {
|
|
155
172
|
case 'element' in params:
|
|
@@ -169,9 +186,15 @@ export class Rpc extends ADisposable {
|
|
|
169
186
|
default:
|
|
170
187
|
nonexhaustive(params);
|
|
171
188
|
}
|
|
172
|
-
}), connection.onRequest(ChangeView.
|
|
189
|
+
}), connection.onRequest(ChangeView.req, async (request, _cancelToken) => {
|
|
173
190
|
logger.debug `received request ${'changeView'} of ${request.viewId} from project ${request.projectId}`;
|
|
174
|
-
|
|
191
|
+
const loc = await likec4Services.ModelChanges.applyChange(request);
|
|
192
|
+
const op = request.change.op;
|
|
193
|
+
if (request.projectId &&
|
|
194
|
+
(op === 'save-view-snapshot' || op === 'reset-manual-layout')) {
|
|
195
|
+
await projects.rebuidProject(request.projectId);
|
|
196
|
+
}
|
|
197
|
+
return loc;
|
|
175
198
|
}), connection.onRequest(FetchTelemetryMetrics.req, async (cancelToken) => {
|
|
176
199
|
const projectsIds = [...projects.all];
|
|
177
200
|
const promises = projectsIds.map(async (projectId) => {
|
package/dist/ast.d.ts
CHANGED
|
@@ -90,6 +90,15 @@ export interface ParsedAstExtend {
|
|
|
90
90
|
[key: string]: string | string[];
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
|
+
export interface ParsedAstExtendRelation {
|
|
94
|
+
id: c4.RelationId;
|
|
95
|
+
astPath: string;
|
|
96
|
+
tags?: c4.NonEmptyArray<c4.Tag> | null;
|
|
97
|
+
links?: c4.NonEmptyArray<c4.Link> | null;
|
|
98
|
+
metadata?: {
|
|
99
|
+
[key: string]: string | string[];
|
|
100
|
+
};
|
|
101
|
+
}
|
|
93
102
|
export interface ParsedAstRelation {
|
|
94
103
|
id: c4.RelationId;
|
|
95
104
|
astPath: string;
|
|
@@ -179,6 +188,7 @@ export interface LikeC4DocumentProps {
|
|
|
179
188
|
c4Elements?: ParsedAstElement[];
|
|
180
189
|
c4ExtendElements?: ParsedAstExtend[];
|
|
181
190
|
c4ExtendDeployments?: ParsedAstExtend[];
|
|
191
|
+
c4ExtendRelations?: ParsedAstExtendRelation[];
|
|
182
192
|
c4Relations?: ParsedAstRelation[];
|
|
183
193
|
c4Globals?: ParsedAstGlobals;
|
|
184
194
|
c4Views?: ParsedAstView[];
|
package/dist/ast.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
//
|
|
3
|
+
// Copyright (c) 2023-2025 Denis Davydkov
|
|
4
|
+
// Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
5
|
+
//
|
|
6
|
+
// Portions of this file have been modified by NVIDIA CORPORATION & AFFILIATES.
|
|
7
|
+
import { invariant, MultiMap, nonexhaustive } from '@likec4/core/utils';
|
|
2
8
|
import { AstUtils, DocumentState } from 'langium';
|
|
3
9
|
import { clamp, isNullish, isTruthy } from 'remeda';
|
|
4
10
|
import * as ast from './generated/ast';
|
|
@@ -29,7 +35,11 @@ export const ElementOps = {
|
|
|
29
35
|
},
|
|
30
36
|
};
|
|
31
37
|
export function isLikeC4LangiumDocument(doc) {
|
|
32
|
-
|
|
38
|
+
if (doc.textDocument.languageId === LikeC4LanguageMetaData.languageId) {
|
|
39
|
+
invariant(isTruthy(doc.likec4ProjectId), `LikeC4Document must have projectId defined: ${doc.uri.fsPath}`);
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
33
43
|
}
|
|
34
44
|
export function isParsedLikeC4LangiumDocument(doc) {
|
|
35
45
|
return (isLikeC4LangiumDocument(doc)
|
|
@@ -38,6 +48,7 @@ export function isParsedLikeC4LangiumDocument(doc) {
|
|
|
38
48
|
&& !!doc.c4Elements
|
|
39
49
|
&& !!doc.c4ExtendElements
|
|
40
50
|
&& !!doc.c4ExtendDeployments
|
|
51
|
+
&& !!doc.c4ExtendRelations
|
|
41
52
|
&& !!doc.c4Relations
|
|
42
53
|
&& !!doc.c4Views
|
|
43
54
|
&& !!doc.c4Deployments
|
package/dist/browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { configureLogger,
|
|
1
|
+
import { configureLogger, getConsoleSink, getTextFormatter } from '@likec4/log';
|
|
2
2
|
import { startLanguageServer as startLanguim } from 'langium/lsp';
|
|
3
3
|
import { BrowserMessageReader, BrowserMessageWriter, createConnection } from 'vscode-languageserver/browser';
|
|
4
4
|
import { createLanguageServices } from './module';
|
|
@@ -12,7 +12,7 @@ export function startLanguageServer(port) {
|
|
|
12
12
|
configureLogger({
|
|
13
13
|
sinks: {
|
|
14
14
|
console: getConsoleSink({
|
|
15
|
-
formatter:
|
|
15
|
+
formatter: getTextFormatter({
|
|
16
16
|
format: ({ level, category, message }) => {
|
|
17
17
|
return `${level} ${category} ${message}`;
|
|
18
18
|
},
|
package/dist/bundled.js
CHANGED
|
@@ -6,6 +6,7 @@ import { getLspConnectionSink, logger } from './logger';
|
|
|
6
6
|
import { WithMCPServer } from './mcp/server/WithMCPServer';
|
|
7
7
|
import { createLanguageServices } from './module';
|
|
8
8
|
import { ConfigurableLayouter } from './views/ConfigurableLayouter';
|
|
9
|
+
import { WithLikeC4ManualLayouts } from './views/LikeC4ManualLayouts';
|
|
9
10
|
/**
|
|
10
11
|
* This is used as `bin` entry point to start the language server.
|
|
11
12
|
*/
|
|
@@ -35,6 +36,7 @@ export function startLanguageServer() {
|
|
|
35
36
|
connection,
|
|
36
37
|
...LikeC4FileSystem(false),
|
|
37
38
|
...WithMCPServer('sse'),
|
|
39
|
+
...WithLikeC4ManualLayouts,
|
|
38
40
|
}, ConfigurableLayouter);
|
|
39
41
|
// Start the language server with the shared services
|
|
40
42
|
startLanguim(services.shared);
|