@likec4/language-server 1.46.4 → 1.47.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 +27 -21
- package/dist/LikeC4LanguageServices.js +24 -14
- package/dist/Rpc.js +7 -1
- package/dist/ast.d.ts +1 -1
- package/dist/browser.d.ts +0 -1
- package/dist/browser.js +0 -1
- package/dist/bundled.mjs +3769 -3597
- package/dist/filesystem/ChokidarWatcher.d.ts +3 -0
- package/dist/filesystem/ChokidarWatcher.js +67 -42
- package/dist/filesystem/LikeC4FileSystem.d.ts +1 -1
- package/dist/filesystem/LikeC4FileSystem.js +16 -6
- package/dist/generated/ast.d.ts +2 -2
- package/dist/generated/ast.js +1 -1
- package/dist/generated/grammar.js +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/lsp/CodeLensProvider.js +1 -1
- package/dist/lsp/CompletionProvider.d.ts +4 -2
- package/dist/lsp/CompletionProvider.js +41 -3
- package/dist/lsp/DocumentSymbolProvider.js +1 -1
- package/dist/lsp/SemanticTokenProvider.d.ts +8 -1
- package/dist/lsp/SemanticTokenProvider.js +52 -11
- package/dist/mcp/interfaces.d.ts +1 -1
- package/dist/mcp/interfaces.js +0 -1
- package/dist/mcp/server/StreamableLikeC4MCPServer.js +27 -51
- package/dist/mcp/tools/_common.d.ts +2 -2
- package/dist/mcp/tools/find-relationships.d.ts +195 -5
- package/dist/mcp/tools/list-projects.d.ts +191 -3
- package/dist/mcp/tools/open-view.d.ts +194 -4
- package/dist/mcp/tools/read-deployment.d.ts +194 -4
- package/dist/mcp/tools/read-element.d.ts +194 -4
- package/dist/mcp/tools/read-project-summary.d.ts +193 -3
- package/dist/mcp/tools/read-view.d.ts +194 -4
- package/dist/mcp/tools/search-element.d.ts +193 -3
- package/dist/model/model-builder.d.ts +4 -2
- package/dist/model/model-builder.js +56 -47
- package/dist/model/model-parser.d.ts +6 -6
- package/dist/model/parser/Base.js +58 -48
- package/dist/model/parser/GlobalsParser.d.ts +3 -3
- package/dist/model/parser/ViewsParser.js +2 -2
- package/dist/protocol.d.ts +5 -0
- package/dist/utils/elementRef.js +10 -4
- package/dist/validation/index.d.ts +1 -1
- package/dist/workspace/LangiumDocuments.d.ts +4 -0
- package/dist/workspace/LangiumDocuments.js +11 -5
- package/dist/workspace/ProjectsManager.d.ts +4 -0
- package/dist/workspace/ProjectsManager.js +89 -84
- package/package.json +16 -15
|
@@ -4,7 +4,7 @@ import type { LikeC4Services } from '../module';
|
|
|
4
4
|
export { LikeC4DocumentValidator } from './DocumentValidator';
|
|
5
5
|
type Guard<N extends AstNode> = (n: AstNode) => n is N;
|
|
6
6
|
type Guarded<G> = G extends Guard<infer N> ? N : never;
|
|
7
|
-
declare const isValidatableAstNode: (n: AstNode) => n is ast.
|
|
7
|
+
declare const isValidatableAstNode: (n: AstNode) => n is ast.Element | ast.DeployedInstance | ast.DeploymentNode | ast.Tags | ast.ElementKindExpression | ast.ElementTagExpression | ast.FqnRefExpr | ast.WildcardExpression | ast.FqnExprWhere | ast.FqnExprWith | ast.DirectedRelationExpr | ast.InOutRelationExpr | ast.IncomingRelationExpr | ast.OutgoingRelationExpr | ast.RelationExprWhere | ast.RelationExprWith | ast.ImportsFromPoject | ast.Imported | ast.Globals | ast.GlobalPredicateGroup | ast.GlobalDynamicPredicateGroup | ast.GlobalStyle | ast.GlobalStyleGroup | ast.DeploymentViewRulePredicate | ast.DynamicViewIncludePredicate | ast.ViewRulePredicate | ast.DeploymentView | ast.DynamicView | ast.ViewRuleGroup | ast.ElementView | ast.DeploymentViewRuleStyle | ast.ViewRuleRank | ast.ViewRuleStyle | ast.DynamicViewParallelSteps | ast.DynamicStepChain | ast.DynamicStepSingle | ast.ViewRuleAutoLayout | ast.LinkProperty | ast.ViewStringProperty | ast.SpecificationDeploymentNodeKind | ast.SpecificationElementKind | ast.ExtendDeployment | ast.DeploymentRelation | ast.ExtendElement | ast.ExtendRelation | ast.Relation | ast.SpecificationRule | ast.BorderProperty | ast.ColorProperty | ast.IconProperty | ast.MultipleProperty | ast.OpacityProperty | ast.PaddingSizeProperty | ast.ShapeProperty | ast.ShapeSizeProperty | ast.TextSizeProperty | ast.ElementStyleProperty | ast.SpecificationRelationshipKind | ast.ViewRuleGlobalPredicateRef | ast.ViewRuleGlobalStyle | ast.DynamicViewGlobalPredicateRef | ast.ArrowProperty | ast.LineProperty | ast.DynamicViewDisplayVariantProperty | ast.MetadataBody | ast.ElementStringProperty | ast.MetadataAttribute | ast.NotationProperty | ast.NotesProperty | ast.RelationStringProperty | ast.SpecificationElementStringProperty | ast.SpecificationRelationshipStringProperty | ast.NavigateToProperty | ast.ElementRef | ast.SpecificationTag | ast.SpecificationColor | ast.HexColor | ast.RGBAColor;
|
|
8
8
|
type ValidatableAstNode = Guarded<typeof isValidatableAstNode>;
|
|
9
9
|
export declare function checksFromDiagnostics(doc: LikeC4LangiumDocument): {
|
|
10
10
|
isValid: (n: ValidatableAstNode) => boolean;
|
|
@@ -8,6 +8,10 @@ export declare class LangiumDocuments extends DefaultLangiumDocuments {
|
|
|
8
8
|
constructor(services: LikeC4SharedServices);
|
|
9
9
|
addDocument(document: LangiumDocument): void;
|
|
10
10
|
getDocument(uri: URI): LikeC4LangiumDocument | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Returns all known documents, without any filtering.
|
|
13
|
+
*/
|
|
14
|
+
get allKnownDocuments(): Stream<LangiumDocument>;
|
|
11
15
|
get all(): Stream<LikeC4LangiumDocument>;
|
|
12
16
|
/**
|
|
13
17
|
* Returns all documents, excluding built-in documents and documents excluded by ProjectsManager.
|
|
@@ -32,16 +32,22 @@ export class LangiumDocuments extends DefaultLangiumDocuments {
|
|
|
32
32
|
}
|
|
33
33
|
getDocument(uri) {
|
|
34
34
|
const doc = super.getDocument(uri);
|
|
35
|
-
if (doc && !exclude(doc)) {
|
|
36
|
-
doc.likec4ProjectId = this.services.workspace.ProjectsManager.belongsTo(doc);
|
|
37
|
-
}
|
|
38
35
|
if (doc && !isLikeC4LangiumDocument(doc)) {
|
|
39
36
|
throw new Error(`Document ${doc.uri.path} is not a LikeC4 document`);
|
|
40
37
|
}
|
|
38
|
+
if (doc && !exclude(doc)) {
|
|
39
|
+
doc.likec4ProjectId = this.services.workspace.ProjectsManager.belongsTo(doc);
|
|
40
|
+
}
|
|
41
41
|
return doc;
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Returns all known documents, without any filtering.
|
|
45
|
+
*/
|
|
46
|
+
get allKnownDocuments() {
|
|
47
|
+
return stream(this.documentMap.values());
|
|
48
|
+
}
|
|
43
49
|
get all() {
|
|
44
|
-
return
|
|
50
|
+
return this.allKnownDocuments
|
|
45
51
|
.filter((doc) => {
|
|
46
52
|
if (doc.textDocument.languageId === LikeC4LanguageMetaData.languageId) {
|
|
47
53
|
if (!isLikeC4Builtin(doc.uri)) {
|
|
@@ -88,7 +94,7 @@ export class LangiumDocuments extends DefaultLangiumDocuments {
|
|
|
88
94
|
* Reset the project IDs of all documents.
|
|
89
95
|
*/
|
|
90
96
|
resetProjectIds() {
|
|
91
|
-
|
|
97
|
+
this.allKnownDocuments.forEach(doc => {
|
|
92
98
|
if (exclude(doc)) {
|
|
93
99
|
return;
|
|
94
100
|
}
|
|
@@ -60,6 +60,10 @@ export declare class ProjectsManager {
|
|
|
60
60
|
get default(): ProjectData;
|
|
61
61
|
get all(): NonEmptyReadonlyArray<scalar.ProjectId>;
|
|
62
62
|
getProject(arg: scalar.ProjectId | LangiumDocument): Project;
|
|
63
|
+
/**
|
|
64
|
+
* Returns all projects that include the specified folder, or inside the folder.
|
|
65
|
+
*/
|
|
66
|
+
findAllProjectsByFolder(folder: URI | string): ProjectData[];
|
|
63
67
|
/**
|
|
64
68
|
* Validates and ensures the project ID.
|
|
65
69
|
* If no project ID is specified, returns default project ID
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
import { isLikeC4Config, normalizeIncludeConfig, validateProjectConfig, } from '@likec4/config';
|
|
3
|
-
import { BiMap, DefaultMap, invariant, memoizeProp, nonNullable } from '@likec4/core/utils';
|
|
4
|
-
import { wrapError } from '@likec4/log';
|
|
3
|
+
import { BiMap, compareNaturalHierarchically, DefaultMap, invariant, memoizeProp, nonNullable, } from '@likec4/core/utils';
|
|
4
|
+
import { loggable, wrapError } from '@likec4/log';
|
|
5
5
|
import { deepEqual } from 'fast-equals';
|
|
6
|
-
import {
|
|
6
|
+
import { isOperationCancelled, OperationCancelled, URI, WorkspaceCache, } from 'langium';
|
|
7
7
|
import picomatch from 'picomatch';
|
|
8
|
-
import { hasAtLeast, isNullish, map, pipe, prop,
|
|
9
|
-
import { cleanDoubleSlashes, isRelative, joinRelativeURL, joinURL, parseFilename, withoutProtocol, withTrailingSlash, } from 'ufo';
|
|
8
|
+
import { filter, hasAtLeast, isNullish, map, pipe, prop, sort } from 'remeda';
|
|
9
|
+
import { cleanDoubleSlashes, isRelative, joinRelativeURL, joinURL, parseFilename, withoutProtocol, withoutTrailingSlash, withTrailingSlash, } from 'ufo';
|
|
10
|
+
import { isLikeC4Builtin } from '../likec4lib';
|
|
10
11
|
import { logger as mainLogger } from '../logger';
|
|
11
12
|
const logger = mainLogger.getChild('ProjectsManager');
|
|
12
13
|
function normalizeUri(uri) {
|
|
@@ -21,6 +22,11 @@ function normalizeUri(uri) {
|
|
|
21
22
|
return uri.uri.toString();
|
|
22
23
|
}
|
|
23
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Compare function to ensure consistent order
|
|
27
|
+
*/
|
|
28
|
+
const compare = compareNaturalHierarchically('/', true);
|
|
29
|
+
const compareUri = (a, b) => compare(withoutTrailingSlash(a.path), withoutTrailingSlash(b.path));
|
|
24
30
|
/**
|
|
25
31
|
* Returns a predicate that checks if the given path is included in the project folder.
|
|
26
32
|
*/
|
|
@@ -72,12 +78,12 @@ export class ProjectsManager {
|
|
|
72
78
|
*/
|
|
73
79
|
#lookupById = new DefaultMap((id) => {
|
|
74
80
|
if (id === _a.DefaultProjectId) {
|
|
75
|
-
const
|
|
81
|
+
const folder = ProjectFolder(this.getWorkspaceFolder());
|
|
76
82
|
return {
|
|
77
83
|
id,
|
|
78
84
|
config: DefaultProject.config,
|
|
79
|
-
folder
|
|
80
|
-
folderUri,
|
|
85
|
+
folder,
|
|
86
|
+
folderUri: URI.parse(folder),
|
|
81
87
|
exclude: DefaultProject.exclude,
|
|
82
88
|
includeConfig: DefaultProject.includeConfig,
|
|
83
89
|
};
|
|
@@ -122,19 +128,7 @@ export class ProjectsManager {
|
|
|
122
128
|
get default() {
|
|
123
129
|
if (!this.#defaultProject) {
|
|
124
130
|
const id = this.defaultProjectId ?? _a.DefaultProjectId;
|
|
125
|
-
|
|
126
|
-
if (!project) {
|
|
127
|
-
const folderUri = this.getWorkspaceFolder();
|
|
128
|
-
project = {
|
|
129
|
-
id,
|
|
130
|
-
config: DefaultProject.config,
|
|
131
|
-
folder: ProjectFolder(folderUri),
|
|
132
|
-
folderUri,
|
|
133
|
-
exclude: DefaultProject.exclude,
|
|
134
|
-
includeConfig: DefaultProject.includeConfig,
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
this.#defaultProject = project;
|
|
131
|
+
this.#defaultProject = this.#lookupById.get(id);
|
|
138
132
|
}
|
|
139
133
|
return this.#defaultProject;
|
|
140
134
|
}
|
|
@@ -158,23 +152,7 @@ export class ProjectsManager {
|
|
|
158
152
|
}
|
|
159
153
|
getProject(arg) {
|
|
160
154
|
const id = typeof arg === 'string' ? arg : (arg.likec4ProjectId || this.belongsTo(arg));
|
|
161
|
-
|
|
162
|
-
let folderUri;
|
|
163
|
-
try {
|
|
164
|
-
folderUri = this.services.workspace.WorkspaceManager.workspaceUri;
|
|
165
|
-
}
|
|
166
|
-
catch (error) {
|
|
167
|
-
logger.warn('Failed to get workspace URI, using default folder', { error });
|
|
168
|
-
folderUri = URI.file('/');
|
|
169
|
-
// ignore - workspace not initialized
|
|
170
|
-
}
|
|
171
|
-
return {
|
|
172
|
-
id: _a.DefaultProjectId,
|
|
173
|
-
config: DefaultProject.config,
|
|
174
|
-
folderUri,
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
const project = nonNullable(this.#lookupById.get(id), `Project ${id} not found`);
|
|
155
|
+
const project = this.#lookupById.get(id);
|
|
178
156
|
return {
|
|
179
157
|
id,
|
|
180
158
|
folderUri: project.folderUri,
|
|
@@ -182,6 +160,14 @@ export class ProjectsManager {
|
|
|
182
160
|
...(project.includePaths && { includePaths: map(project.includePaths, prop('uri')) }),
|
|
183
161
|
};
|
|
184
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Returns all projects that include the specified folder, or inside the folder.
|
|
165
|
+
*/
|
|
166
|
+
findAllProjectsByFolder(folder) {
|
|
167
|
+
const projectFolder = ProjectFolder(folder);
|
|
168
|
+
const isInsideOrIncludes = (p) => p.folder.startsWith(projectFolder) || projectFolder.startsWith(p.folder);
|
|
169
|
+
return this.#projects.filter(isInsideOrIncludes);
|
|
170
|
+
}
|
|
185
171
|
/**
|
|
186
172
|
* Validates and ensures the project ID.
|
|
187
173
|
* If no project ID is specified, returns default project ID
|
|
@@ -279,8 +265,11 @@ export class ProjectsManager {
|
|
|
279
265
|
return await this.registerProject({ config, folderUri }, cancelToken);
|
|
280
266
|
}
|
|
281
267
|
catch (error) {
|
|
282
|
-
|
|
283
|
-
|
|
268
|
+
if (!isOperationCancelled(error)) {
|
|
269
|
+
this.services.lsp.Connection?.window.showErrorMessage(`LikeC4: Failed to register project at ${configFile.fsPath}`);
|
|
270
|
+
throw wrapError(error, `Failed to register project config ${configFile.fsPath}:\n`);
|
|
271
|
+
}
|
|
272
|
+
return Promise.reject(error);
|
|
284
273
|
}
|
|
285
274
|
}
|
|
286
275
|
/**
|
|
@@ -312,9 +301,7 @@ export class ProjectsManager {
|
|
|
312
301
|
// if there is any project within subfolder or parent folder
|
|
313
302
|
// we need to reset assigned to documents project IDs
|
|
314
303
|
mustReset = this.#projects.some(p => p.folder.startsWith(folder) || folder.startsWith(p.folder));
|
|
315
|
-
this.#projects = pipe([...this.#projects, project],
|
|
316
|
-
// sort by folder depth (longest first)
|
|
317
|
-
[({ folder }) => withoutProtocol(folder).split('/').length, 'desc']));
|
|
304
|
+
this.#projects = pipe([...this.#projects, project], sort((a, b) => compareUri(a.folderUri, b.folderUri)));
|
|
318
305
|
logger.info `register project ${project.id} folder: ${folder}`;
|
|
319
306
|
}
|
|
320
307
|
else {
|
|
@@ -335,8 +322,6 @@ export class ProjectsManager {
|
|
|
335
322
|
const includeConfig = normalizeIncludeConfig(config.include);
|
|
336
323
|
project.includeConfig = includeConfig;
|
|
337
324
|
}
|
|
338
|
-
// Reset cached default project
|
|
339
|
-
this.#defaultProject = undefined;
|
|
340
325
|
if (isNullish(config.exclude)) {
|
|
341
326
|
project.exclude = DefaultProject.exclude;
|
|
342
327
|
}
|
|
@@ -396,15 +381,22 @@ export class ProjectsManager {
|
|
|
396
381
|
else {
|
|
397
382
|
delete project.includePaths;
|
|
398
383
|
}
|
|
384
|
+
// Reset cached default project
|
|
385
|
+
this.#defaultProject = undefined;
|
|
399
386
|
this.#projectIdToFolder.set(project.id, folder);
|
|
400
387
|
this.#lookupById.clear();
|
|
401
388
|
// Reset assigned project IDs if no projects reload is active
|
|
402
389
|
if (mustReset && !this.#activeReload) {
|
|
403
390
|
await this.rebuidProject(project.id, cancelToken).catch(error => {
|
|
391
|
+
if (isOperationCancelled(error)) {
|
|
392
|
+
return Promise.reject(error);
|
|
393
|
+
}
|
|
404
394
|
logger.warn('Failed to rebuild project {projectId} after config change', {
|
|
405
395
|
projectId: project.id,
|
|
406
396
|
error,
|
|
407
397
|
});
|
|
398
|
+
// ignore error, we logged it
|
|
399
|
+
return Promise.resolve();
|
|
408
400
|
});
|
|
409
401
|
}
|
|
410
402
|
return project;
|
|
@@ -424,19 +416,25 @@ export class ProjectsManager {
|
|
|
424
416
|
}
|
|
425
417
|
#activeReload = null;
|
|
426
418
|
async reloadProjects(cancelToken) {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
}
|
|
432
|
-
else {
|
|
433
|
-
logger.debug `reload projects is already in progress, waiting`;
|
|
434
|
-
}
|
|
435
|
-
await this.#activeReload;
|
|
419
|
+
if (this.#activeReload) {
|
|
420
|
+
logger.debug `reload projects is already in progress, waiting`;
|
|
421
|
+
return await this.#activeReload.catch(() => {
|
|
422
|
+
// ignore errors
|
|
423
|
+
});
|
|
436
424
|
}
|
|
437
|
-
|
|
425
|
+
logger.debug `schedule reload projects`;
|
|
426
|
+
this.#activeReload = Promise.resolve()
|
|
427
|
+
.then(() => this._reloadProjects(cancelToken))
|
|
428
|
+
.catch(error => {
|
|
429
|
+
if (!isOperationCancelled(error)) {
|
|
430
|
+
logger.warn('Failed to reload projects', { error });
|
|
431
|
+
}
|
|
432
|
+
return Promise.reject(error);
|
|
433
|
+
})
|
|
434
|
+
.finally(() => {
|
|
438
435
|
this.#activeReload = null;
|
|
439
|
-
}
|
|
436
|
+
});
|
|
437
|
+
return await this.#activeReload;
|
|
440
438
|
}
|
|
441
439
|
async _reloadProjects(cancelToken) {
|
|
442
440
|
const folders = this.services.workspace.WorkspaceManager.workspaceFolders;
|
|
@@ -464,21 +462,25 @@ export class ProjectsManager {
|
|
|
464
462
|
if (configFiles.length === 0 && this.#projects.length !== 0) {
|
|
465
463
|
logger.warning('No config files found, but some projects were registered before');
|
|
466
464
|
}
|
|
465
|
+
// Sort config files hierarchically, ensuring consistent order
|
|
466
|
+
configFiles.sort(compareUri);
|
|
467
467
|
this.#projects = [];
|
|
468
468
|
this.#projectIdToFolder.clear();
|
|
469
469
|
this.#lookupById.clear();
|
|
470
470
|
for (const uri of configFiles) {
|
|
471
|
-
if (cancelToken) {
|
|
472
|
-
|
|
473
|
-
}
|
|
474
|
-
try {
|
|
475
|
-
await this.registerConfigFile(uri, cancelToken);
|
|
476
|
-
}
|
|
477
|
-
catch (error) {
|
|
478
|
-
logger.error('Failed to load config file {uri}', { uri: uri.fsPath, error });
|
|
471
|
+
if (cancelToken?.isCancellationRequested) {
|
|
472
|
+
break;
|
|
479
473
|
}
|
|
474
|
+
await this.registerConfigFile(uri, cancelToken).catch(error => {
|
|
475
|
+
if (!isOperationCancelled(error)) {
|
|
476
|
+
logger.warn(loggable(error));
|
|
477
|
+
}
|
|
478
|
+
});
|
|
480
479
|
}
|
|
481
480
|
this.reset();
|
|
481
|
+
if (cancelToken?.isCancellationRequested) {
|
|
482
|
+
throw OperationCancelled;
|
|
483
|
+
}
|
|
482
484
|
await this.services.workspace.WorkspaceManager.rebuildAll(cancelToken);
|
|
483
485
|
}
|
|
484
486
|
uniqueProjectId(name) {
|
|
@@ -511,9 +513,15 @@ export class ProjectsManager {
|
|
|
511
513
|
const log = logger.getChild(project.id);
|
|
512
514
|
const folder = project.folder;
|
|
513
515
|
const includePaths = project.includePaths;
|
|
514
|
-
const
|
|
515
|
-
.
|
|
516
|
-
.filter(doc =>
|
|
516
|
+
const allDocs = this.services.workspace.LangiumDocuments
|
|
517
|
+
.allKnownDocuments
|
|
518
|
+
.filter(doc => !isLikeC4Builtin(doc.uri))
|
|
519
|
+
.toArray();
|
|
520
|
+
// If no documents are found, return early
|
|
521
|
+
if (allDocs.length === 0) {
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
const docs = pipe(allDocs, filter(doc => {
|
|
517
525
|
if (project.exclude?.(doc.uri.path)) {
|
|
518
526
|
return false;
|
|
519
527
|
}
|
|
@@ -526,25 +534,22 @@ export class ProjectsManager {
|
|
|
526
534
|
}
|
|
527
535
|
const docdir = withTrailingSlash(joinRelativeURL(docUriStr, '..'));
|
|
528
536
|
return docdir.startsWith(folder) || folder.startsWith(docdir);
|
|
529
|
-
})
|
|
530
|
-
|
|
531
|
-
.toArray();
|
|
532
|
-
if (docs.length > 0) {
|
|
533
|
-
log.info('rebuild project documents: {docs}', {
|
|
534
|
-
docs: docs.length,
|
|
535
|
-
});
|
|
536
|
-
this.reset();
|
|
537
|
-
await this.services.workspace.DocumentBuilder
|
|
538
|
-
.update(docs, [], cancelToken)
|
|
539
|
-
.catch(error => {
|
|
540
|
-
log.warn('Failed to rebuild project', {
|
|
541
|
-
error,
|
|
542
|
-
});
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
else {
|
|
537
|
+
}), map(d => d.uri));
|
|
538
|
+
if (docs.length === 0) {
|
|
546
539
|
log.debug('no documents in project, skipping rebuild');
|
|
540
|
+
return;
|
|
547
541
|
}
|
|
542
|
+
log.info('rebuild project documents: {docs}', {
|
|
543
|
+
docs: docs.length,
|
|
544
|
+
});
|
|
545
|
+
this.reset();
|
|
546
|
+
await this.services.workspace.DocumentBuilder
|
|
547
|
+
.update(docs, [], cancelToken)
|
|
548
|
+
.catch(error => {
|
|
549
|
+
log.warn('Failed to rebuild project', {
|
|
550
|
+
error,
|
|
551
|
+
});
|
|
552
|
+
});
|
|
548
553
|
}
|
|
549
554
|
findProjectForDocument(documentUri) {
|
|
550
555
|
return this.mappingsToProject.get(documentUri, () => {
|
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.47.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bugs": "https://github.com/likec4/likec4/issues",
|
|
7
7
|
"homepage": "https://likec4.dev",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"sources": "./src/index.ts",
|
|
35
35
|
"default": {
|
|
36
36
|
"types": "./dist/index.d.ts",
|
|
37
|
+
"import": "./dist/index.js",
|
|
37
38
|
"default": "./dist/index.js"
|
|
38
39
|
}
|
|
39
40
|
},
|
|
@@ -78,11 +79,11 @@
|
|
|
78
79
|
"dependencies": {
|
|
79
80
|
"@hpcc-js/wasm-graphviz": "1.17.0",
|
|
80
81
|
"bundle-require": "^5.1.0",
|
|
81
|
-
"esbuild": "0.27.
|
|
82
|
+
"esbuild": "0.27.2"
|
|
82
83
|
},
|
|
83
84
|
"devDependencies": {
|
|
84
85
|
"@hono/node-server": "^1.19.7",
|
|
85
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
86
|
+
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
86
87
|
"@msgpack/msgpack": "^3.1.2",
|
|
87
88
|
"@smithy/util-base64": "^4.3.0",
|
|
88
89
|
"@types/natural-compare-lite": "^1.4.2",
|
|
@@ -93,19 +94,19 @@
|
|
|
93
94
|
"chokidar": "^5.0.0",
|
|
94
95
|
"defu": "^6.1.4",
|
|
95
96
|
"esm-env": "^1.2.2",
|
|
96
|
-
"fast-equals": "^
|
|
97
|
+
"fast-equals": "^6.0.0",
|
|
97
98
|
"fdir": "6.4.0",
|
|
98
|
-
"fetch-to-node": "^2.1.0",
|
|
99
99
|
"hono": "^4.11.1",
|
|
100
|
-
"immer": "^11.0
|
|
100
|
+
"immer": "^11.1.0",
|
|
101
101
|
"indent-string": "^5.0.0",
|
|
102
102
|
"json5": "^2.2.3",
|
|
103
103
|
"langium": "3.5.0",
|
|
104
104
|
"langium-cli": "3.5.2",
|
|
105
105
|
"nano-spawn": "^2.0.0",
|
|
106
|
+
"nanoid": "5.1.6",
|
|
106
107
|
"natural-compare-lite": "^1.4.0",
|
|
107
|
-
"oxlint": "1.
|
|
108
|
-
"p-debounce": "
|
|
108
|
+
"oxlint": "1.35.0",
|
|
109
|
+
"p-debounce": "5.1.0",
|
|
109
110
|
"p-queue": "8.1.1",
|
|
110
111
|
"p-timeout": "6.1.4",
|
|
111
112
|
"picomatch": "^4.0.3",
|
|
@@ -113,7 +114,7 @@
|
|
|
113
114
|
"remeda": "^2.32.0",
|
|
114
115
|
"strip-indent": "^4.1.1",
|
|
115
116
|
"tsx": "4.21.0",
|
|
116
|
-
"turbo": "2.
|
|
117
|
+
"turbo": "2.7.2",
|
|
117
118
|
"type-fest": "^4.41.0",
|
|
118
119
|
"typescript": "5.9.3",
|
|
119
120
|
"ufo": "1.6.1",
|
|
@@ -126,13 +127,13 @@
|
|
|
126
127
|
"vscode-uri": "3.1.0",
|
|
127
128
|
"which": "^5.0.0",
|
|
128
129
|
"zod": "^3.25.76",
|
|
129
|
-
"@likec4/config": "1.
|
|
130
|
-
"@likec4/core": "1.
|
|
131
|
-
"@likec4/devops": "1.42.0",
|
|
130
|
+
"@likec4/config": "1.47.0",
|
|
131
|
+
"@likec4/core": "1.47.0",
|
|
132
132
|
"@likec4/icons": "1.46.4",
|
|
133
|
-
"@likec4/
|
|
134
|
-
"@likec4/layouts": "1.
|
|
135
|
-
"@likec4/tsconfig": "1.46.1"
|
|
133
|
+
"@likec4/devops": "1.42.0",
|
|
134
|
+
"@likec4/layouts": "1.47.0",
|
|
135
|
+
"@likec4/tsconfig": "1.46.1",
|
|
136
|
+
"@likec4/log": "1.46.1"
|
|
136
137
|
},
|
|
137
138
|
"scripts": {
|
|
138
139
|
"typecheck": "tsc -b --verbose",
|