@likec4/language-server 1.57.0 → 1.58.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.
@@ -41,335 +41,13 @@ declare class LikeC4DocumentationProvider extends JSDocDocumentationProvider {
41
41
  getDocumentation(node: AstNode): string | undefined;
42
42
  }
43
43
  //#endregion
44
- //#region src/workspace/ProjectsManager.d.ts
45
- type NormalizedUri = Tagged<string, 'NormalizedUri'>;
46
- type DocOrUri = LangiumDocument | string | URI;
47
- /**
48
- * A tagged string that represents a project folder URI (with trailing slash).
49
- * Used in `startsWith` checks to determine if a document belongs to a project.
50
- */
51
- type ProjectFolder = Tagged<string, 'ProjectFolder'>;
52
- declare function ProjectFolder(folder: URI | string): ProjectFolder;
53
- interface Project {
54
- id: ProjectId$1;
55
- folderUri: URI;
56
- config: LikeC4ProjectConfig;
57
- }
58
- interface ProjectData extends Project {
59
- id: ProjectId$1;
60
- folder: ProjectFolder;
61
- config: LikeC4ProjectConfig;
62
- configUri: URI;
63
- folderUri: URI;
64
- exclude?: {
65
- (test: string): boolean;
66
- };
67
- /**
68
- * Resolved include paths with both URI and folder string representations.
69
- * These are additional directories that are part of this project.
70
- */
71
- includePaths?: NonEmptyArray<{
72
- uri: URI;
73
- folder: ProjectFolder;
74
- }>;
75
- /**
76
- * Normalized include configuration (paths, maxDepth, fileThreshold).
77
- */
78
- includeConfig: IncludeConfig;
79
- }
80
- type RegisterProjectOptions = {
81
- config: LikeC4ProjectConfig | LikeC4ProjectConfigInput;
82
- } & ({
83
- configUri: URI | string;
84
- } | {
85
- folderUri: URI | string;
86
- });
87
- declare class ProjectsManager {
88
- #private;
89
- protected services: LikeC4SharedServices;
90
- /**
91
- * The global project ID used for all documents
92
- * that are not part of a specific project.
93
- */
94
- static readonly DefaultProjectId: ProjectId$1;
95
- constructor(services: LikeC4SharedServices);
96
- /**
97
- * Checks if a document is excluded by workspace-level patterns.
98
- * These patterns come from VS Code settings and take precedence over project-level excludes.
99
- */
100
- isExcludedByWorkspace(uri: NormalizedUri | URI): boolean;
101
- /**
102
- * Updates the workspace-level exclude patterns from VS Code settings.
103
- * Called during initial server startup; dynamic changes restart the server.
104
- */
105
- setWorkspaceExcludePatterns(patterns: string[] | undefined): void;
106
- /**
107
- * Returns:
108
- * - configured default project ID if set
109
- * - the default project ID if there are no projects.
110
- * - the ID of the only project
111
- * - undefined if there are multiple projects.
112
- */
113
- get defaultProjectId(): ProjectId$1 | undefined;
114
- set defaultProjectId(id: string | ProjectId$1 | undefined);
115
- get default(): ProjectData;
116
- get all(): NonEmptyReadonlyArray<ProjectId$1>;
117
- getProject(arg: ProjectId$1 | LangiumDocument): ProjectData;
118
- /**
119
- * Returns all projects that overlap with the specified folder (is parent or child)
120
- */
121
- findOverlaped(folder: URI | string): ReadonlyArray<ProjectData>;
122
- /**
123
- * Validates and ensures the project ID.
124
- * If no project ID is specified, returns default project ID
125
- * If there are multiple projects and default project is not set, throws an error
126
- */
127
- ensureProjectId(projectId?: ProjectId$1 | undefined): ProjectId$1;
128
- /**
129
- * Validates and ensures the project data.
130
- * If projectId is not specified, returns default project
131
- *
132
- * If there are multiple projects and default project is not set, throws an error
133
- *
134
- * @see ensureProjectId - to validate project ID only
135
- */
136
- ensureProject(projectId?: ProjectId$1 | undefined): ProjectData;
137
- hasMultipleProjects(): boolean;
138
- /**
139
- * Checks if given document (or URI) must be excluded from processing.
140
- */
141
- isExcluded(document: DocOrUri): boolean;
142
- /**
143
- * Checks if given document (or URI) must be excluded in the context of the project.
144
- */
145
- isExcluded(projectId: ProjectId$1, document: DocOrUri): boolean;
146
- /**
147
- * Checks if the specified document is included by the project:
148
- * - if the document belongs to the project and is not excluded
149
- * - if the document is included by the project
150
- */
151
- isIncluded(projectId: ProjectId$1, document: LangiumDocument | URI | string): boolean;
152
- /**
153
- * Registers likec4 project by config file.
154
- */
155
- registerConfigFile(configUri: URI, cancelToken?: Cancellation.CancellationToken): Promise<ProjectData>;
156
- /**
157
- * Registers (or reloads) likec4 project by config file or config object.
158
- * If there is some project registered at same folder, it will be reloaded.
159
- */
160
- registerProject(opts: RegisterProjectOptions, cancelToken?: Cancellation.CancellationToken): Promise<ProjectData>;
161
- /**
162
- * Determines which project the given document belongs to.
163
- * If the document does not belong to any project, returns the default project ID.
164
- */
165
- ownerProjectId(document: LangiumDocument | URI | string): ProjectId$1;
166
- /**
167
- * Returns path to the document relative to the project folder.
168
- * If the document does not belong to any project, returns the document URI as string.
169
- */
170
- relativePath(document: LangiumDocument | URI | string): string;
171
- /**
172
- * Returns true if the manager is currently initializing or reloading projects.
173
- * This is used to prevent duplicate reload operations.
174
- */
175
- protected get isInitiatingOrReloading(): boolean;
176
- reloadProjects(cancelToken?: Cancellation.CancellationToken): Promise<void>;
177
- protected _reloadProjects(cancelToken?: Cancellation.CancellationToken): Promise<void>;
178
- protected uniqueProjectId(name: string): ProjectId$1;
179
- protected resetCaches(): void;
180
- rebuildProject(projectId: ProjectId$1, cancelToken?: Cancellation.CancellationToken): Promise<void>;
181
- /**
182
- * Returns all include paths from all projects.
183
- * Used by WorkspaceManager to scan additional directories for C4 files.
184
- */
185
- getAllIncludePaths(): Array<{
186
- projectId: ProjectId$1;
187
- includePath: URI;
188
- includeConfig: IncludeConfig;
189
- }>;
190
- /**
191
- * Register a listener to be called when the projects configuration has changed.
192
- * @returns A disposable that can be used to unregister the callback.
193
- */
194
- onProjectsUpdate(callback: () => void): Disposable;
195
- private getWorkspaceFolder;
196
- private notifyListeners;
197
- private updateIncludesExcludes;
198
- private warnIfConfigOverride;
199
- }
200
- //#endregion
201
- //#region src/filesystem/types.d.ts
202
- interface FileNode extends FileSystemNode {
203
- readonly isFile: true;
204
- readonly isDirectory: false;
205
- }
206
- interface FileSystemProvider$1 extends FileSystemProvider {
207
- /**
208
- * Scans the project files for the given URI.
209
- * @returns The list of file system entries that are contained within the specified directory.
210
- */
211
- scanProjectFiles(folderUri: URI): Promise<FileNode[]>;
212
- /**
213
- * Loads the project config from the given file.
214
- * @returns The project config.
215
- * @throws Error if the file does not exist or is not a valid project config.
216
- */
217
- loadProjectConfig(filepath: URI): Promise<LikeC4ProjectConfig>;
218
- /**
219
- * Reads the directory and returns LikeC4 files.
220
- *
221
- * @param options.recursive If true, recursively reads the directory,
222
- * @param options.maxDepth Maximum depth to traverse when recursive is true (default: Infinity)
223
- */
224
- readDirectory(uri: URI, options?: {
225
- recursive?: boolean;
226
- maxDepth?: number;
227
- }): Promise<FileNode[]>;
228
- /**
229
- * Finds all files in the given directory, matching the given filter.
230
- */
231
- scanDirectory(directory: URI, filter: (filepath: string, isDirectory: boolean) => boolean): Promise<FileNode[]>;
232
- /**
233
- * Writes the content to the file system.
234
- * Used by manual layouts.
235
- */
236
- writeFile(uri: URI, content: string): Promise<void>;
237
- /**
238
- * Deletes the file from the file system.
239
- * Used by manual layouts.
240
- * @return true if the file was deleted, false if the file did not exist.
241
- */
242
- deleteFile(uri: URI): Promise<boolean>;
243
- }
244
- interface FileSystemModuleContext extends FileSystemWatcherModuleContext {
245
- fileSystemProvider: () => FileSystemProvider$1;
246
- }
247
- interface FileSystemWatcherModuleContext {
248
- fileSystemWatcher: (services: LikeC4SharedServices) => FileSystemWatcher;
249
- }
250
- interface FileSystemWatcher extends AsyncDisposable {
251
- /**
252
- * Watches a folder for changes and triggers a reload of the documents and projects.
253
- */
254
- watch(folder: string): void;
255
- }
256
- interface LikeC4ManualLayoutsModuleContext {
257
- manualLayouts: (services: LikeC4SharedServices) => LikeC4ManualLayouts;
258
- }
259
- type ManualLayoutsSnapshot = {
260
- hash: string;
261
- views: Record<ViewId$1, LayoutedView$1>;
262
- };
263
- type ManualLayoutUpdateEvent = {
264
- updated: URI;
265
- projectId: ProjectId$1;
266
- viewId: ViewId$1;
267
- } | {
268
- removed: URI;
269
- projectId: ProjectId$1;
270
- /**
271
- * Missing if triggered by FS event (file was deleted)
272
- */
273
- viewId?: ViewId$1;
274
- };
275
- type ManualLayoutUpdateListener = (event: ManualLayoutUpdateEvent) => void;
276
- interface LikeC4ManualLayouts {
277
- /**
278
- * Reads a single layouted view from the file system by its URI.
279
- * Used by the language server to get the current layout state.
280
- */
281
- readSnapshot(uri: URI): Promise<LayoutedView$1 | null>;
282
- read(project: Project): Promise<ManualLayoutsSnapshot | null>;
283
- write(project: Project, layouted: LayoutedView$1): Promise<Location>;
284
- remove(project: Project, view: ViewId$1): Promise<Location | null>;
285
- clearCaches(): void;
286
- /**
287
- * Registers a listener for manual layout updates.
288
- * The listener will be called when a manual layout is created, updated, or deleted.
289
- */
290
- onManualLayoutUpdate(listener: ManualLayoutUpdateListener): Disposable;
291
- /**
292
- * Handles file system updates for manual layouts.
293
- * Used by the file system watcher to notify the manual layouts module of changes.
294
- * @param event The file system event
295
- */
296
- handleFileSystemUpdate(event: {
297
- update: URI;
298
- delete?: never;
299
- } | {
300
- delete: URI;
301
- update?: never;
302
- }): Promise<void>;
303
- }
304
- //#endregion
305
- //#region src/filesystem/noop.d.ts
306
- declare const NoFileSystemWatcher: FileSystemWatcherModuleContext;
307
- declare const NoFileSystem: FileSystemModuleContext;
308
- declare const NoLikeC4ManualLayouts: LikeC4ManualLayoutsModuleContext;
309
- //#endregion
310
- //#region src/filesystem/LikeC4FileSystem.d.ts
311
- declare const WithFileSystem: (enableWatcher?: boolean) => FileSystemModuleContext;
312
- //#endregion
313
- //#region src/filesystem/ChokidarWatcher.d.ts
314
- declare const WithChokidarWatcher: FileSystemWatcherModuleContext;
315
- //#endregion
316
- //#region src/filesystem/LikeC4ManualLayouts.d.ts
317
- declare const WithLikeC4ManualLayouts: LikeC4ManualLayoutsModuleContext;
318
- //#endregion
319
- //#region src/formatting/LikeC4Formatter.d.ts
320
- type QuoteStyle = 'single' | 'double' | 'ignore' | 'auto';
321
- interface LikeC4FormatterOptions {
322
- quoteStyle: QuoteStyle;
323
- }
324
- type ExtendedFormattingCommandType = 'normalizeQuotes';
325
- interface ExtendedFormattingCommand {
326
- type: ExtendedFormattingCommandType;
327
- region: FormattingRegion;
328
- }
329
- declare class LikeC4Formatter extends AbstractFormatter {
330
- protected options: LikeC4FormatterOptions;
331
- extendedFormattingCommands: ExtendedFormattingCommand[];
332
- constructor(services: LikeC4Services);
333
- protected doDocumentFormat(document: LangiumDocument, options: FormattingOptions, range?: Range): TextEdit[];
334
- protected format(node: AstNode): void;
335
- protected formatTags(node: AstNode): void;
336
- protected formatDeploymentRelation(node: AstNode): void;
337
- protected formatExtendDeployment(node: AstNode): void;
338
- protected formatRelation(node: AstNode): void;
339
- protected removeIndentFromTopLevelStatements(node: AstNode): void;
340
- protected indentContentInBraces(node: AstNode): void;
341
- protected appendKeywordsWithSpace(node: AstNode): void;
342
- protected formatView(node: AstNode): void;
343
- protected formatLeafProperty(node: AstNode): void;
344
- protected formatLinkProperty(node: AstNode): void;
345
- protected formatNavigateToProperty(node: AstNode): void;
346
- protected formatAutolayoutProperty(node: AstNode): void;
347
- protected formatMetadataProperty(node: AstNode): void;
348
- protected formatElementDeclaration(node: AstNode): void;
349
- protected formatExtendElement(node: AstNode): void;
350
- protected formatGlobals(node: AstNode): void;
351
- protected formatImports(node: AstNode): void;
352
- protected formatSpecificationRule(node: AstNode): void;
353
- protected formatWithPredicate(node: AstNode): void;
354
- protected formatDeploymentNodeDeclaration(node: AstNode): void;
355
- protected formatDeployedInstance(node: AstNode): void;
356
- protected formatViewRuleGlobalStyle(node: AstNode): void;
357
- protected formatViewRuleGlobalPredicate(node: AstNode): void;
358
- protected formatViewRuleGroup(node: AstNode): void;
359
- protected formatViewRuleStyle(node: AstNode): void;
360
- protected formatWhereExpression(node: AstNode): void;
361
- protected formatWhereRelationExpression(node: AstNode): void;
362
- protected formatWhereElementExpression(node: AstNode): void;
363
- protected formatIncludeExcludeExpressions(node: AstNode): void;
364
- protected formatRelationExpression(node: AstNode): void;
365
- private findPredicateExpressionRoot;
366
- private on;
367
- private doExtendedFormatting;
368
- protected normalizeQuotes(node: AstNode): void;
369
- private quotesNormalizerFactory;
370
- private escapeQuotesInternalQuotes;
371
- private getAutoQuoteStyle;
372
- private onConfigurationUpdate;
44
+ //#region src/utils/disposable.d.ts
45
+ declare abstract class ADisposable implements Disposable {
46
+ protected toDispose: Disposable[];
47
+ protected isDisposed: boolean;
48
+ onDispose(...disposable: Disposable[]): void;
49
+ dispose(): void;
50
+ protected throwIfDisposed(): void;
373
51
  }
374
52
  //#endregion
375
53
  //#region src/generated/ast.d.ts
@@ -654,9 +332,9 @@ interface DynamicViewIncludePredicate extends langium.AstNode {
654
332
  }
655
333
  declare const DynamicViewIncludePredicate = "DynamicViewIncludePredicate";
656
334
  interface DynamicViewParallelSteps extends langium.AstNode {
657
- readonly $container: DynamicViewBody;
335
+ readonly $container: DynamicViewBody | DynamicViewParallelSteps;
658
336
  readonly $type: 'DynamicViewParallelSteps';
659
- steps: Array<DynamicViewStep>;
337
+ steps: Array<DynamicViewParallelSteps | DynamicViewStep>;
660
338
  }
661
339
  declare const DynamicViewParallelSteps = "DynamicViewParallelSteps";
662
340
  interface DynamicViewRef extends langium.AstNode {
@@ -1752,95 +1430,426 @@ interface ParsedAstExtendRelation {
1752
1430
  [key: string]: string | string[];
1753
1431
  };
1754
1432
  }
1755
- interface ParsedAstRelation {
1756
- id: c4.RelationId;
1757
- astPath: string;
1758
- source: c4.FqnRef.ModelRef;
1759
- target: c4.FqnRef.ModelRef;
1760
- kind?: c4.RelationshipKind;
1761
- tags?: c4.NonEmptyArray<c4.Tag>;
1762
- title: string;
1763
- description?: c4.MarkdownOrString;
1764
- technology?: string;
1765
- color?: c4.Color;
1766
- line?: c4.RelationshipLineType;
1767
- head?: c4.RelationshipArrowType;
1768
- tail?: c4.RelationshipArrowType;
1769
- links?: c4.NonEmptyArray<c4.Link>;
1770
- navigateTo?: c4.ViewId;
1771
- metadata?: {
1772
- [key: string]: string | string[];
1773
- };
1433
+ interface ParsedAstRelation {
1434
+ id: c4.RelationId;
1435
+ astPath: string;
1436
+ source: c4.FqnRef.ModelRef;
1437
+ target: c4.FqnRef.ModelRef;
1438
+ kind?: c4.RelationshipKind;
1439
+ tags?: c4.NonEmptyArray<c4.Tag>;
1440
+ title: string;
1441
+ description?: c4.MarkdownOrString;
1442
+ technology?: string;
1443
+ color?: c4.Color;
1444
+ line?: c4.RelationshipLineType;
1445
+ head?: c4.RelationshipArrowType;
1446
+ tail?: c4.RelationshipArrowType;
1447
+ links?: c4.NonEmptyArray<c4.Link>;
1448
+ navigateTo?: c4.ViewId;
1449
+ metadata?: {
1450
+ [key: string]: string | string[];
1451
+ };
1452
+ }
1453
+ type ParsedAstDeployment = Simplify<MergeExclusive<ParsedAstDeployment.Node, ParsedAstDeployment.Instance>>;
1454
+ declare namespace ParsedAstDeployment {
1455
+ type Node = c4.DeploymentNode;
1456
+ type Instance = Omit<c4.DeployedInstance, 'element'> & {
1457
+ readonly element: c4.FqnRef.ModelRef;
1458
+ };
1459
+ }
1460
+ type ParsedAstDeploymentRelation = c4.DeploymentRelationship & {
1461
+ astPath: string;
1462
+ };
1463
+ type ParsedAstGlobals = Writable<c4.ModelGlobals>;
1464
+ interface ParsedAstElementView {
1465
+ id: c4.ViewId;
1466
+ viewOf?: c4.Fqn;
1467
+ extends?: c4.ViewId;
1468
+ astPath: string;
1469
+ title: string | null;
1470
+ description: c4.MarkdownOrString | null;
1471
+ tags: c4.NonEmptyArray<c4.Tag> | null;
1472
+ links: c4.NonEmptyArray<c4.Link> | null;
1473
+ rules: c4.ElementViewRule[];
1474
+ }
1475
+ interface ParsedAstDynamicView {
1476
+ id: c4.ViewId;
1477
+ astPath: string;
1478
+ title: string | null;
1479
+ description: c4.MarkdownOrString | null;
1480
+ tags: c4.NonEmptyArray<c4.Tag> | null;
1481
+ links: c4.NonEmptyArray<c4.Link> | null;
1482
+ steps: c4.DynamicViewStep[];
1483
+ rules: Array<c4.DynamicViewRule>;
1484
+ variant: c4.DynamicViewDisplayVariant | undefined;
1485
+ }
1486
+ interface ParsedAstDeploymentView {
1487
+ id: c4.ViewId;
1488
+ astPath: string;
1489
+ title: string | null;
1490
+ description: c4.MarkdownOrString | null;
1491
+ tags: c4.NonEmptyArray<c4.Tag> | null;
1492
+ links: c4.NonEmptyArray<c4.Link> | null;
1493
+ rules: Array<c4.DeploymentViewRule>;
1494
+ }
1495
+ type ParsedAstView = ParsedAstElementView | ParsedAstDynamicView | ParsedAstDeploymentView;
1496
+ interface AstNodeDescriptionWithFqn extends AstNodeDescription {
1497
+ likec4ProjectId: c4.ProjectId;
1498
+ id: c4.Fqn;
1499
+ }
1500
+ type LikeC4AstNode = ValueOf<ConditionalPick<LikeC4AstType, AstNode>>;
1501
+ type LikeC4DocumentDiagnostic = Diagnostic & DiagnosticInfo<LikeC4AstNode>;
1502
+ interface LikeC4DocumentProps {
1503
+ diagnostics?: Array<LikeC4DocumentDiagnostic>;
1504
+ c4Specification?: ParsedAstSpecification;
1505
+ c4Elements?: ParsedAstElement[];
1506
+ c4ExtendElements?: ParsedAstExtend[];
1507
+ c4ExtendDeployments?: ParsedAstExtend[];
1508
+ c4ExtendRelations?: ParsedAstExtendRelation[];
1509
+ c4Relations?: ParsedAstRelation[];
1510
+ c4Globals?: ParsedAstGlobals;
1511
+ c4Views?: ParsedAstView[];
1512
+ c4Deployments?: ParsedAstDeployment[];
1513
+ c4DeploymentRelations?: ParsedAstDeploymentRelation[];
1514
+ c4Imports?: MultiMap<c4.ProjectId, c4.Fqn, Set<c4.Fqn>>;
1515
+ }
1516
+ type LikeC4GrammarDocument = Omit<LangiumDocument<LikeC4Grammar>, 'diagnostics'>;
1517
+ interface LikeC4LangiumDocument extends LikeC4GrammarDocument, LikeC4DocumentProps {
1518
+ likec4ProjectId: c4.ProjectId;
1519
+ }
1520
+ interface ParsedLikeC4LangiumDocument extends LikeC4GrammarDocument, Required<LikeC4DocumentProps> {
1521
+ likec4ProjectId: c4.ProjectId;
1522
+ }
1523
+ //#endregion
1524
+ //#region src/workspace/ProjectsManager.d.ts
1525
+ type NormalizedUri = Tagged<string, 'NormalizedUri'>;
1526
+ type DocOrUri = LangiumDocument | string | URI;
1527
+ /**
1528
+ * A tagged string that represents a project folder URI (with trailing slash).
1529
+ * Used in `startsWith` checks to determine if a document belongs to a project.
1530
+ */
1531
+ type ProjectFolder = Tagged<string, 'ProjectFolder'>;
1532
+ declare function ProjectFolder(folder: URI | string): ProjectFolder;
1533
+ interface Project {
1534
+ id: ProjectId$1;
1535
+ folderUri: URI;
1536
+ config: LikeC4ProjectConfig;
1537
+ }
1538
+ interface ProjectData extends Project {
1539
+ id: ProjectId$1;
1540
+ folder: ProjectFolder;
1541
+ config: LikeC4ProjectConfig;
1542
+ configUri: URI;
1543
+ folderUri: URI;
1544
+ exclude?: {
1545
+ (test: string): boolean;
1546
+ };
1547
+ /**
1548
+ * Resolved include paths with both URI and folder string representations.
1549
+ * These are additional directories that are part of this project.
1550
+ */
1551
+ includePaths?: NonEmptyArray<{
1552
+ uri: URI;
1553
+ folder: ProjectFolder;
1554
+ }>;
1555
+ /**
1556
+ * Normalized include configuration (paths, maxDepth, fileThreshold).
1557
+ */
1558
+ includeConfig: IncludeConfig;
1559
+ }
1560
+ type RegisterProjectOptions = {
1561
+ config: LikeC4ProjectConfig | LikeC4ProjectConfigInput;
1562
+ } & ({
1563
+ configUri: URI | string;
1564
+ } | {
1565
+ folderUri: URI | string;
1566
+ });
1567
+ declare class ProjectsManager extends ADisposable {
1568
+ #private;
1569
+ protected services: LikeC4SharedServices;
1570
+ /**
1571
+ * The global project ID used for all documents
1572
+ * that are not part of a specific project.
1573
+ */
1574
+ static readonly DefaultProjectId: ProjectId$1;
1575
+ constructor(services: LikeC4SharedServices);
1576
+ /**
1577
+ * Checks if a document is excluded by workspace-level patterns.
1578
+ * These patterns come from VS Code settings and take precedence over project-level excludes.
1579
+ */
1580
+ isExcludedByWorkspace(uri: NormalizedUri | URI): boolean;
1581
+ /**
1582
+ * Updates the workspace-level exclude patterns from VS Code settings.
1583
+ * Called during initial server startup; dynamic changes restart the server.
1584
+ */
1585
+ setWorkspaceExcludePatterns(patterns: string[] | undefined): void;
1586
+ /**
1587
+ * Returns:
1588
+ * - configured default project ID if set
1589
+ * - the default project ID if there are no projects.
1590
+ * - the ID of the only project
1591
+ * - undefined if there are multiple projects.
1592
+ */
1593
+ get defaultProjectId(): ProjectId$1 | undefined;
1594
+ set defaultProjectId(id: string | ProjectId$1 | undefined);
1595
+ get default(): ProjectData;
1596
+ get all(): NonEmptyReadonlyArray<ProjectId$1>;
1597
+ getProject(arg: ProjectId$1 | LangiumDocument): ProjectData;
1598
+ /**
1599
+ * Returns all projects that overlap with the specified folder (is parent or child)
1600
+ */
1601
+ findOverlaped(folder: URI | string): ReadonlyArray<ProjectData>;
1602
+ /**
1603
+ * Validates and ensures the project ID.
1604
+ * If no project ID is specified, returns default project ID
1605
+ * If there are multiple projects and default project is not set, throws an error
1606
+ */
1607
+ ensureProjectId(projectId?: ProjectId$1 | undefined): ProjectId$1;
1608
+ /**
1609
+ * Validates and ensures the project data.
1610
+ * If projectId is not specified, returns default project
1611
+ *
1612
+ * If there are multiple projects and default project is not set, throws an error
1613
+ *
1614
+ * @see ensureProjectId - to validate project ID only
1615
+ */
1616
+ ensureProject(projectId?: ProjectId$1 | undefined): ProjectData;
1617
+ hasMultipleProjects(): boolean;
1618
+ /**
1619
+ * Checks if given document (or URI) must be excluded from processing.
1620
+ */
1621
+ isExcluded(document: DocOrUri): boolean;
1622
+ /**
1623
+ * Checks if given document (or URI) must be excluded in the context of the project.
1624
+ */
1625
+ isExcluded(projectId: ProjectId$1, document: DocOrUri): boolean;
1626
+ /**
1627
+ * Checks if the specified document is included by the project:
1628
+ * - if the document belongs to the project and is not excluded
1629
+ * - if the document is included by the project
1630
+ */
1631
+ isIncluded(projectId: ProjectId$1, document: LangiumDocument | URI | string): boolean;
1632
+ /**
1633
+ * Registers likec4 project by config file.
1634
+ */
1635
+ registerConfigFile(configUri: URI, cancelToken?: Cancellation.CancellationToken): Promise<ProjectData>;
1636
+ /**
1637
+ * Registers (or reloads) likec4 project by config file or config object.
1638
+ * If there is some project registered at same folder, it will be reloaded.
1639
+ */
1640
+ registerProject(opts: RegisterProjectOptions, cancelToken?: Cancellation.CancellationToken): Promise<ProjectData>;
1641
+ /**
1642
+ * Determines which project the given document belongs to.
1643
+ * If the document does not belong to any project, returns the default project ID.
1644
+ */
1645
+ ownerProjectId(document: LangiumDocument | URI | string): ProjectId$1;
1646
+ /**
1647
+ * Returns path to the document relative to the project folder.
1648
+ * If the document does not belong to any project, returns the document URI as string.
1649
+ */
1650
+ relativePath(document: LangiumDocument | URI | string): string;
1651
+ /**
1652
+ * Returns true if the manager is currently initializing or reloading projects.
1653
+ * This is used to prevent duplicate reload operations.
1654
+ */
1655
+ protected get isInitiatingOrReloading(): boolean;
1656
+ reloadProjects(cancelToken?: Cancellation.CancellationToken): Promise<void>;
1657
+ protected _reloadProjects(cancelToken?: Cancellation.CancellationToken): Promise<void>;
1658
+ protected uniqueProjectId(name: string): ProjectId$1;
1659
+ protected resetCaches(): void;
1660
+ rebuildProject(projectId: ProjectId$1, cancelToken?: Cancellation.CancellationToken): Promise<void>;
1661
+ /**
1662
+ * Returns all include paths from all projects.
1663
+ * Used by WorkspaceManager to scan additional directories for C4 files.
1664
+ */
1665
+ getAllIncludePaths(): Array<{
1666
+ projectId: ProjectId$1;
1667
+ includePath: URI;
1668
+ includeConfig: IncludeConfig;
1669
+ }>;
1670
+ /**
1671
+ * Register a listener to be called when the projects configuration has changed.
1672
+ * @returns A disposable that can be used to unregister the callback.
1673
+ */
1674
+ onProjectsUpdate(callback: () => void): Disposable;
1675
+ private getWorkspaceFolder;
1676
+ private notifyListeners;
1677
+ private updateIncludesExcludes;
1678
+ private warnIfConfigOverride;
1679
+ }
1680
+ //#endregion
1681
+ //#region src/filesystem/types.d.ts
1682
+ interface FileNode extends FileSystemNode {
1683
+ readonly isFile: true;
1684
+ readonly isDirectory: false;
1774
1685
  }
1775
- type ParsedAstDeployment = Simplify<MergeExclusive<ParsedAstDeployment.Node, ParsedAstDeployment.Instance>>;
1776
- declare namespace ParsedAstDeployment {
1777
- type Node = c4.DeploymentNode;
1778
- type Instance = Omit<c4.DeployedInstance, 'element'> & {
1779
- readonly element: c4.FqnRef.ModelRef;
1780
- };
1686
+ interface FileSystemProvider$1 extends FileSystemProvider {
1687
+ /**
1688
+ * Scans the project files for the given URI.
1689
+ * @returns The list of file system entries that are contained within the specified directory.
1690
+ */
1691
+ scanProjectFiles(folderUri: URI): Promise<FileNode[]>;
1692
+ /**
1693
+ * Loads the project config from the given file.
1694
+ * @returns The project config.
1695
+ * @throws Error if the file does not exist or is not a valid project config.
1696
+ */
1697
+ loadProjectConfig(filepath: URI): Promise<LikeC4ProjectConfig>;
1698
+ /**
1699
+ * Reads the directory and returns LikeC4 files.
1700
+ *
1701
+ * @param options.recursive If true, recursively reads the directory,
1702
+ * @param options.maxDepth Maximum depth to traverse when recursive is true (default: Infinity)
1703
+ */
1704
+ readDirectory(uri: URI, options?: {
1705
+ recursive?: boolean;
1706
+ maxDepth?: number;
1707
+ }): Promise<FileNode[]>;
1708
+ /**
1709
+ * Finds all files in the given directory, matching the given filter.
1710
+ */
1711
+ scanDirectory(directory: URI, filter: (filepath: string, isDirectory: boolean) => boolean): Promise<FileNode[]>;
1712
+ /**
1713
+ * Writes the content to the file system.
1714
+ * Used by manual layouts.
1715
+ */
1716
+ writeFile(uri: URI, content: string): Promise<void>;
1717
+ /**
1718
+ * Deletes the file from the file system.
1719
+ * Used by manual layouts.
1720
+ * @return true if the file was deleted, false if the file did not exist.
1721
+ */
1722
+ deleteFile(uri: URI): Promise<boolean>;
1781
1723
  }
1782
- type ParsedAstDeploymentRelation = c4.DeploymentRelationship & {
1783
- astPath: string;
1784
- };
1785
- type ParsedAstGlobals = Writable<c4.ModelGlobals>;
1786
- interface ParsedAstElementView {
1787
- id: c4.ViewId;
1788
- viewOf?: c4.Fqn;
1789
- extends?: c4.ViewId;
1790
- astPath: string;
1791
- title: string | null;
1792
- description: c4.MarkdownOrString | null;
1793
- tags: c4.NonEmptyArray<c4.Tag> | null;
1794
- links: c4.NonEmptyArray<c4.Link> | null;
1795
- rules: c4.ElementViewRule[];
1724
+ interface FileSystemModuleContext extends FileSystemWatcherModuleContext {
1725
+ fileSystemProvider: () => FileSystemProvider$1;
1796
1726
  }
1797
- interface ParsedAstDynamicView {
1798
- id: c4.ViewId;
1799
- astPath: string;
1800
- title: string | null;
1801
- description: c4.MarkdownOrString | null;
1802
- tags: c4.NonEmptyArray<c4.Tag> | null;
1803
- links: c4.NonEmptyArray<c4.Link> | null;
1804
- steps: c4.DynamicViewStep[];
1805
- rules: Array<c4.DynamicViewRule>;
1806
- variant: c4.DynamicViewDisplayVariant | undefined;
1727
+ interface FileSystemWatcherModuleContext {
1728
+ fileSystemWatcher: (services: LikeC4SharedServices) => FileSystemWatcher;
1807
1729
  }
1808
- interface ParsedAstDeploymentView {
1809
- id: c4.ViewId;
1810
- astPath: string;
1811
- title: string | null;
1812
- description: c4.MarkdownOrString | null;
1813
- tags: c4.NonEmptyArray<c4.Tag> | null;
1814
- links: c4.NonEmptyArray<c4.Link> | null;
1815
- rules: Array<c4.DeploymentViewRule>;
1730
+ interface FileSystemWatcher extends AsyncDisposable {
1731
+ /**
1732
+ * Watches a folder for changes and triggers a reload of the documents and projects.
1733
+ */
1734
+ watch(folder: string): void;
1816
1735
  }
1817
- type ParsedAstView = ParsedAstElementView | ParsedAstDynamicView | ParsedAstDeploymentView;
1818
- interface AstNodeDescriptionWithFqn extends AstNodeDescription {
1819
- likec4ProjectId: c4.ProjectId;
1820
- id: c4.Fqn;
1736
+ interface LikeC4ManualLayoutsModuleContext {
1737
+ manualLayouts: (services: LikeC4SharedServices) => LikeC4ManualLayouts;
1821
1738
  }
1822
- type LikeC4AstNode = ValueOf<ConditionalPick<LikeC4AstType, AstNode>>;
1823
- type LikeC4DocumentDiagnostic = Diagnostic & DiagnosticInfo<LikeC4AstNode>;
1824
- interface LikeC4DocumentProps {
1825
- diagnostics?: Array<LikeC4DocumentDiagnostic>;
1826
- c4Specification?: ParsedAstSpecification;
1827
- c4Elements?: ParsedAstElement[];
1828
- c4ExtendElements?: ParsedAstExtend[];
1829
- c4ExtendDeployments?: ParsedAstExtend[];
1830
- c4ExtendRelations?: ParsedAstExtendRelation[];
1831
- c4Relations?: ParsedAstRelation[];
1832
- c4Globals?: ParsedAstGlobals;
1833
- c4Views?: ParsedAstView[];
1834
- c4Deployments?: ParsedAstDeployment[];
1835
- c4DeploymentRelations?: ParsedAstDeploymentRelation[];
1836
- c4Imports?: MultiMap<c4.ProjectId, c4.Fqn, Set<c4.Fqn>>;
1739
+ type ManualLayoutsSnapshot = {
1740
+ hash: string;
1741
+ views: Record<ViewId$1, LayoutedView$1>;
1742
+ };
1743
+ type ManualLayoutUpdateEvent = {
1744
+ updated: URI;
1745
+ projectId: ProjectId$1;
1746
+ viewId: ViewId$1;
1747
+ } | {
1748
+ removed: URI;
1749
+ projectId: ProjectId$1;
1750
+ /**
1751
+ * Missing if triggered by FS event (file was deleted)
1752
+ */
1753
+ viewId?: ViewId$1;
1754
+ };
1755
+ type ManualLayoutUpdateListener = (event: ManualLayoutUpdateEvent) => void;
1756
+ interface LikeC4ManualLayouts extends Disposable {
1757
+ /**
1758
+ * Reads a single layouted view from the file system by its URI.
1759
+ * Used by the language server to get the current layout state.
1760
+ */
1761
+ readSnapshot(uri: URI): Promise<LayoutedView$1 | null>;
1762
+ read(project: Project): Promise<ManualLayoutsSnapshot | null>;
1763
+ write(project: Project, layouted: LayoutedView$1): Promise<Location>;
1764
+ remove(project: Project, view: ViewId$1): Promise<Location | null>;
1765
+ clearCaches(): void;
1766
+ /**
1767
+ * Registers a listener for manual layout updates.
1768
+ * The listener will be called when a manual layout is created, updated, or deleted.
1769
+ */
1770
+ onManualLayoutUpdate(listener: ManualLayoutUpdateListener): Disposable;
1771
+ /**
1772
+ * Handles file system updates for manual layouts.
1773
+ * Used by the file system watcher to notify the manual layouts module of changes.
1774
+ * @param event The file system event
1775
+ */
1776
+ handleFileSystemUpdate(event: {
1777
+ update: URI;
1778
+ delete?: never;
1779
+ } | {
1780
+ delete: URI;
1781
+ update?: never;
1782
+ }): Promise<void>;
1837
1783
  }
1838
- type LikeC4GrammarDocument = Omit<LangiumDocument<LikeC4Grammar>, 'diagnostics'>;
1839
- interface LikeC4LangiumDocument extends LikeC4GrammarDocument, LikeC4DocumentProps {
1840
- likec4ProjectId: c4.ProjectId;
1784
+ //#endregion
1785
+ //#region src/filesystem/noop.d.ts
1786
+ declare const NoFileSystemWatcher: FileSystemWatcherModuleContext;
1787
+ declare const NoFileSystem: FileSystemModuleContext;
1788
+ declare const NoLikeC4ManualLayouts: LikeC4ManualLayoutsModuleContext;
1789
+ //#endregion
1790
+ //#region src/filesystem/LikeC4FileSystem.d.ts
1791
+ declare const WithFileSystem: (enableWatcher?: boolean) => FileSystemModuleContext;
1792
+ //#endregion
1793
+ //#region src/filesystem/ChokidarWatcher.d.ts
1794
+ declare const WithChokidarWatcher: FileSystemWatcherModuleContext;
1795
+ //#endregion
1796
+ //#region src/filesystem/LikeC4ManualLayouts.d.ts
1797
+ declare const WithLikeC4ManualLayouts: LikeC4ManualLayoutsModuleContext;
1798
+ //#endregion
1799
+ //#region src/formatting/LikeC4Formatter.d.ts
1800
+ type QuoteStyle = 'single' | 'double' | 'ignore' | 'auto';
1801
+ interface LikeC4FormatterOptions {
1802
+ quoteStyle: QuoteStyle;
1841
1803
  }
1842
- interface ParsedLikeC4LangiumDocument extends LikeC4GrammarDocument, Required<LikeC4DocumentProps> {
1843
- likec4ProjectId: c4.ProjectId;
1804
+ type ExtendedFormattingCommandType = 'normalizeQuotes';
1805
+ interface ExtendedFormattingCommand {
1806
+ type: ExtendedFormattingCommandType;
1807
+ region: FormattingRegion;
1808
+ }
1809
+ declare class LikeC4Formatter extends AbstractFormatter {
1810
+ protected options: LikeC4FormatterOptions;
1811
+ extendedFormattingCommands: ExtendedFormattingCommand[];
1812
+ constructor(services: LikeC4Services);
1813
+ protected doDocumentFormat(document: LangiumDocument, options: FormattingOptions, range?: Range): TextEdit[];
1814
+ protected format(node: AstNode): void;
1815
+ protected formatTags(node: AstNode): void;
1816
+ protected formatDeploymentRelation(node: AstNode): void;
1817
+ protected formatExtendDeployment(node: AstNode): void;
1818
+ protected formatRelation(node: AstNode): void;
1819
+ protected removeIndentFromTopLevelStatements(node: AstNode): void;
1820
+ protected indentContentInBraces(node: AstNode): void;
1821
+ protected appendKeywordsWithSpace(node: AstNode): void;
1822
+ protected formatView(node: AstNode): void;
1823
+ protected formatLeafProperty(node: AstNode): void;
1824
+ protected formatLinkProperty(node: AstNode): void;
1825
+ protected formatNavigateToProperty(node: AstNode): void;
1826
+ protected formatAutolayoutProperty(node: AstNode): void;
1827
+ protected formatMetadataProperty(node: AstNode): void;
1828
+ protected formatElementDeclaration(node: AstNode): void;
1829
+ protected formatExtendElement(node: AstNode): void;
1830
+ protected formatGlobals(node: AstNode): void;
1831
+ protected formatImports(node: AstNode): void;
1832
+ protected formatSpecificationRule(node: AstNode): void;
1833
+ protected formatWithPredicate(node: AstNode): void;
1834
+ protected formatDeploymentNodeDeclaration(node: AstNode): void;
1835
+ protected formatDeployedInstance(node: AstNode): void;
1836
+ protected formatViewRuleGlobalStyle(node: AstNode): void;
1837
+ protected formatViewRuleGlobalPredicate(node: AstNode): void;
1838
+ protected formatViewRuleGroup(node: AstNode): void;
1839
+ protected formatViewRuleStyle(node: AstNode): void;
1840
+ protected formatWhereExpression(node: AstNode): void;
1841
+ protected formatWhereRelationExpression(node: AstNode): void;
1842
+ protected formatWhereElementExpression(node: AstNode): void;
1843
+ protected formatIncludeExcludeExpressions(node: AstNode): void;
1844
+ protected formatRelationExpression(node: AstNode): void;
1845
+ private findPredicateExpressionRoot;
1846
+ private on;
1847
+ private doExtendedFormatting;
1848
+ protected normalizeQuotes(node: AstNode): void;
1849
+ private quotesNormalizerFactory;
1850
+ private escapeQuotesInternalQuotes;
1851
+ private getAutoQuoteStyle;
1852
+ private onConfigurationUpdate;
1844
1853
  }
1845
1854
  //#endregion
1846
1855
  //#region src/references/name-provider.d.ts
@@ -1997,15 +2006,6 @@ declare class LikeC4ScopeProvider extends DefaultScopeProvider {
1997
2006
  protected getGlobalScope(referenceType: string, context: ReferenceInfo): Scope;
1998
2007
  }
1999
2008
  //#endregion
2000
- //#region src/utils/disposable.d.ts
2001
- declare abstract class ADisposable implements Disposable {
2002
- protected toDispose: Disposable[];
2003
- protected isDisposed: boolean;
2004
- onDispose(...disposable: Disposable[]): void;
2005
- dispose(): void;
2006
- protected throwIfDisposed(): void;
2007
- }
2008
- //#endregion
2009
2009
  //#region src/model/fqn-index.d.ts
2010
2010
  declare class FqnIndex<AstNd = Element> extends ADisposable {
2011
2011
  protected services: LikeC4Services;
@@ -2142,7 +2142,7 @@ declare class MergedSpecification {
2142
2142
  * Provides access to "last seen artifacts" for a given project,
2143
2143
  * (Results of the last successful parsing)
2144
2144
  */
2145
- declare class LastSeenArtifacts {
2145
+ declare class LastSeenArtifacts extends ADisposable {
2146
2146
  #private;
2147
2147
  constructor(services: LikeC4Services);
2148
2148
  /**
@@ -2280,7 +2280,7 @@ type LayoutViewParams = {
2280
2280
  cancelToken?: CancellationToken | undefined; /** Optional AI-generated layout hints */
2281
2281
  layoutHints?: AILayoutHints | undefined;
2282
2282
  };
2283
- interface LikeC4Views {
2283
+ interface LikeC4Views extends Disposable {
2284
2284
  readonly layouter: GraphvizLayouter;
2285
2285
  /**
2286
2286
  * Returns computed views (i.e. views with predicates computed)
@@ -3147,7 +3147,7 @@ declare const DocumentParserFromMixins: {
3147
3147
  };
3148
3148
  } & typeof BaseParser;
3149
3149
  declare class DocumentParser extends DocumentParserFromMixins {}
3150
- declare class LikeC4ModelParser {
3150
+ declare class LikeC4ModelParser extends ADisposable {
3151
3151
  private services;
3152
3152
  protected cachedParsers: any;
3153
3153
  constructor(services: LikeC4Services);