likec4 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.
Files changed (168) hide show
  1. package/__app__/codegen/react.mjs +7 -8
  2. package/__app__/codegen/webcomponent.mjs +70 -881
  3. package/__app__/src/aichat/index.mjs +8 -1
  4. package/__app__/src/chunks/AIChat.mjs +959 -0
  5. package/__app__/src/chunks/DiagramActorProvider.mjs +7638 -0
  6. package/__app__/src/chunks/LikeC4Styles.mjs +1866 -0
  7. package/__app__/src/chunks/Markdown.mjs +146 -0
  8. package/__app__/src/chunks/NavigationPanel.mjs +61 -0
  9. package/__app__/src/chunks/ProjectsOverview.mjs +540 -0
  10. package/__app__/src/chunks/adhoc-editor.mjs +3386 -0
  11. package/__app__/src/chunks/es.mjs +439 -0
  12. package/__app__/src/chunks/hooks.mjs +145 -0
  13. package/__app__/src/chunks/libs/@dagrejs/dagre.mjs +1894 -0
  14. package/__app__/src/chunks/libs/@floating-ui.mjs +2218 -0
  15. package/__app__/src/chunks/libs/@mantine.mjs +12070 -0
  16. package/__app__/src/chunks/libs/@tabler/icons-react.mjs +252 -0
  17. package/__app__/src/chunks/libs/@tanstack-ai.mjs +1768 -0
  18. package/__app__/src/chunks/libs/@tanstack.mjs +2718 -0
  19. package/__app__/src/chunks/libs/@xstate/react.mjs +1982 -0
  20. package/__app__/src/chunks/libs/@xyflow/react.mjs +5256 -0
  21. package/__app__/src/chunks/libs/bezier-js.mjs +1003 -0
  22. package/__app__/src/chunks/libs/d3.mjs +2842 -0
  23. package/__app__/src/chunks/libs/fast-equals.mjs +268 -0
  24. package/__app__/src/chunks/libs/framer.mjs +5872 -0
  25. package/__app__/src/chunks/libs/remeda.mjs +642 -0
  26. package/__app__/src/chunks/libs/zod.mjs +3170 -0
  27. package/__app__/src/chunks/rolldown-runtime.mjs +23 -0
  28. package/__app__/src/chunks/styled-system.mjs +1040 -0
  29. package/__app__/src/fonts.css +1 -1
  30. package/__app__/src/main.mjs +14816 -14
  31. package/__app__/src/style.css +1 -1
  32. package/dist/chunks/enableServer.mjs +1 -1
  33. package/dist/chunks/filenames.mjs +2 -2
  34. package/dist/chunks/index2.d.mts +1877 -734
  35. package/dist/chunks/libs/@chevrotain/gast.mjs +1 -1
  36. package/dist/chunks/libs/@logtape/logtape.mjs +4 -3
  37. package/dist/chunks/libs/chevrotain-allstar.mjs +2 -2
  38. package/dist/chunks/libs/chevrotain.mjs +25 -25
  39. package/dist/chunks/libs/langium.mjs +1 -1
  40. package/dist/chunks/libs/merge-error-cause.mjs +1 -1
  41. package/dist/chunks/libs/pretty-ms.mjs +1 -1
  42. package/dist/chunks/libs/remeda.mjs +1 -1
  43. package/dist/chunks/libs/ufo.mjs +1 -1
  44. package/dist/chunks/libs/unstorage.mjs +1 -1
  45. package/dist/chunks/libs/which.mjs +1 -1
  46. package/dist/chunks/libs/zod.mjs +65 -0
  47. package/dist/chunks/node.mjs +73 -62
  48. package/dist/chunks/{plugin.mjs → vite-plugin.mjs} +41 -41
  49. package/dist/cli/index.mjs +184 -144
  50. package/dist/index.d.mts +1 -1
  51. package/dist/index.mjs +1 -1
  52. package/dist/model/index.d.mts +1 -1
  53. package/dist/vite-plugin/index.mjs +1 -1
  54. package/dist/vite-plugin/internal/index.d.mts +52 -57
  55. package/dist/vite-plugin/internal/index.mjs +946 -1
  56. package/package.json +46 -47
  57. package/react/index.d.mts +92 -23
  58. package/react/index.mjs +44551 -42605
  59. package/__app__/chunks/AIChat2.mjs +0 -2
  60. package/__app__/chunks/DiagramActorProvider.mjs +0 -10
  61. package/__app__/chunks/EmbedPage.mjs +0 -1
  62. package/__app__/chunks/ExportPage.mjs +0 -2
  63. package/__app__/chunks/LikeC4Diagram.mjs +0 -19
  64. package/__app__/chunks/LikeC4Styles.mjs +0 -48
  65. package/__app__/chunks/Markdown.mjs +0 -1
  66. package/__app__/chunks/NavigationPanel.mjs +0 -1
  67. package/__app__/chunks/ViewReact.mjs +0 -1
  68. package/__app__/chunks/adhoc-editor.mjs +0 -1
  69. package/__app__/chunks/aichat.mjs +0 -1
  70. package/__app__/chunks/box.mjs +0 -1
  71. package/__app__/chunks/create-style-context.mjs +0 -1
  72. package/__app__/chunks/css.mjs +0 -1
  73. package/__app__/chunks/factory.mjs +0 -1
  74. package/__app__/chunks/hooks.mjs +0 -1
  75. package/__app__/chunks/hstack.mjs +0 -1
  76. package/__app__/chunks/libs/@dagrejs/dagre.mjs +0 -1
  77. package/__app__/chunks/libs/@floating-ui/core.mjs +0 -1
  78. package/__app__/chunks/libs/@floating-ui/dom.mjs +0 -1
  79. package/__app__/chunks/libs/@floating-ui/react.mjs +0 -1
  80. package/__app__/chunks/libs/@mantine/core.mjs +0 -41
  81. package/__app__/chunks/libs/@mantine/hooks.mjs +0 -1
  82. package/__app__/chunks/libs/@nanostores/react.mjs +0 -1
  83. package/__app__/chunks/libs/@react-hookz/web.mjs +0 -1
  84. package/__app__/chunks/libs/@tabler/icons-react.mjs +0 -358
  85. package/__app__/chunks/libs/@tanstack/ai-client.mjs +0 -2
  86. package/__app__/chunks/libs/@tanstack/ai-react-ui.mjs +0 -1
  87. package/__app__/chunks/libs/@tanstack/ai-react.mjs +0 -1
  88. package/__app__/chunks/libs/@tanstack/ai.mjs +0 -2
  89. package/__app__/chunks/libs/@tanstack/history.mjs +0 -1
  90. package/__app__/chunks/libs/@tanstack/react-router.mjs +0 -3
  91. package/__app__/chunks/libs/@tanstack/router-core.mjs +0 -1
  92. package/__app__/chunks/libs/@xstate/react.mjs +0 -1
  93. package/__app__/chunks/libs/@xstate/store.mjs +0 -1
  94. package/__app__/chunks/libs/@xyflow/react.mjs +0 -7
  95. package/__app__/chunks/libs/@zag-js/anatomy.mjs +0 -1
  96. package/__app__/chunks/libs/@zag-js/collection.mjs +0 -1
  97. package/__app__/chunks/libs/@zag-js/core.mjs +0 -1
  98. package/__app__/chunks/libs/@zag-js/react.mjs +0 -1
  99. package/__app__/chunks/libs/@zag-js/tree-view.mjs +0 -1
  100. package/__app__/chunks/libs/bezier-js.mjs +0 -1
  101. package/__app__/chunks/libs/copy-anything.mjs +0 -1
  102. package/__app__/chunks/libs/d3-path.mjs +0 -1
  103. package/__app__/chunks/libs/d3-shape.mjs +0 -1
  104. package/__app__/chunks/libs/fast-equals.mjs +0 -1
  105. package/__app__/chunks/libs/framer-motion.mjs +0 -9
  106. package/__app__/chunks/libs/html-to-image.mjs +0 -2
  107. package/__app__/chunks/libs/motion-dom.mjs +0 -1
  108. package/__app__/chunks/libs/nanostores.mjs +0 -1
  109. package/__app__/chunks/libs/react-error-boundary.mjs +0 -1
  110. package/__app__/chunks/libs/react-resizable-panels.mjs +0 -1
  111. package/__app__/chunks/libs/remeda.mjs +0 -1
  112. package/__app__/chunks/libs/superjson.mjs +0 -1
  113. package/__app__/chunks/libs/zod.mjs +0 -64
  114. package/__app__/chunks/rolldown-runtime.mjs +0 -1
  115. package/__app__/chunks/styles.css.mjs +0 -1
  116. package/__app__/chunks/txt.mjs +0 -1
  117. package/__app__/chunks/useLikeC4Project.mjs +0 -1
  118. package/__app__/src/pages/AdHocViewEditor.mjs +0 -1
  119. package/__app__/src/pages/EmbedPage.mjs +0 -1
  120. package/__app__/src/pages/ExportPage.mjs +0 -1
  121. package/__app__/src/pages/ProjectsOverview.mjs +0 -1
  122. package/__app__/src/pages/ViewAsD2.mjs +0 -1
  123. package/__app__/src/pages/ViewAsDot.mjs +0 -1
  124. package/__app__/src/pages/ViewAsMmd.mjs +0 -1
  125. package/__app__/src/pages/ViewAsPuml.mjs +0 -1
  126. package/__app__/src/pages/ViewEditor.mjs +0 -1
  127. package/__app__/src/pages/ViewReact.mjs +0 -1
  128. package/dist/chunks/libs/@chevrotain/utils.mjs +0 -1
  129. package/dist/chunks/libs/@hono/mcp.mjs +0 -70
  130. package/dist/chunks/libs/@hono/node-server.mjs +0 -1
  131. package/dist/chunks/libs/@logtape/logtape.d.mts +0 -1023
  132. package/dist/chunks/libs/@modelcontextprotocol/sdk.mjs +0 -12
  133. package/dist/chunks/libs/ajv.mjs +0 -1
  134. package/dist/chunks/libs/ansi-align.mjs +0 -2
  135. package/dist/chunks/libs/ansi-regex.mjs +0 -1
  136. package/dist/chunks/libs/ansi-styles.mjs +0 -1
  137. package/dist/chunks/libs/atomically.mjs +0 -1
  138. package/dist/chunks/libs/boxen.mjs +0 -22
  139. package/dist/chunks/libs/conf.mjs +0 -1
  140. package/dist/chunks/libs/defu.mjs +0 -1
  141. package/dist/chunks/libs/destr.mjs +0 -1
  142. package/dist/chunks/libs/find-up-simple.mjs +0 -1
  143. package/dist/chunks/libs/get-port.mjs +0 -1
  144. package/dist/chunks/libs/hono.mjs +0 -1
  145. package/dist/chunks/libs/is-docker.mjs +0 -1
  146. package/dist/chunks/libs/is-error-instance.mjs +0 -1
  147. package/dist/chunks/libs/is-inside-container.mjs +0 -1
  148. package/dist/chunks/libs/is-plain-obj.mjs +0 -1
  149. package/dist/chunks/libs/isexe.mjs +0 -1
  150. package/dist/chunks/libs/ky.mjs +0 -3
  151. package/dist/chunks/libs/p-debounce.mjs +0 -1
  152. package/dist/chunks/libs/p-limit.mjs +0 -1
  153. package/dist/chunks/libs/p-timeout.mjs +0 -1
  154. package/dist/chunks/libs/package-up.mjs +0 -1
  155. package/dist/chunks/libs/parse-ms.mjs +0 -1
  156. package/dist/chunks/libs/safe-stringify.mjs +0 -1
  157. package/dist/chunks/libs/strip-indent.mjs +0 -1
  158. package/dist/chunks/libs/tinyrainbow.mjs +0 -1
  159. package/dist/chunks/libs/ts-graphviz.mjs +0 -1
  160. package/dist/chunks/libs/unctx.mjs +0 -1
  161. package/dist/chunks/libs/vscode-languageserver.mjs +0 -1
  162. package/dist/chunks/libs/word-wrap.mjs +0 -12
  163. package/dist/vite-plugin/internal/chunks/libs/@nanostores/react.mjs +0 -1
  164. package/dist/vite-plugin/internal/chunks/libs/birpc.mjs +0 -1
  165. package/dist/vite-plugin/internal/chunks/libs/fast-equals.mjs +0 -1
  166. package/dist/vite-plugin/internal/chunks/libs/nanostores.mjs +0 -1
  167. package/dist/vite-plugin/internal/chunks/libs/remeda.mjs +0 -1
  168. package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +0 -1
@@ -1,6 +1,5 @@
1
1
  import { i as __name } from "./rolldown-runtime.mjs";
2
2
  import { a as LikeC4ProjectConfig, i as IncludeConfig, o as LikeC4ProjectConfigInput } from "./index.mjs";
3
- import { t as Logger } from "./libs/@logtape/logtape.mjs";
4
3
  import { $ as FileSystemProvider, A as DefaultValueConverter, B as AsyncDisposable, C as CodeLensParams, D as ValidationOptions, E as DefaultDocumentValidator, F as JSDocDocumentationProvider, G as Reference, H as AstNode, I as DefaultIndexManager, J as LangiumDocument, K as ReferenceInfo, L as ReferenceDescription, M as MaybePromise, N as DefaultScopeProvider, O as DiagnosticInfo, P as Scope, Q as FileSystemNode, R as DefaultNameProvider, S as CodeActionParams, T as DocumentSymbolParams, U as AstNodeDescription, V as Disposable$1, W as CstNode, X as PrecomputedScopes, Y as LangiumDocumentFactory, Z as Stream, _ as CodeLensProvider, _t as SymbolKind, a as LangiumServices, at as CodeAction, b as FileSelector, c as AbstractSemanticTokenProvider, ct as CompletionItemKind, d as AbstractFormatter, dt as DocumentLink, et as Keyword, f as FormattingRegion, ft as DocumentSymbol, g as DefaultDocumentHighlightProvider, gt as Range, h as DocumentLinkProvider, ht as Location, i as NextFeature, it as RequestType, j as ValueType, k as DefaultScopeComputation, l as SemanticTokenAcceptor, lt as Diagnostic, m as NodeKindProvider, mt as Hover, n as CompletionContext, nt as CancellationToken$1, o as LangiumSharedServices, ot as CodeLens, p as DocumentSymbolProvider, pt as FormattingOptions, q as DefaultLangiumDocuments, r as DefaultCompletionProvider, rt as NotificationType, s as DefaultWorkspaceSymbolProvider, st as Command, t as CompletionAcceptor, tt as URI, u as AstNodeHoverProvider, ut as DocumentHighlight, v as CodeActionProvider, vt as TextEdit, w as DocumentLinkParams, x as BuildOptions, y as DefaultWorkspaceManager, yt as WorkspaceFolder, z as WorkspaceCache } from "./libs/langium.mjs";
5
4
  import { t as $keywords } from "./libs/@ts-graphviz/common.mjs";
6
5
  import { LikeC4Styles } from "@likec4/core/styles";
@@ -13,739 +12,1582 @@ import { AdhocViewPredicate, ComputedProjectsView, LayoutedProjectsView } from "
13
12
  import * as type_fest0 from "type-fest";
14
13
  import { ConditionalPick, MergeExclusive, Simplify, Tagged, ValueOf, Writable } from "type-fest";
15
14
 
16
- //#region ../layouts/dist/_chunks/types.d.mts
15
+ //#region ../../node_modules/.pnpm/@logtape+logtape@2.1.1/node_modules/@logtape/logtape/dist/level.d.ts
16
+ //#region src/level.d.ts
17
+ declare const logLevels: readonly ["trace", "debug", "info", "warning", "error", "fatal"];
17
18
  /**
18
- * invisible edge added by AI to enforce better layout
19
+ * The severity level of a {@link LogRecord}.
19
20
  */
20
- interface AIEnforcementEdge {
21
- source: NodeId;
22
- target: NodeId;
23
- weight?: number;
24
- minlen?: number;
25
- }
21
+ type LogLevel = typeof logLevels[number];
26
22
  /**
27
- * Complete set of AI-generated layout hints.
28
- * This is the JSON schema the LLM must produce.
23
+ * Lists all available log levels with the order of their severity.
24
+ * The `"trace"` level goes first, and the `"fatal"` level goes last.
25
+ * @returns A new copy of the array of log levels.
26
+ * @since 1.0.0
29
27
  */
30
- interface AILayoutHints {
31
- direction?: 'TB' | 'BT' | 'LR' | 'RL';
32
- ranks: ReadonlyArray<{
33
- rank: 'same' | 'source' | 'sink' | 'min' | 'max';
34
- nodes: NonEmptyArray<NodeId>;
35
- }>;
36
- edgeWeight: Record<EdgeId, number>;
37
- edgeMinlen: Record<EdgeId, number>;
28
+ //#endregion
29
+ //#region ../../node_modules/.pnpm/@logtape+logtape@2.1.1/node_modules/@logtape/logtape/dist/record.d.ts
30
+ //#region src/record.d.ts
31
+ /**
32
+ * A log record.
33
+ */
34
+ interface LogRecord {
38
35
  /**
39
- * These edges should be reversed in DOT
40
- * Unique array of EdgeIds.
36
+ * The category of the logger that produced the log record.
41
37
  */
42
- reverseRank?: NonEmptyReadonlyArray<EdgeId>;
38
+ readonly category: readonly string[];
43
39
  /**
44
- * These edges should be excluded, i.e. `constraint=false` in Graphviz, to allow more flexible layouts.
45
- * Unique array of EdgeIds.
40
+ * The log level.
46
41
  */
47
- excludeFromRanking?: NonEmptyReadonlyArray<EdgeId>;
42
+ readonly level: LogLevel;
48
43
  /**
49
- * Suggested order of edges for DOT output, to influence edge routing.
44
+ * The log message. This is the result of substituting the message template
45
+ * with the values. The number of elements in this array is always odd,
46
+ * with the message template values interleaved between the substitution
47
+ * values.
50
48
  */
51
- edgeOrder?: NonEmptyReadonlyArray<EdgeId>;
49
+ readonly message: readonly unknown[];
52
50
  /**
53
- * Suggested order of nodes for DOT output, to influence node placement.
51
+ * The raw log message. This is the original message template without any
52
+ * further processing. It can be either:
53
+ *
54
+ * - A string without any substitutions if the log record was created with
55
+ * a method call syntax, e.g., "Hello, {name}!" for
56
+ * `logger.info("Hello, {name}!", { name })`.
57
+ * - A template string array if the log record was created with a tagged
58
+ * template literal syntax, e.g., `["Hello, ", "!"]` for
59
+ * ``logger.info`Hello, ${name}!```.
60
+ *
61
+ * @since 0.6.0
54
62
  */
55
- nodeOrder?: NonEmptyReadonlyArray<NodeId>;
63
+ readonly rawMessage: string | TemplateStringsArray;
56
64
  /**
57
- * Invisible edges added by AI to enforce better layout
65
+ * The timestamp of the log record in milliseconds since the Unix epoch.
58
66
  */
59
- invisibleEdges?: NonEmptyReadonlyArray<AIEnforcementEdge>;
67
+ readonly timestamp: number;
60
68
  /**
61
- * LLM reasoning for debugging/display
69
+ * The extra properties of the log record.
62
70
  */
63
- reasoning: string;
64
- } //#endregion
71
+ readonly properties: Record<string, unknown>;
72
+ } //# sourceMappingURL=record.d.ts.map
65
73
  //#endregion
66
- //#region ../language-server/dist/_chunks/protocol.d.mts
67
- /**
68
- * When server requests to open a likec4 preview panel
69
- * (available only in the editor).
70
- * (not the best place, but seems to be working)
71
- */
72
- declare namespace DidRequestOpenViewNotification {
73
- type Params = {
74
- viewId: ViewId$1;
75
- projectId: ProjectId$1;
76
- };
77
- const type: NotificationType<Params>;
78
- type Type = typeof type;
79
- }
80
- /**
81
- * Request to fetch the computed model data
82
- * If LSP has multiple projects, the projectId is required.
83
- * otherwise throws an error.
84
- */
74
+ //#endregion
75
+ //#region ../../node_modules/.pnpm/@logtape+logtape@2.1.1/node_modules/@logtape/logtape/dist/logger.d.ts
85
76
  /**
86
- * Request to locate an element, relation, deployment or view.
87
- * If LSP has multiple projects, the projectId is required.
77
+ * A logger interface. It provides methods to log messages at different
78
+ * severity levels.
79
+ *
80
+ * ```typescript
81
+ * const logger = getLogger("category");
82
+ * logger.trace `A trace message with ${value}`
83
+ * logger.debug `A debug message with ${value}.`;
84
+ * logger.info `An info message with ${value}.`;
85
+ * logger.warn `A warning message with ${value}.`;
86
+ * logger.error `An error message with ${value}.`;
87
+ * logger.fatal `A fatal error message with ${value}.`;
88
+ * ```
89
+ *
90
+ * Callback-based string-message overloads should be treated as
91
+ * fire-and-forget. Async callbacks return `Promise<void>`, and when a
92
+ * callback is filtered out because the level is disabled an implementation may
93
+ * still return an already-resolved promise so the async path remains awaitable
94
+ * without invoking the callback. Call sites should not branch on these
95
+ * return values.
88
96
  */
89
- declare namespace Locate {
90
- type Params =
97
+ interface Logger {
91
98
  /**
92
- * Locate an element by its fqn
99
+ * The category of the logger. It is an array of strings.
93
100
  */
94
- {
95
- element: Fqn$1;
96
- projectId?: string | undefined;
97
- property?: string;
98
- }
101
+ readonly category: readonly string[];
99
102
  /**
100
- * Locate a relation by its id
103
+ * The logger with the supercategory of the current logger. If the current
104
+ * logger is the root logger, this is `null`.
101
105
  */
102
- | {
103
- projectId?: string | undefined;
104
- relation: RelationId;
105
- }
106
+ readonly parent: Logger | null;
106
107
  /**
107
- * Locate a deployment by its fqn
108
+ * Get a child logger with the given subcategory.
109
+ *
110
+ * ```typescript
111
+ * const logger = getLogger("category");
112
+ * const subLogger = logger.getChild("sub-category");
113
+ * ```
114
+ *
115
+ * The above code is equivalent to:
116
+ *
117
+ * ```typescript
118
+ * const logger = getLogger("category");
119
+ * const subLogger = getLogger(["category", "sub-category"]);
120
+ * ```
121
+ *
122
+ * @param subcategory The subcategory.
123
+ * @returns The child logger.
108
124
  */
109
- | {
110
- deployment: DeploymentFqn;
111
- projectId?: string | undefined;
112
- property?: string;
113
- }
125
+ getChild(subcategory: string | readonly [string] | readonly [string, ...string[]]): Logger;
114
126
  /**
115
- * Locate a step in a dynamic view by its astPath
127
+ * Get a logger with contextual properties. This is useful for
128
+ * log multiple messages with the shared set of properties.
129
+ *
130
+ * ```typescript
131
+ * const logger = getLogger("category");
132
+ * const ctx = logger.with({ foo: 123, bar: "abc" });
133
+ * ctx.info("A message with {foo} and {bar}.");
134
+ * ctx.warn("Another message with {foo}, {bar}, and {baz}.", { baz: true });
135
+ * ```
136
+ *
137
+ * The above code is equivalent to:
138
+ *
139
+ * ```typescript
140
+ * const logger = getLogger("category");
141
+ * logger.info("A message with {foo} and {bar}.", { foo: 123, bar: "abc" });
142
+ * logger.warn(
143
+ * "Another message with {foo}, {bar}, and {baz}.",
144
+ * { foo: 123, bar: "abc", baz: true },
145
+ * );
146
+ * ```
147
+ *
148
+ * @param properties
149
+ * @returns
150
+ * @since 0.5.0
116
151
  */
117
- | {
118
- view: ViewId$1;
119
- astPath: string;
120
- projectId?: string | undefined;
121
- }
152
+ with(properties: Record<string, unknown>): Logger;
122
153
  /**
123
- * Locate a view by its id
154
+ * Log a trace message. Use this as a template string prefix.
155
+ *
156
+ * ```typescript
157
+ * logger.trace `A trace message with ${value}.`;
158
+ * ```
159
+ *
160
+ * @param message The message template strings array.
161
+ * @param values The message template values.
162
+ * @since 0.12.0
124
163
  */
125
- | {
126
- view: ViewId$1;
127
- projectId?: string | undefined;
128
- };
129
- type Res = Location | null;
130
- const req: RequestType<Params, Res, void>;
131
- type Req = typeof req;
132
- }
133
- /**
134
- * Request to change the view
135
- * If LSP has multiple projects, the projectId is required.
136
- */
137
- declare namespace ChangeView {
138
- type Params = {
139
- viewId: ViewId$1;
140
- change: ViewChange;
141
- projectId?: string | undefined;
142
- };
143
- type Res = {
144
- success: true;
145
- location: Location | null;
146
- } | {
147
- success: false;
148
- location?: Location | null;
149
- error: string;
150
- };
151
- const req: RequestType<Params, Res, void>;
152
- type Req = typeof req;
153
- }
154
- /**
155
- * Request to fetch telemetry metrics
156
- */
157
- //#endregion
158
- //#region ../layouts/dist/_chunks/GraphvizLayoter.d.mts
159
- //#region src/graphviz/types.d.ts
160
- /**
161
- * Partially implements CancellationToken interface from vscode-jsonrpc
162
- */
163
- type CancellationToken = {
164
+ trace(message: TemplateStringsArray, ...values: readonly unknown[]): void;
164
165
  /**
165
- * Is `true` when the token has been cancelled, `false` otherwise.
166
+ * Log a trace message with properties.
167
+ *
168
+ * ```typescript
169
+ * logger.trace('A trace message with {value}.', { value });
170
+ * ```
171
+ *
172
+ * If the properties are expensive to compute, you can pass a callback that
173
+ * returns the properties:
174
+ *
175
+ * ```typescript
176
+ * logger.trace(
177
+ * 'A trace message with {value}.',
178
+ * () => ({ value: expensiveComputation() })
179
+ * );
180
+ * ```
181
+ *
182
+ * @param message The message template. Placeholders to be replaced with
183
+ * `values` are indicated by keys in curly braces (e.g.,
184
+ * `{value}`).
185
+ * @param properties The values to replace placeholders with. For lazy
186
+ * evaluation, this can be a callback that returns the
187
+ * properties.
188
+ * @since 0.12.0
166
189
  */
167
- readonly isCancellationRequested: boolean;
168
- };
169
- declare module 'ts-graphviz' {
170
- namespace GraphAttributeKey {
171
- interface $values extends $keywords<'likec4_viewId'> {}
172
- }
173
- namespace ClusterSubgraphAttributeKey {
174
- interface $values extends $keywords<'likec4_type' | 'likec4_path' | 'likec4_id' | 'likec4_level' | 'likec4_depth'> {}
175
- }
176
- namespace NodeAttributeKey {
177
- interface $values extends $keywords<'likec4_type' | 'likec4_path' | 'likec4_id' | 'likec4_project' | 'likec4_level'> {}
178
- }
179
- namespace EdgeAttributeKey {
180
- interface $values extends $keywords<'likec4_id' | 'likec4_project'> {}
181
- }
182
- namespace Attribute {
183
- interface $keys extends $keywords<'likec4_viewId' | 'likec4_type' | 'likec4_path' | 'likec4_id' | 'likec4_project' | 'likec4_level' | 'likec4_depth'> {}
184
- interface $types {
185
- likec4_viewId: string;
186
- likec4_type: 'folder' | 'file' | 'view';
187
- likec4_path: string;
188
- likec4_id: string;
189
- likec4_project: string;
190
- likec4_level: number;
191
- likec4_depth: number;
192
- }
193
- }
194
- }
195
- type DotSource = Tagged<string, 'DotSource'>; //#endregion
196
- //#region src/graphviz/types-dot.d.ts
197
- type GvNodeName = Tagged<string, 'GvNodeName'>;
198
- type GvId = Tagged<number, 'GvId'>;
199
- type Point = [x: number, y: number];
200
- interface GraphvizJson {
201
- name: GvNodeName;
202
- directed: boolean;
203
- strict: boolean;
204
- _draw_: GraphvizJson.Draw[];
205
- bb: string;
206
- compound: string;
207
- fontname: string;
208
- fontsize: string;
209
- label: string;
210
- nodesep: string;
211
- outputorder: string;
212
- rankdir: string;
213
- ranksep: string;
214
- splines: string;
215
- xdotversion: string;
216
- _subgraph_cnt: number;
217
- objects?: GraphvizJson.GvObject[];
218
- edges?: GraphvizJson.Edge[];
219
- }
220
- declare namespace GraphvizJson {
221
- interface Draw {
222
- op: string;
223
- grad: string;
224
- color: string;
225
- points: Point[];
226
- }
227
- interface Draw2 {
228
- op: string;
229
- grad: string;
230
- color: string;
231
- points: Point[];
232
- }
233
- namespace DrawOps {
234
- type Style = {
235
- op: 'S';
236
- style: string;
237
- };
238
- type BSpline = {
239
- op: 'b' | 'B';
240
- points: Point[];
241
- };
242
- type Color = {
243
- op: 'c';
244
- grad: string;
245
- color: string;
246
- };
247
- type Polygon = {
248
- op: 'p' | 'P';
249
- points: Point[];
250
- };
251
- }
252
- type DrawOp = DrawOps.Style | DrawOps.BSpline | DrawOps.Color | DrawOps.Polygon;
253
- type LabelDrawOps = {
254
- op: 'F';
255
- size: number;
256
- face: string;
257
- } | {
258
- op: 'c';
259
- color: string;
260
- } | {
261
- op: 't';
262
- fontchar: number;
263
- } | {
264
- op: 'T';
265
- pt: Point;
266
- align: 'l' | 'r' | 'c';
267
- width: number;
268
- text: string;
269
- };
270
- type GvObject = GvNodeObject | GvSubgraph;
271
- interface GvSubgraph {
272
- bb: string;
273
- label?: string;
274
- compound: 'true';
275
- _ldraw_?: LabelDrawOps[];
276
- likec4_type?: 'folder' | 'file';
277
- likec4_path?: string;
278
- likec4_id?: Fqn$1;
279
- likec4_level?: number;
280
- likec4_depth?: number;
281
- _gvid: GvId;
282
- subgraphs?: GvId[];
283
- nodes?: GvId[];
284
- edges?: GvId[];
285
- }
286
- interface GvNodeObject {
287
- _draw_: Draw[];
288
- _ldraw_?: LabelDrawOps[];
289
- likec4_type?: 'folder' | 'file' | 'view';
290
- likec4_path?: string;
291
- likec4_id?: Fqn$1;
292
- likec4_level?: number;
293
- _gvid: GvId;
294
- height: string;
295
- pos: string;
296
- shape: 'rect';
297
- width: string;
298
- label?: string;
299
- }
300
- interface Draw3 {
301
- op: string;
302
- grad: string;
303
- color: string;
304
- points: Point[];
305
- }
306
- interface Hdraw {
307
- op: string;
308
- style: string;
309
- grad: string;
310
- color: string;
311
- points: Point[];
312
- }
313
- interface Edge {
314
- _gvid: GvId;
315
- tail: GvId;
316
- head: GvId;
317
- dir?: 'forward' | 'back' | 'both' | 'none';
318
- _draw_: DrawOp[];
319
- _hdraw_?: DrawOp[];
320
- _tdraw_?: DrawOp[];
321
- _ldraw_?: LabelDrawOps[];
322
- _tldraw_?: LabelDrawOps[];
323
- _hldraw_?: LabelDrawOps[];
324
- fontname: string;
325
- fontsize: string;
326
- likec4_id?: EdgeId$1;
327
- label: string;
328
- lp: string;
329
- nojustify?: 'true' | 'false';
330
- pos?: string;
331
- }
332
- } //#endregion
333
- //#region src/graphviz/GraphvizLayoter.d.ts
334
- interface GraphvizPort extends Disposable {
335
- get name(): string;
336
- get concurrency(): number;
337
- unflatten(dot: DotSource): Promise<DotSource>;
338
- acyclic(dot: DotSource): Promise<DotSource>;
339
- layoutJson(dot: DotSource): Promise<string>;
340
- svg(dot: DotSource): Promise<string>;
341
- dispose(): void;
342
- }
343
- type LayoutTaskParams<A extends aux$1.Any = aux$1.Any> = {
344
- view: ComputedView<A>;
345
- styles: LikeC4Styles$1;
346
- };
347
- type LayoutResult<A extends aux$1.Any = aux$1.Any> = {
348
- dot: DotSource;
349
- diagram: DiagramView<A>;
350
- };
351
- declare class GraphvizLayouter implements Disposable {
352
- private graphviz;
353
- constructor(graphviz?: GraphvizPort);
354
- dispose(): void;
355
- [Symbol.dispose](): void;
356
- get graphvizPort(): GraphvizPort;
357
- changePort(graphviz: GraphvizPort): void;
190
+ trace(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
358
191
  /**
359
- * Generates DOT source for the given view and styles.
360
- * If `hints` are provided, they will be used to influence the layout (e.g. by specifying node/edge order).
361
- * This method does not perform unflattening or any other post-processing on the DOT output, so it may be used for debugging or to generate DOT for external processing.
192
+ * Log a trace message with properties computed asynchronously.
193
+ *
194
+ * Use this when the properties require async operations to compute:
195
+ *
196
+ * ```typescript
197
+ * await logger.trace(
198
+ * 'A trace message with {value}.',
199
+ * async () => ({ value: await fetchValue() })
200
+ * );
201
+ * ```
202
+ *
203
+ * @param message The message template. Placeholders to be replaced with
204
+ * `values` are indicated by keys in curly braces (e.g.,
205
+ * `{value}`).
206
+ * @param properties An async callback that returns the properties.
207
+ * @returns A promise that resolves when the log is written.
208
+ * @since 2.0.0
362
209
  */
363
- printToDot(params: LayoutTaskParams, hints?: AILayoutHints): DotSource;
364
- protected newScopedLogger(operation: string): any;
365
- dotToJson(dot: DotSource): Promise<GraphvizJson>;
366
- layout<A extends AnyAux>(params: LayoutTaskParams<A>): Promise<LayoutResult<A>>;
367
- aiLayout<A extends AnyAux>({
368
- view,
369
- styles
370
- }: LayoutTaskParams<A>, hints: AILayoutHints): Promise<LayoutResult<A>>;
371
- svg<A extends AnyAux>(params: LayoutTaskParams<A>): Promise<{
372
- svg: string;
373
- dot: DotSource;
374
- }>;
375
- dot<A extends AnyAux>(params: LayoutTaskParams<A>): Promise<DotSource>;
376
- layoutProjectsView(view: ComputedProjectsView): Promise<LayoutedProjectsView>;
377
- } //#endregion
378
- //#endregion
379
- //#region ../layouts/dist/index.d.mts
380
- //#region src/graphviz/QueueGraphvizLayoter.d.ts
381
- declare class QueueGraphvizLayoter extends GraphvizLayouter {
382
- private queue;
383
- private isProcessingBatch;
384
- constructor(options?: {
385
- graphviz?: GraphvizPort;
386
- /**
387
- * Concurrency limit.
388
- * Minimum: `1`.
389
- * @default 2
390
- */
391
- concurrency?: number;
392
- /**
393
- * Per-operation timeout in milliseconds. Operations fulfill once `timeout` elapses if they haven't already.
394
- * @default 20_000
395
- */
396
- timeout?: number;
397
- /**
398
- * Whether or not a timeout is considered an exception.
399
- * @default true
400
- */
401
- throwOnTimeout?: boolean;
402
- });
403
- private runInQueue;
404
- changePort(graphvizPort: GraphvizPort): void;
405
- layout<A extends AnyAux>(params: LayoutTaskParams<A>): Promise<LayoutResult<A>>;
406
- layoutProjectsView(view: ComputedProjectsView): Promise<LayoutedProjectsView>;
407
- batchLayout<A extends AnyAux>(params: {
408
- batch: LayoutTaskParams<A>[];
409
- cancelToken?: CancellationToken | undefined;
410
- onSuccess?: (task: LayoutTaskParams<A>, result: LayoutResult<A>) => void;
411
- onError?: (task: LayoutTaskParams<A>, error: unknown) => void;
412
- }): Promise<LayoutResult<A>[]>;
210
+ trace(message: string, properties: () => Promise<Record<string, unknown>>): Promise<void>;
413
211
  /**
414
- * Custom backpressure
415
- * (basically allow same amount of tasks to be in queue as concurrency)
212
+ * Log a trace values with no message. This is useful when you
213
+ * want to log properties without a message, e.g., when you want to log
214
+ * the context of a request or an operation.
215
+ *
216
+ * ```typescript
217
+ * logger.trace({ method: 'GET', url: '/api/v1/resource' });
218
+ * ```
219
+ *
220
+ * Note that this is a shorthand for:
221
+ *
222
+ * ```typescript
223
+ * logger.trace('{*}', { method: 'GET', url: '/api/v1/resource' });
224
+ * ```
225
+ *
226
+ * If the properties are expensive to compute, you cannot use this shorthand
227
+ * and should use the following syntax instead:
228
+ *
229
+ * ```typescript
230
+ * logger.trace('{*}', () => ({
231
+ * method: expensiveMethod(),
232
+ * url: expensiveUrl(),
233
+ * }));
234
+ * ```
235
+ *
236
+ * @param properties The values to log. Note that this does not take
237
+ * a callback.
238
+ * @since 0.12.0
416
239
  */
417
- private waitForQueueToShrink;
418
- dispose(): void;
419
- } //#endregion
420
- //#region src/graphviz/wasm/GraphvizWasmAdapter.d.ts
421
- //#endregion
422
- //#region ../language-server/dist/_chunks/module.d.mts
423
- //#region src/documentation/documentation-provider.d.ts
424
- /**
425
- * Provides documentation for LikeC4 AST nodes, extending JSDoc parsing
426
- * with specialized formatting for deployment nodes, deployed instances, and elements.
427
- */
428
- declare class LikeC4DocumentationProvider extends JSDocDocumentationProvider {
429
- private parser;
430
- private locator;
240
+ trace(properties: Record<string, unknown>): void;
431
241
  /**
432
- * Creates a new documentation provider.
433
- * @param services - The LikeC4 language services.
242
+ * Lazily log a trace message. Use this when the message values are expensive
243
+ * to compute and should only be computed if the message is actually logged.
244
+ *
245
+ * ```typescript
246
+ * logger.trace(l => l`A trace message with ${expensiveValue()}.`);
247
+ * ```
248
+ *
249
+ * @param callback A callback that returns the message template prefix.
250
+ * @throws {TypeError} If no log record was made inside the callback.
251
+ * @since 0.12.0
434
252
  */
435
- constructor(services: LikeC4Services);
253
+ trace(callback: LogCallback): void;
436
254
  /**
437
- * Returns documentation for the given AST node (deployment nodes, deployed instances, elements, or JSDoc fallback).
438
- * @param node - The AST node to document.
439
- * @returns Formatted documentation string, or undefined if none.
255
+ * Log a debug message. Use this as a template string prefix.
256
+ *
257
+ * ```typescript
258
+ * logger.debug `A debug message with ${value}.`;
259
+ * ```
260
+ *
261
+ * @param message The message template strings array.
262
+ * @param values The message template values.
440
263
  */
441
- getDocumentation(node: AstNode): string | undefined;
442
- } //#endregion
443
- //#region src/workspace/ProjectsManager.d.ts
444
- type NormalizedUri = Tagged<string, 'NormalizedUri'>;
445
- type DocOrUri = LangiumDocument | string | URI;
446
- /**
447
- * A tagged string that represents a project folder URI (with trailing slash).
448
- * Used in `startsWith` checks to determine if a document belongs to a project.
449
- */
450
- type ProjectFolder = Tagged<string, 'ProjectFolder'>;
451
- declare function ProjectFolder(folder: URI | string): ProjectFolder;
452
- interface Project {
453
- id: ProjectId;
454
- folderUri: URI;
455
- config: LikeC4ProjectConfig;
456
- }
457
- interface ProjectData extends Project {
458
- id: ProjectId;
459
- folder: ProjectFolder;
460
- config: LikeC4ProjectConfig;
461
- configUri: URI;
462
- folderUri: URI;
463
- exclude?: {
464
- (test: string): boolean;
465
- };
264
+ debug(message: TemplateStringsArray, ...values: readonly unknown[]): void;
466
265
  /**
467
- * Resolved include paths with both URI and folder string representations.
468
- * These are additional directories that are part of this project.
266
+ * Log a debug message with properties.
267
+ *
268
+ * ```typescript
269
+ * logger.debug('A debug message with {value}.', { value });
270
+ * ```
271
+ *
272
+ * If the properties are expensive to compute, you can pass a callback that
273
+ * returns the properties:
274
+ *
275
+ * ```typescript
276
+ * logger.debug(
277
+ * 'A debug message with {value}.',
278
+ * () => ({ value: expensiveComputation() })
279
+ * );
280
+ * ```
281
+ *
282
+ * @param message The message template. Placeholders to be replaced with
283
+ * `values` are indicated by keys in curly braces (e.g.,
284
+ * `{value}`).
285
+ * @param properties The values to replace placeholders with. For lazy
286
+ * evaluation, this can be a callback that returns the
287
+ * properties.
469
288
  */
470
- includePaths?: NonEmptyArray$1<{
471
- uri: URI;
472
- folder: ProjectFolder;
473
- }>;
289
+ debug(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
474
290
  /**
475
- * Normalized include configuration (paths, maxDepth, fileThreshold).
291
+ * Log a debug message with properties computed asynchronously.
292
+ *
293
+ * Use this when the properties require async operations to compute:
294
+ *
295
+ * ```typescript
296
+ * await logger.debug(
297
+ * 'A debug message with {value}.',
298
+ * async () => ({ value: await fetchValue() })
299
+ * );
300
+ * ```
301
+ *
302
+ * @param message The message template. Placeholders to be replaced with
303
+ * `values` are indicated by keys in curly braces (e.g.,
304
+ * `{value}`).
305
+ * @param properties An async callback that returns the properties.
306
+ * @returns A promise that resolves when the log is written.
307
+ * @since 2.0.0
476
308
  */
477
- includeConfig: IncludeConfig;
478
- }
479
- type RegisterProjectOptions = {
480
- config: LikeC4ProjectConfig | LikeC4ProjectConfigInput;
481
- } & ({
482
- configUri: URI | string;
483
- } | {
484
- folderUri: URI | string;
485
- });
486
- declare class ProjectsManager {
487
- #private;
488
- protected services: LikeC4SharedServices;
309
+ debug(message: string, properties: () => Promise<Record<string, unknown>>): Promise<void>;
489
310
  /**
490
- * The global project ID used for all documents
491
- * that are not part of a specific project.
311
+ * Log a debug values with no message. This is useful when you
312
+ * want to log properties without a message, e.g., when you want to log
313
+ * the context of a request or an operation.
314
+ *
315
+ * ```typescript
316
+ * logger.debug({ method: 'GET', url: '/api/v1/resource' });
317
+ * ```
318
+ *
319
+ * Note that this is a shorthand for:
320
+ *
321
+ * ```typescript
322
+ * logger.debug('{*}', { method: 'GET', url: '/api/v1/resource' });
323
+ * ```
324
+ *
325
+ * If the properties are expensive to compute, you cannot use this shorthand
326
+ * and should use the following syntax instead:
327
+ *
328
+ * ```typescript
329
+ * logger.debug('{*}', () => ({
330
+ * method: expensiveMethod(),
331
+ * url: expensiveUrl(),
332
+ * }));
333
+ * ```
334
+ *
335
+ * @param properties The values to log. Note that this does not take
336
+ * a callback.
337
+ * @since 0.11.0
492
338
  */
493
- static readonly DefaultProjectId: ProjectId;
494
- constructor(services: LikeC4SharedServices);
339
+ debug(properties: Record<string, unknown>): void;
495
340
  /**
496
- * Checks if a document is excluded by workspace-level patterns.
497
- * These patterns come from VS Code settings and take precedence over project-level excludes.
341
+ * Lazily log a debug message. Use this when the message values are expensive
342
+ * to compute and should only be computed if the message is actually logged.
343
+ *
344
+ * ```typescript
345
+ * logger.debug(l => l`A debug message with ${expensiveValue()}.`);
346
+ * ```
347
+ *
348
+ * @param callback A callback that returns the message template prefix.
349
+ * @throws {TypeError} If no log record was made inside the callback.
498
350
  */
499
- isExcludedByWorkspace(uri: NormalizedUri | URI): boolean;
351
+ debug(callback: LogCallback): void;
500
352
  /**
501
- * Updates the workspace-level exclude patterns from VS Code settings.
502
- * Called during initial server startup; dynamic changes restart the server.
353
+ * Log an informational message. Use this as a template string prefix.
354
+ *
355
+ * ```typescript
356
+ * logger.info `An info message with ${value}.`;
357
+ * ```
358
+ *
359
+ * @param message The message template strings array.
360
+ * @param values The message template values.
503
361
  */
504
- setWorkspaceExcludePatterns(patterns: string[] | undefined): void;
362
+ info(message: TemplateStringsArray, ...values: readonly unknown[]): void;
505
363
  /**
506
- * Returns:
507
- * - configured default project ID if set
508
- * - the default project ID if there are no projects.
509
- * - the ID of the only project
510
- * - undefined if there are multiple projects.
364
+ * Log an informational message with properties.
365
+ *
366
+ * ```typescript
367
+ * logger.info('An info message with {value}.', { value });
368
+ * ```
369
+ *
370
+ * If the properties are expensive to compute, you can pass a callback that
371
+ * returns the properties:
372
+ *
373
+ * ```typescript
374
+ * logger.info(
375
+ * 'An info message with {value}.',
376
+ * () => ({ value: expensiveComputation() })
377
+ * );
378
+ * ```
379
+ *
380
+ * @param message The message template. Placeholders to be replaced with
381
+ * `values` are indicated by keys in curly braces (e.g.,
382
+ * `{value}`).
383
+ * @param properties The values to replace placeholders with. For lazy
384
+ * evaluation, this can be a callback that returns the
385
+ * properties.
511
386
  */
512
- get defaultProjectId(): ProjectId | undefined;
513
- set defaultProjectId(id: string | ProjectId | undefined);
514
- get default(): ProjectData;
515
- get all(): NonEmptyReadonlyArray$1<ProjectId>;
516
- getProject(arg: ProjectId | LangiumDocument): ProjectData;
387
+ info(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
517
388
  /**
518
- * Returns all projects that overlap with the specified folder (is parent or child)
389
+ * Log an informational message with properties computed asynchronously.
390
+ *
391
+ * Use this when the properties require async operations to compute:
392
+ *
393
+ * ```typescript
394
+ * await logger.info(
395
+ * 'An info message with {value}.',
396
+ * async () => ({ value: await fetchValue() })
397
+ * );
398
+ * ```
399
+ *
400
+ * @param message The message template. Placeholders to be replaced with
401
+ * `values` are indicated by keys in curly braces (e.g.,
402
+ * `{value}`).
403
+ * @param properties An async callback that returns the properties.
404
+ * @returns A promise that resolves when the log is written.
405
+ * @since 2.0.0
519
406
  */
520
- findOverlaped(folder: URI | string): ReadonlyArray<ProjectData>;
407
+ info(message: string, properties: () => Promise<Record<string, unknown>>): Promise<void>;
521
408
  /**
522
- * Validates and ensures the project ID.
523
- * If no project ID is specified, returns default project ID
524
- * If there are multiple projects and default project is not set, throws an error
409
+ * Log an informational values with no message. This is useful when you
410
+ * want to log properties without a message, e.g., when you want to log
411
+ * the context of a request or an operation.
412
+ *
413
+ * ```typescript
414
+ * logger.info({ method: 'GET', url: '/api/v1/resource' });
415
+ * ```
416
+ *
417
+ * Note that this is a shorthand for:
418
+ *
419
+ * ```typescript
420
+ * logger.info('{*}', { method: 'GET', url: '/api/v1/resource' });
421
+ * ```
422
+ *
423
+ * If the properties are expensive to compute, you cannot use this shorthand
424
+ * and should use the following syntax instead:
425
+ *
426
+ * ```typescript
427
+ * logger.info('{*}', () => ({
428
+ * method: expensiveMethod(),
429
+ * url: expensiveUrl(),
430
+ * }));
431
+ * ```
432
+ *
433
+ * @param properties The values to log. Note that this does not take
434
+ * a callback.
435
+ * @since 0.11.0
525
436
  */
526
- ensureProjectId(projectId?: ProjectId | undefined): ProjectId;
437
+ info(properties: Record<string, unknown>): void;
527
438
  /**
528
- * Validates and ensures the project data.
529
- * If projectId is not specified, returns default project
439
+ * Lazily log an informational message. Use this when the message values are
440
+ * expensive to compute and should only be computed if the message is actually
441
+ * logged.
530
442
  *
531
- * If there are multiple projects and default project is not set, throws an error
443
+ * ```typescript
444
+ * logger.info(l => l`An info message with ${expensiveValue()}.`);
445
+ * ```
532
446
  *
533
- * @see ensureProjectId - to validate project ID only
447
+ * @param callback A callback that returns the message template prefix.
448
+ * @throws {TypeError} If no log record was made inside the callback.
534
449
  */
535
- ensureProject(projectId?: ProjectId | undefined): ProjectData;
536
- hasMultipleProjects(): boolean;
450
+ info(callback: LogCallback): void;
537
451
  /**
538
- * Checks if given document (or URI) must be excluded from processing.
452
+ * Log a warning.
453
+ *
454
+ * This overload is a shorthand for logging an {@link Error} instance as a
455
+ * structured property.
456
+ *
457
+ * ```typescript
458
+ * logger.warn(new Error("Oops"));
459
+ * ```
460
+ *
461
+ * Note that this uses `{error.message}` as the default message template.
462
+ * If you want to include the stack trace in text output, include `{error}`
463
+ * in the message template instead.
464
+ *
465
+ * @param error The error to log.
466
+ * @since 2.0.0
539
467
  */
540
- isExcluded(document: DocOrUri): boolean;
468
+ warn(error: Error): void;
541
469
  /**
542
- * Checks if given document (or URI) must be excluded in the context of the project.
470
+ * Log a warning with additional properties.
471
+ *
472
+ * This overload is a shorthand for logging an {@link Error} instance as a
473
+ * structured property while also adding extra properties.
474
+ *
475
+ * ```typescript
476
+ * logger.warn(new Error("Oops"), { requestId });
477
+ * ```
478
+ *
479
+ * @param error The error to log.
480
+ * @param properties Additional properties to log alongside the error.
481
+ * @since 2.1.0
543
482
  */
544
- isExcluded(projectId: ProjectId, document: DocOrUri): boolean;
483
+ warn(error: Error, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
545
484
  /**
546
- * Checks if the specified document is included by the project:
547
- * - if the document belongs to the project and is not excluded
548
- * - if the document is included by the project
485
+ * Log a warning with additional properties computed asynchronously.
486
+ *
487
+ * @param error The error to log.
488
+ * @param properties An async callback that returns the properties.
489
+ * @returns A promise that resolves when the log is written.
490
+ * @since 2.1.0
549
491
  */
550
- isIncluded(projectId: ProjectId, document: LangiumDocument | URI | string): boolean;
492
+ warn(error: Error, properties: () => Promise<Record<string, unknown>>): Promise<void>;
551
493
  /**
552
- * Registers likec4 project by config file.
494
+ * Log a warning message with an {@link Error}.
495
+ *
496
+ * ```typescript
497
+ * logger.warn("Failed to do something", new Error("Oops"));
498
+ * ```
499
+ *
500
+ * @param message The message.
501
+ * @param error The error to log.
502
+ * @since 2.0.0
553
503
  */
554
- registerConfigFile(configUri: URI, cancelToken?: CancellationToken$1): Promise<ProjectData>;
504
+ warn(message: string, error: Error): void;
555
505
  /**
556
- * Registers (or reloads) likec4 project by config file or config object.
557
- * If there is some project registered at same folder, it will be reloaded.
506
+ * Log a warning message. Use this as a template string prefix.
507
+ *
508
+ * ```typescript
509
+ * logger.warn `A warning message with ${value}.`;
510
+ * ```
511
+ *
512
+ * @param message The message template strings array.
513
+ * @param values The message template values.
558
514
  */
559
- registerProject(opts: RegisterProjectOptions, cancelToken?: CancellationToken$1): Promise<ProjectData>;
515
+ warn(message: TemplateStringsArray, ...values: readonly unknown[]): void;
560
516
  /**
561
- * Determines which project the given document belongs to.
562
- * If the document does not belong to any project, returns the default project ID.
517
+ * Log a warning message with properties.
518
+ *
519
+ * ```typescript
520
+ * logger.warn('A warning message with {value}.', { value });
521
+ * ```
522
+ *
523
+ * If the properties are expensive to compute, you can pass a callback that
524
+ * returns the properties:
525
+ *
526
+ * ```typescript
527
+ * logger.warn(
528
+ * 'A warning message with {value}.',
529
+ * () => ({ value: expensiveComputation() })
530
+ * );
531
+ * ```
532
+ *
533
+ * @param message The message template. Placeholders to be replaced with
534
+ * `values` are indicated by keys in curly braces (e.g.,
535
+ * `{value}`).
536
+ * @param properties The values to replace placeholders with. For lazy
537
+ * evaluation, this can be a callback that returns the
538
+ * properties.
563
539
  */
564
- ownerProjectId(document: LangiumDocument | URI | string): ProjectId;
540
+ warn(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
565
541
  /**
566
- * Returns path to the document relative to the project folder.
567
- * If the document does not belong to any project, returns the document URI as string.
542
+ * Log a warning message with properties computed asynchronously.
543
+ *
544
+ * Use this when the properties require async operations to compute:
545
+ *
546
+ * ```typescript
547
+ * await logger.warn(
548
+ * 'A warning message with {value}.',
549
+ * async () => ({ value: await fetchValue() })
550
+ * );
551
+ * ```
552
+ *
553
+ * @param message The message template. Placeholders to be replaced with
554
+ * `values` are indicated by keys in curly braces (e.g.,
555
+ * `{value}`).
556
+ * @param properties An async callback that returns the properties.
557
+ * @returns A promise that resolves when the log is written.
558
+ * @since 2.0.0
568
559
  */
569
- relativePath(document: LangiumDocument | URI | string): string;
560
+ warn(message: string, properties: () => Promise<Record<string, unknown>>): Promise<void>;
570
561
  /**
571
- * Returns true if the manager is currently initializing or reloading projects.
572
- * This is used to prevent duplicate reload operations.
562
+ * Log a warning values with no message. This is useful when you
563
+ * want to log properties without a message, e.g., when you want to log
564
+ * the context of a request or an operation.
565
+ *
566
+ * ```typescript
567
+ * logger.warn({ method: 'GET', url: '/api/v1/resource' });
568
+ * ```
569
+ *
570
+ * Note that this is a shorthand for:
571
+ *
572
+ * ```typescript
573
+ * logger.warn('{*}', { method: 'GET', url: '/api/v1/resource' });
574
+ * ```
575
+ *
576
+ * If the properties are expensive to compute, you cannot use this shorthand
577
+ * and should use the following syntax instead:
578
+ *
579
+ * ```typescript
580
+ * logger.warn('{*}', () => ({
581
+ * method: expensiveMethod(),
582
+ * url: expensiveUrl(),
583
+ * }));
584
+ * ```
585
+ *
586
+ * @param properties The values to log. Note that this does not take
587
+ * a callback.
588
+ * @since 0.11.0
573
589
  */
574
- protected get isInitiatingOrReloading(): boolean;
575
- reloadProjects(cancelToken?: CancellationToken$1): Promise<void>;
576
- protected _reloadProjects(cancelToken?: CancellationToken$1): Promise<void>;
577
- protected uniqueProjectId(name: string): ProjectId;
578
- protected resetCaches(): void;
579
- rebuildProject(projectId: ProjectId, cancelToken?: CancellationToken$1): Promise<void>;
590
+ warn(properties: Record<string, unknown>): void;
580
591
  /**
581
- * Returns all include paths from all projects.
582
- * Used by WorkspaceManager to scan additional directories for C4 files.
592
+ * Lazily log a warning message. Use this when the message values are
593
+ * expensive to compute and should only be computed if the message is actually
594
+ * logged.
595
+ *
596
+ * ```typescript
597
+ * logger.warn(l => l`A warning message with ${expensiveValue()}.`);
598
+ * ```
599
+ *
600
+ * @param callback A callback that returns the message template prefix.
601
+ * @throws {TypeError} If no log record was made inside the callback.
583
602
  */
584
- getAllIncludePaths(): Array<{
585
- projectId: ProjectId;
586
- includePath: URI;
587
- includeConfig: IncludeConfig;
588
- }>;
603
+ warn(callback: LogCallback): void;
589
604
  /**
590
- * Register a listener to be called when the projects configuration has changed.
591
- * @returns A disposable that can be used to unregister the callback.
605
+ * Log a warning.
606
+ *
607
+ * This overload is a shorthand for logging an {@link Error} instance as a
608
+ * structured property.
609
+ *
610
+ * ```typescript
611
+ * logger.warning(new Error("Oops"));
612
+ * ```
613
+ *
614
+ * Note that this uses `{error.message}` as the default message template.
615
+ * If you want to include the stack trace in text output, include `{error}`
616
+ * in the message template instead.
617
+ *
618
+ * @param error The error to log.
619
+ * @since 2.0.0
592
620
  */
593
- onProjectsUpdate(callback: () => void): Disposable$1;
594
- private getWorkspaceFolder;
595
- private notifyListeners;
596
- private updateIncludesExcludes;
597
- private warnIfConfigOverride;
598
- } //#endregion
599
- //#region src/filesystem/types.d.ts
600
- interface FileNode extends FileSystemNode {
601
- readonly isFile: true;
602
- readonly isDirectory: false;
603
- }
604
- interface FileSystemProvider$1 extends FileSystemProvider {
621
+ warning(error: Error): void;
605
622
  /**
606
- * Scans the project files for the given URI.
607
- * @returns The list of file system entries that are contained within the specified directory.
623
+ * Log a warning with additional properties.
624
+ *
625
+ * This overload is a shorthand for logging an {@link Error} instance as a
626
+ * structured property while also adding extra properties.
627
+ *
628
+ * ```typescript
629
+ * logger.warning(new Error("Oops"), { requestId });
630
+ * ```
631
+ *
632
+ * @param error The error to log.
633
+ * @param properties Additional properties to log alongside the error.
634
+ * @since 2.1.0
608
635
  */
609
- scanProjectFiles(folderUri: URI): Promise<FileNode[]>;
636
+ warning(error: Error, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
610
637
  /**
611
- * Loads the project config from the given file.
612
- * @returns The project config.
613
- * @throws Error if the file does not exist or is not a valid project config.
638
+ * Log a warning with additional properties computed asynchronously.
639
+ *
640
+ * @param error The error to log.
641
+ * @param properties An async callback that returns the properties.
642
+ * @returns A promise that resolves when the log is written.
643
+ * @since 2.1.0
614
644
  */
615
- loadProjectConfig(filepath: URI): Promise<LikeC4ProjectConfig>;
645
+ warning(error: Error, properties: () => Promise<Record<string, unknown>>): Promise<void>;
616
646
  /**
617
- * Reads the directory and returns LikeC4 files.
647
+ * Log a warning message with an {@link Error}.
618
648
  *
619
- * @param options.recursive If true, recursively reads the directory,
620
- * @param options.maxDepth Maximum depth to traverse when recursive is true (default: Infinity)
649
+ * ```typescript
650
+ * logger.warning("Failed to do something", new Error("Oops"));
651
+ * ```
652
+ *
653
+ * @param message The message.
654
+ * @param error The error to log.
655
+ * @since 2.0.0
621
656
  */
622
- readDirectory(uri: URI, options?: {
623
- recursive?: boolean;
624
- maxDepth?: number;
625
- }): Promise<FileNode[]>;
657
+ warning(message: string, error: Error): void;
626
658
  /**
627
- * Finds all files in the given directory, matching the given filter.
659
+ * Log a warning message. Use this as a template string prefix.
660
+ *
661
+ * ```typescript
662
+ * logger.warning `A warning message with ${value}.`;
663
+ * ```
664
+ *
665
+ * @param message The message template strings array.
666
+ * @param values The message template values.
667
+ * @since 0.12.0
628
668
  */
629
- scanDirectory(directory: URI, filter: (filepath: string, isDirectory: boolean) => boolean): Promise<FileNode[]>;
669
+ warning(message: TemplateStringsArray, ...values: readonly unknown[]): void;
630
670
  /**
631
- * Writes the content to the file system.
632
- * Used by manual layouts.
671
+ * Log a warning message with properties.
672
+ *
673
+ * ```typescript
674
+ * logger.warning('A warning message with {value}.', { value });
675
+ * ```
676
+ *
677
+ * If the properties are expensive to compute, you can pass a callback that
678
+ * returns the properties:
679
+ *
680
+ * ```typescript
681
+ * logger.warning(
682
+ * 'A warning message with {value}.',
683
+ * () => ({ value: expensiveComputation() })
684
+ * );
685
+ * ```
686
+ *
687
+ * @param message The message template. Placeholders to be replaced with
688
+ * `values` are indicated by keys in curly braces (e.g.,
689
+ * `{value}`).
690
+ * @param properties The values to replace placeholders with. For lazy
691
+ * evaluation, this can be a callback that returns the
692
+ * properties.
693
+ * @since 0.12.0
633
694
  */
634
- writeFile(uri: URI, content: string): Promise<void>;
695
+ warning(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
635
696
  /**
636
- * Deletes the file from the file system.
637
- * Used by manual layouts.
638
- * @return true if the file was deleted, false if the file did not exist.
697
+ * Log a warning message with properties computed asynchronously.
698
+ *
699
+ * Use this when the properties require async operations to compute:
700
+ *
701
+ * ```typescript
702
+ * await logger.warning(
703
+ * 'A warning message with {value}.',
704
+ * async () => ({ value: await fetchValue() })
705
+ * );
706
+ * ```
707
+ *
708
+ * @param message The message template. Placeholders to be replaced with
709
+ * `values` are indicated by keys in curly braces (e.g.,
710
+ * `{value}`).
711
+ * @param properties An async callback that returns the properties.
712
+ * @returns A promise that resolves when the log is written.
713
+ * @since 2.0.0
639
714
  */
640
- deleteFile(uri: URI): Promise<boolean>;
641
- }
642
- interface FileSystemWatcher extends AsyncDisposable {
715
+ warning(message: string, properties: () => Promise<Record<string, unknown>>): Promise<void>;
643
716
  /**
644
- * Watches a folder for changes and triggers a reload of the documents and projects.
717
+ * Log a warning values with no message. This is useful when you
718
+ * want to log properties without a message, e.g., when you want to log
719
+ * the context of a request or an operation.
720
+ *
721
+ * ```typescript
722
+ * logger.warning({ method: 'GET', url: '/api/v1/resource' });
723
+ * ```
724
+ *
725
+ * Note that this is a shorthand for:
726
+ *
727
+ * ```typescript
728
+ * logger.warning('{*}', { method: 'GET', url: '/api/v1/resource' });
729
+ * ```
730
+ *
731
+ * If the properties are expensive to compute, you cannot use this shorthand
732
+ * and should use the following syntax instead:
733
+ *
734
+ * ```typescript
735
+ * logger.warning('{*}', () => ({
736
+ * method: expensiveMethod(),
737
+ * url: expensiveUrl(),
738
+ * }));
739
+ * ```
740
+ *
741
+ * @param properties The values to log. Note that this does not take
742
+ * a callback.
743
+ * @since 0.12.0
645
744
  */
646
- watch(folder: string): void;
647
- }
648
- type ManualLayoutsSnapshot = {
649
- hash: string;
650
- views: Record<ViewId, LayoutedView>;
651
- };
652
- type ManualLayoutUpdateEvent = {
653
- updated: URI;
654
- projectId: ProjectId;
655
- viewId: ViewId;
656
- } | {
657
- removed: URI;
658
- projectId: ProjectId;
745
+ warning(properties: Record<string, unknown>): void;
659
746
  /**
660
- * Missing if triggered by FS event (file was deleted)
747
+ * Lazily log a warning message. Use this when the message values are
748
+ * expensive to compute and should only be computed if the message is actually
749
+ * logged.
750
+ *
751
+ * ```typescript
752
+ * logger.warning(l => l`A warning message with ${expensiveValue()}.`);
753
+ * ```
754
+ *
755
+ * @param callback A callback that returns the message template prefix.
756
+ * @throws {TypeError} If no log record was made inside the callback.
757
+ * @since 0.12.0
661
758
  */
662
- viewId?: ViewId;
663
- };
664
- type ManualLayoutUpdateListener = (event: ManualLayoutUpdateEvent) => void;
665
- interface LikeC4ManualLayouts {
759
+ warning(callback: LogCallback): void;
666
760
  /**
667
- * Reads a single layouted view from the file system by its URI.
668
- * Used by the language server to get the current layout state.
761
+ * Log an error.
762
+ *
763
+ * This overload is a shorthand for logging an {@link Error} instance as a
764
+ * structured property.
765
+ *
766
+ * ```typescript
767
+ * logger.error(new Error("Oops"));
768
+ * ```
769
+ *
770
+ * Note that this uses `{error.message}` as the default message template.
771
+ * If you want to include the stack trace in text output, include `{error}`
772
+ * in the message template instead.
773
+ *
774
+ * @param error The error to log.
775
+ * @since 2.0.0
669
776
  */
670
- readSnapshot(uri: URI): Promise<LayoutedView | null>;
671
- read(project: Project): Promise<ManualLayoutsSnapshot | null>;
672
- write(project: Project, layouted: LayoutedView): Promise<Location>;
673
- remove(project: Project, view: ViewId): Promise<Location | null>;
674
- clearCaches(): void;
777
+ error(error: Error): void;
675
778
  /**
676
- * Registers a listener for manual layout updates.
677
- * The listener will be called when a manual layout is created, updated, or deleted.
779
+ * Log an error with additional properties.
780
+ *
781
+ * This overload is a shorthand for logging an {@link Error} instance as a
782
+ * structured property while also adding extra properties.
783
+ *
784
+ * ```typescript
785
+ * logger.error(new Error("Oops"), { requestId });
786
+ * ```
787
+ *
788
+ * If the properties are expensive to compute, you can pass a callback that
789
+ * returns the properties:
790
+ *
791
+ * ```typescript
792
+ * logger.error(
793
+ * new Error("Oops"),
794
+ * () => ({ requestId: expensiveLookup() })
795
+ * );
796
+ * ```
797
+ *
798
+ * @param error The error to log.
799
+ * @param properties Additional properties to log alongside the error.
800
+ * @since 2.1.0
678
801
  */
679
- onManualLayoutUpdate(listener: ManualLayoutUpdateListener): Disposable$1;
802
+ error(error: Error, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
680
803
  /**
681
- * Handles file system updates for manual layouts.
682
- * Used by the file system watcher to notify the manual layouts module of changes.
683
- * @param event The file system event
804
+ * Log an error with additional properties computed asynchronously.
805
+ *
806
+ * Use this when the properties require async operations to compute:
807
+ *
808
+ * ```typescript
809
+ * await logger.error(
810
+ * new Error("Oops"),
811
+ * async () => ({ requestId: await fetchRequestId() })
812
+ * );
813
+ * ```
814
+ *
815
+ * @param error The error to log.
816
+ * @param properties An async callback that returns the properties.
817
+ * @returns A promise that resolves when the log is written.
818
+ * @since 2.1.0
684
819
  */
685
- handleFileSystemUpdate(event: {
686
- update: URI;
687
- delete?: never;
688
- } | {
689
- delete: URI;
690
- update?: never;
691
- }): Promise<void>;
692
- } //#endregion
693
- //#region src/filesystem/noop.d.ts
694
- //#endregion
695
- //#region src/formatting/LikeC4Formatter.d.ts
696
- type QuoteStyle = 'single' | 'double' | 'ignore' | 'auto';
697
- interface LikeC4FormatterOptions {
698
- quoteStyle: QuoteStyle;
699
- }
700
- type ExtendedFormattingCommandType = 'normalizeQuotes';
701
- interface ExtendedFormattingCommand {
702
- type: ExtendedFormattingCommandType;
703
- region: FormattingRegion;
704
- }
705
- declare class LikeC4Formatter extends AbstractFormatter {
706
- protected options: LikeC4FormatterOptions;
707
- extendedFormattingCommands: ExtendedFormattingCommand[];
708
- constructor(services: LikeC4Services);
709
- protected doDocumentFormat(document: LangiumDocument, options: FormattingOptions, range?: Range): TextEdit[];
710
- protected format(node: AstNode): void;
711
- protected formatTags(node: AstNode): void;
712
- protected formatDeploymentRelation(node: AstNode): void;
713
- protected formatExtendDeployment(node: AstNode): void;
714
- protected formatRelation(node: AstNode): void;
715
- protected removeIndentFromTopLevelStatements(node: AstNode): void;
716
- protected indentContentInBraces(node: AstNode): void;
717
- protected appendKeywordsWithSpace(node: AstNode): void;
718
- protected formatView(node: AstNode): void;
719
- protected formatLeafProperty(node: AstNode): void;
720
- protected formatLinkProperty(node: AstNode): void;
721
- protected formatNavigateToProperty(node: AstNode): void;
722
- protected formatAutolayoutProperty(node: AstNode): void;
723
- protected formatMetadataProperty(node: AstNode): void;
724
- protected formatElementDeclaration(node: AstNode): void;
725
- protected formatExtendElement(node: AstNode): void;
726
- protected formatGlobals(node: AstNode): void;
727
- protected formatImports(node: AstNode): void;
728
- protected formatSpecificationRule(node: AstNode): void;
729
- protected formatWithPredicate(node: AstNode): void;
730
- protected formatDeploymentNodeDeclaration(node: AstNode): void;
731
- protected formatDeployedInstance(node: AstNode): void;
732
- protected formatViewRuleGlobalStyle(node: AstNode): void;
733
- protected formatViewRuleGlobalPredicate(node: AstNode): void;
734
- protected formatViewRuleGroup(node: AstNode): void;
735
- protected formatViewRuleStyle(node: AstNode): void;
736
- protected formatWhereExpression(node: AstNode): void;
737
- protected formatWhereRelationExpression(node: AstNode): void;
738
- protected formatWhereElementExpression(node: AstNode): void;
739
- protected formatIncludeExcludeExpressions(node: AstNode): void;
740
- protected formatRelationExpression(node: AstNode): void;
741
- private findPredicateExpressionRoot;
742
- private on;
743
- private doExtendedFormatting;
744
- protected normalizeQuotes(node: AstNode): void;
745
- private quotesNormalizerFactory;
746
- private escapeQuotesInternalQuotes;
747
- private getAutoQuoteStyle;
748
- private onConfigurationUpdate;
820
+ error(error: Error, properties: () => Promise<Record<string, unknown>>): Promise<void>;
821
+ /**
822
+ * Log an error message with an {@link Error}.
823
+ *
824
+ * ```typescript
825
+ * logger.error("Failed to do something", new Error("Oops"));
826
+ * ```
827
+ *
828
+ * @param message The message.
829
+ * @param error The error to log.
830
+ * @since 2.0.0
831
+ */
832
+ error(message: string, error: Error): void;
833
+ /**
834
+ * Log an error message. Use this as a template string prefix.
835
+ *
836
+ * ```typescript
837
+ * logger.error `An error message with ${value}.`;
838
+ * ```
839
+ *
840
+ * @param message The message template strings array.
841
+ * @param values The message template values.
842
+ */
843
+ error(message: TemplateStringsArray, ...values: readonly unknown[]): void;
844
+ /**
845
+ * Log an error message with properties.
846
+ *
847
+ * ```typescript
848
+ * logger.warn('An error message with {value}.', { value });
849
+ * ```
850
+ *
851
+ * If the properties are expensive to compute, you can pass a callback that
852
+ * returns the properties:
853
+ *
854
+ * ```typescript
855
+ * logger.error(
856
+ * 'An error message with {value}.',
857
+ * () => ({ value: expensiveComputation() })
858
+ * );
859
+ * ```
860
+ *
861
+ * @param message The message template. Placeholders to be replaced with
862
+ * `values` are indicated by keys in curly braces (e.g.,
863
+ * `{value}`).
864
+ * @param properties The values to replace placeholders with. For lazy
865
+ * evaluation, this can be a callback that returns the
866
+ * properties.
867
+ */
868
+ error(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
869
+ /**
870
+ * Log an error message with properties computed asynchronously.
871
+ *
872
+ * Use this when the properties require async operations to compute:
873
+ *
874
+ * ```typescript
875
+ * await logger.error(
876
+ * 'An error message with {value}.',
877
+ * async () => ({ value: await fetchValue() })
878
+ * );
879
+ * ```
880
+ *
881
+ * @param message The message template. Placeholders to be replaced with
882
+ * `values` are indicated by keys in curly braces (e.g.,
883
+ * `{value}`).
884
+ * @param properties An async callback that returns the properties.
885
+ * @returns A promise that resolves when the log is written.
886
+ * @since 2.0.0
887
+ */
888
+ error(message: string, properties: () => Promise<Record<string, unknown>>): Promise<void>;
889
+ /**
890
+ * Log an error values with no message. This is useful when you
891
+ * want to log properties without a message, e.g., when you want to log
892
+ * the context of a request or an operation.
893
+ *
894
+ * ```typescript
895
+ * logger.error({ method: 'GET', url: '/api/v1/resource' });
896
+ * ```
897
+ *
898
+ * Note that this is a shorthand for:
899
+ *
900
+ * ```typescript
901
+ * logger.error('{*}', { method: 'GET', url: '/api/v1/resource' });
902
+ * ```
903
+ *
904
+ * If the properties are expensive to compute, you cannot use this shorthand
905
+ * and should use the following syntax instead:
906
+ *
907
+ * ```typescript
908
+ * logger.error('{*}', () => ({
909
+ * method: expensiveMethod(),
910
+ * url: expensiveUrl(),
911
+ * }));
912
+ * ```
913
+ *
914
+ * @param properties The values to log. Note that this does not take
915
+ * a callback.
916
+ * @since 0.11.0
917
+ */
918
+ error(properties: Record<string, unknown>): void;
919
+ /**
920
+ * Lazily log an error message. Use this when the message values are
921
+ * expensive to compute and should only be computed if the message is actually
922
+ * logged.
923
+ *
924
+ * ```typescript
925
+ * logger.error(l => l`An error message with ${expensiveValue()}.`);
926
+ * ```
927
+ *
928
+ * @param callback A callback that returns the message template prefix.
929
+ * @throws {TypeError} If no log record was made inside the callback.
930
+ */
931
+ error(callback: LogCallback): void;
932
+ /**
933
+ * Log a fatal error.
934
+ *
935
+ * This overload is a shorthand for logging an {@link Error} instance as a
936
+ * structured property.
937
+ *
938
+ * ```typescript
939
+ * logger.fatal(new Error("Oops"));
940
+ * ```
941
+ *
942
+ * Note that this uses `{error.message}` as the default message template.
943
+ * If you want to include the stack trace in text output, include `{error}`
944
+ * in the message template instead.
945
+ *
946
+ * @param error The error to log.
947
+ * @since 2.0.0
948
+ */
949
+ fatal(error: Error): void;
950
+ /**
951
+ * Log a fatal error with additional properties.
952
+ *
953
+ * This overload is a shorthand for logging an {@link Error} instance as a
954
+ * structured property while also adding extra properties.
955
+ *
956
+ * ```typescript
957
+ * logger.fatal(new Error("Oops"), { requestId });
958
+ * ```
959
+ *
960
+ * @param error The error to log.
961
+ * @param properties Additional properties to log alongside the error.
962
+ * @since 2.1.0
963
+ */
964
+ fatal(error: Error, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
965
+ /**
966
+ * Log a fatal error with additional properties computed asynchronously.
967
+ *
968
+ * @param error The error to log.
969
+ * @param properties An async callback that returns the properties.
970
+ * @returns A promise that resolves when the log is written.
971
+ * @since 2.1.0
972
+ */
973
+ fatal(error: Error, properties: () => Promise<Record<string, unknown>>): Promise<void>;
974
+ /**
975
+ * Log a fatal error message with an {@link Error}.
976
+ *
977
+ * ```typescript
978
+ * logger.fatal("Failed to do something", new Error("Oops"));
979
+ * ```
980
+ *
981
+ * @param message The message.
982
+ * @param error The error to log.
983
+ * @since 2.0.0
984
+ */
985
+ fatal(message: string, error: Error): void;
986
+ /**
987
+ * Log a fatal error message. Use this as a template string prefix.
988
+ *
989
+ * ```typescript
990
+ * logger.fatal `A fatal error message with ${value}.`;
991
+ * ```
992
+ *
993
+ * @param message The message template strings array.
994
+ * @param values The message template values.
995
+ */
996
+ fatal(message: TemplateStringsArray, ...values: readonly unknown[]): void;
997
+ /**
998
+ * Log a fatal error message with properties.
999
+ *
1000
+ * ```typescript
1001
+ * logger.warn('A fatal error message with {value}.', { value });
1002
+ * ```
1003
+ *
1004
+ * If the properties are expensive to compute, you can pass a callback that
1005
+ * returns the properties:
1006
+ *
1007
+ * ```typescript
1008
+ * logger.fatal(
1009
+ * 'A fatal error message with {value}.',
1010
+ * () => ({ value: expensiveComputation() })
1011
+ * );
1012
+ * ```
1013
+ *
1014
+ * @param message The message template. Placeholders to be replaced with
1015
+ * `values` are indicated by keys in curly braces (e.g.,
1016
+ * `{value}`).
1017
+ * @param properties The values to replace placeholders with. For lazy
1018
+ * evaluation, this can be a callback that returns the
1019
+ * properties.
1020
+ */
1021
+ fatal(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
1022
+ /**
1023
+ * Log a fatal error message with properties computed asynchronously.
1024
+ *
1025
+ * Use this when the properties require async operations to compute:
1026
+ *
1027
+ * ```typescript
1028
+ * await logger.fatal(
1029
+ * 'A fatal error message with {value}.',
1030
+ * async () => ({ value: await fetchValue() })
1031
+ * );
1032
+ * ```
1033
+ *
1034
+ * @param message The message template. Placeholders to be replaced with
1035
+ * `values` are indicated by keys in curly braces (e.g.,
1036
+ * `{value}`).
1037
+ * @param properties An async callback that returns the properties.
1038
+ * @returns A promise that resolves when the log is written.
1039
+ * @since 2.0.0
1040
+ */
1041
+ fatal(message: string, properties: () => Promise<Record<string, unknown>>): Promise<void>;
1042
+ /**
1043
+ * Log a fatal error values with no message. This is useful when you
1044
+ * want to log properties without a message, e.g., when you want to log
1045
+ * the context of a request or an operation.
1046
+ *
1047
+ * ```typescript
1048
+ * logger.fatal({ method: 'GET', url: '/api/v1/resource' });
1049
+ * ```
1050
+ *
1051
+ * Note that this is a shorthand for:
1052
+ *
1053
+ * ```typescript
1054
+ * logger.fatal('{*}', { method: 'GET', url: '/api/v1/resource' });
1055
+ * ```
1056
+ *
1057
+ * If the properties are expensive to compute, you cannot use this shorthand
1058
+ * and should use the following syntax instead:
1059
+ *
1060
+ * ```typescript
1061
+ * logger.fatal('{*}', () => ({
1062
+ * method: expensiveMethod(),
1063
+ * url: expensiveUrl(),
1064
+ * }));
1065
+ * ```
1066
+ *
1067
+ * @param properties The values to log. Note that this does not take
1068
+ * a callback.
1069
+ * @since 0.11.0
1070
+ */
1071
+ fatal(properties: Record<string, unknown>): void;
1072
+ /**
1073
+ * Lazily log a fatal error message. Use this when the message values are
1074
+ * expensive to compute and should only be computed if the message is actually
1075
+ * logged.
1076
+ *
1077
+ * ```typescript
1078
+ * logger.fatal(l => l`A fatal error message with ${expensiveValue()}.`);
1079
+ * ```
1080
+ *
1081
+ * @param callback A callback that returns the message template prefix.
1082
+ * @throws {TypeError} If no log record was made inside the callback.
1083
+ */
1084
+ fatal(callback: LogCallback): void;
1085
+ /**
1086
+ * Emits a log record with custom fields while using this logger's
1087
+ * category.
1088
+ *
1089
+ * This is a low-level API for integration scenarios where you need full
1090
+ * control over the log record, particularly for preserving timestamps
1091
+ * from external systems.
1092
+ *
1093
+ * ```typescript
1094
+ * const logger = getLogger(["my-app", "integration"]);
1095
+ *
1096
+ * // Emit a log with a custom timestamp
1097
+ * logger.emit({
1098
+ * timestamp: kafkaLog.originalTimestamp,
1099
+ * level: "info",
1100
+ * message: [kafkaLog.message],
1101
+ * rawMessage: kafkaLog.message,
1102
+ * properties: {
1103
+ * source: "kafka",
1104
+ * partition: kafkaLog.partition,
1105
+ * offset: kafkaLog.offset,
1106
+ * },
1107
+ * });
1108
+ * ```
1109
+ *
1110
+ * @param record Log record without category field (category comes from
1111
+ * the logger instance)
1112
+ * @since 1.1.0
1113
+ */
1114
+ emit(record: Omit<LogRecord, "category">): void;
1115
+ /**
1116
+ * Check if a message of the given severity level would be processed by
1117
+ * this logger.
1118
+ *
1119
+ * This is useful for conditionally executing expensive computations
1120
+ * before logging, particularly for async operations where lazy
1121
+ * evaluation callbacks cannot be used:
1122
+ *
1123
+ * ```typescript
1124
+ * if (logger.isEnabledFor("debug")) {
1125
+ * const result = await expensiveAsync();
1126
+ * logger.debug("Result: {result}", { result });
1127
+ * }
1128
+ * ```
1129
+ *
1130
+ * @param level The log level to check.
1131
+ * @returns `true` if a message of the given level would be logged,
1132
+ * `false` otherwise.
1133
+ * @since 2.0.0
1134
+ */
1135
+ isEnabledFor(level: LogLevel): boolean;
1136
+ }
1137
+ /**
1138
+ * A logging callback function. It is used to defer the computation of a
1139
+ * message template until it is actually logged.
1140
+ * @param prefix The message template prefix.
1141
+ * @returns The rendered message array.
1142
+ */
1143
+ type LogCallback = (prefix: LogTemplatePrefix) => unknown[];
1144
+ /**
1145
+ * A logging template prefix function. It is used to log a message in
1146
+ * a {@link LogCallback} function.
1147
+ * @param message The message template strings array.
1148
+ * @param values The message template values.
1149
+ * @returns The rendered message array.
1150
+ */
1151
+ type LogTemplatePrefix = (message: TemplateStringsArray, ...values: unknown[]) => unknown[];
1152
+ /**
1153
+ * A function type for logging methods in the {@link Logger} interface.
1154
+ * @since 1.0.0
1155
+ */
1156
+ //#endregion
1157
+ //#region ../layouts/dist/_chunks/types.d.mts
1158
+ /**
1159
+ * invisible edge added by AI to enforce better layout
1160
+ */
1161
+ interface AIEnforcementEdge {
1162
+ source: NodeId;
1163
+ target: NodeId;
1164
+ weight?: number;
1165
+ minlen?: number;
1166
+ }
1167
+ /**
1168
+ * Complete set of AI-generated layout hints.
1169
+ * This is the JSON schema the LLM must produce.
1170
+ */
1171
+ interface AILayoutHints {
1172
+ direction?: 'TB' | 'BT' | 'LR' | 'RL';
1173
+ ranks: ReadonlyArray<{
1174
+ rank: 'same' | 'source' | 'sink' | 'min' | 'max';
1175
+ nodes: NonEmptyArray<NodeId>;
1176
+ }>;
1177
+ edgeWeight: Record<EdgeId, number>;
1178
+ edgeMinlen: Record<EdgeId, number>;
1179
+ /**
1180
+ * These edges should be reversed in DOT
1181
+ * Unique array of EdgeIds.
1182
+ */
1183
+ reverseRank?: NonEmptyReadonlyArray<EdgeId>;
1184
+ /**
1185
+ * These edges should be excluded, i.e. `constraint=false` in Graphviz, to allow more flexible layouts.
1186
+ * Unique array of EdgeIds.
1187
+ */
1188
+ excludeFromRanking?: NonEmptyReadonlyArray<EdgeId>;
1189
+ /**
1190
+ * Suggested order of edges for DOT output, to influence edge routing.
1191
+ */
1192
+ edgeOrder?: NonEmptyReadonlyArray<EdgeId>;
1193
+ /**
1194
+ * Suggested order of nodes for DOT output, to influence node placement.
1195
+ */
1196
+ nodeOrder?: NonEmptyReadonlyArray<NodeId>;
1197
+ /**
1198
+ * Invisible edges added by AI to enforce better layout
1199
+ */
1200
+ invisibleEdges?: NonEmptyReadonlyArray<AIEnforcementEdge>;
1201
+ /**
1202
+ * LLM reasoning for debugging/display
1203
+ */
1204
+ reasoning: string;
1205
+ } //#endregion
1206
+ //#endregion
1207
+ //#region ../language-server/dist/_chunks/protocol.d.mts
1208
+ /**
1209
+ * When server requests to open a likec4 preview panel
1210
+ * (available only in the editor).
1211
+ * (not the best place, but seems to be working)
1212
+ */
1213
+ declare namespace DidRequestOpenViewNotification {
1214
+ type Params = {
1215
+ viewId: ViewId$1;
1216
+ projectId: ProjectId$1;
1217
+ };
1218
+ const type: NotificationType<Params>;
1219
+ type Type = typeof type;
1220
+ }
1221
+ /**
1222
+ * Request to fetch the computed model data
1223
+ * If LSP has multiple projects, the projectId is required.
1224
+ * otherwise throws an error.
1225
+ */
1226
+ /**
1227
+ * Request to locate an element, relation, deployment or view.
1228
+ * If LSP has multiple projects, the projectId is required.
1229
+ */
1230
+ declare namespace Locate {
1231
+ type Params =
1232
+ /**
1233
+ * Locate an element by its fqn
1234
+ */
1235
+ {
1236
+ element: Fqn$1;
1237
+ projectId?: string | undefined;
1238
+ property?: string;
1239
+ }
1240
+ /**
1241
+ * Locate a relation by its id
1242
+ */
1243
+ | {
1244
+ projectId?: string | undefined;
1245
+ relation: RelationId;
1246
+ }
1247
+ /**
1248
+ * Locate a deployment by its fqn
1249
+ */
1250
+ | {
1251
+ deployment: DeploymentFqn;
1252
+ projectId?: string | undefined;
1253
+ property?: string;
1254
+ }
1255
+ /**
1256
+ * Locate a step in a dynamic view by its astPath
1257
+ */
1258
+ | {
1259
+ view: ViewId$1;
1260
+ astPath: string;
1261
+ projectId?: string | undefined;
1262
+ }
1263
+ /**
1264
+ * Locate a view by its id
1265
+ */
1266
+ | {
1267
+ view: ViewId$1;
1268
+ projectId?: string | undefined;
1269
+ };
1270
+ type Res = Location | null;
1271
+ const req: RequestType<Params, Res, void>;
1272
+ type Req = typeof req;
1273
+ }
1274
+ /**
1275
+ * Request to change the view
1276
+ * If LSP has multiple projects, the projectId is required.
1277
+ */
1278
+ declare namespace ChangeView {
1279
+ type Params = {
1280
+ viewId: ViewId$1;
1281
+ change: ViewChange;
1282
+ projectId?: string | undefined;
1283
+ };
1284
+ type Res = {
1285
+ success: true;
1286
+ location: Location | null;
1287
+ } | {
1288
+ success: false;
1289
+ location?: Location | null;
1290
+ error: string;
1291
+ };
1292
+ const req: RequestType<Params, Res, void>;
1293
+ type Req = typeof req;
1294
+ }
1295
+ /**
1296
+ * Request to fetch telemetry metrics
1297
+ */
1298
+ //#endregion
1299
+ //#region ../layouts/dist/_chunks/GraphvizLayoter.d.mts
1300
+ //#region src/graphviz/types.d.ts
1301
+ /**
1302
+ * Partially implements CancellationToken interface from vscode-jsonrpc
1303
+ */
1304
+ type CancellationToken = {
1305
+ /**
1306
+ * Is `true` when the token has been cancelled, `false` otherwise.
1307
+ */
1308
+ readonly isCancellationRequested: boolean;
1309
+ };
1310
+ declare module 'ts-graphviz' {
1311
+ namespace GraphAttributeKey {
1312
+ interface $values extends $keywords<'likec4_viewId'> {}
1313
+ }
1314
+ namespace ClusterSubgraphAttributeKey {
1315
+ interface $values extends $keywords<'likec4_type' | 'likec4_path' | 'likec4_id' | 'likec4_level' | 'likec4_depth'> {}
1316
+ }
1317
+ namespace NodeAttributeKey {
1318
+ interface $values extends $keywords<'likec4_type' | 'likec4_path' | 'likec4_id' | 'likec4_project' | 'likec4_level'> {}
1319
+ }
1320
+ namespace EdgeAttributeKey {
1321
+ interface $values extends $keywords<'likec4_id' | 'likec4_project'> {}
1322
+ }
1323
+ namespace Attribute {
1324
+ interface $keys extends $keywords<'likec4_viewId' | 'likec4_type' | 'likec4_path' | 'likec4_id' | 'likec4_project' | 'likec4_level' | 'likec4_depth'> {}
1325
+ interface $types {
1326
+ likec4_viewId: string;
1327
+ likec4_type: 'folder' | 'file' | 'view';
1328
+ likec4_path: string;
1329
+ likec4_id: string;
1330
+ likec4_project: string;
1331
+ likec4_level: number;
1332
+ likec4_depth: number;
1333
+ }
1334
+ }
1335
+ }
1336
+ type DotSource = Tagged<string, 'DotSource'>; //#endregion
1337
+ //#region src/graphviz/types-dot.d.ts
1338
+ type GvNodeName = Tagged<string, 'GvNodeName'>;
1339
+ type GvId = Tagged<number, 'GvId'>;
1340
+ type Point = [x: number, y: number];
1341
+ interface GraphvizJson {
1342
+ name: GvNodeName;
1343
+ directed: boolean;
1344
+ strict: boolean;
1345
+ _draw_: GraphvizJson.Draw[];
1346
+ bb: string;
1347
+ compound: string;
1348
+ fontname: string;
1349
+ fontsize: string;
1350
+ label: string;
1351
+ nodesep: string;
1352
+ outputorder: string;
1353
+ rankdir: string;
1354
+ ranksep: string;
1355
+ splines: string;
1356
+ xdotversion: string;
1357
+ _subgraph_cnt: number;
1358
+ objects?: GraphvizJson.GvObject[];
1359
+ edges?: GraphvizJson.Edge[];
1360
+ }
1361
+ declare namespace GraphvizJson {
1362
+ interface Draw {
1363
+ op: string;
1364
+ grad: string;
1365
+ color: string;
1366
+ points: Point[];
1367
+ }
1368
+ interface Draw2 {
1369
+ op: string;
1370
+ grad: string;
1371
+ color: string;
1372
+ points: Point[];
1373
+ }
1374
+ namespace DrawOps {
1375
+ type Style = {
1376
+ op: 'S';
1377
+ style: string;
1378
+ };
1379
+ type BSpline = {
1380
+ op: 'b' | 'B';
1381
+ points: Point[];
1382
+ };
1383
+ type Color = {
1384
+ op: 'c';
1385
+ grad: string;
1386
+ color: string;
1387
+ };
1388
+ type Polygon = {
1389
+ op: 'p' | 'P';
1390
+ points: Point[];
1391
+ };
1392
+ }
1393
+ type DrawOp = DrawOps.Style | DrawOps.BSpline | DrawOps.Color | DrawOps.Polygon;
1394
+ type LabelDrawOps = {
1395
+ op: 'F';
1396
+ size: number;
1397
+ face: string;
1398
+ } | {
1399
+ op: 'c';
1400
+ color: string;
1401
+ } | {
1402
+ op: 't';
1403
+ fontchar: number;
1404
+ } | {
1405
+ op: 'T';
1406
+ pt: Point;
1407
+ align: 'l' | 'r' | 'c';
1408
+ width: number;
1409
+ text: string;
1410
+ };
1411
+ type GvObject = GvNodeObject | GvSubgraph;
1412
+ interface GvSubgraph {
1413
+ bb: string;
1414
+ label?: string;
1415
+ compound: 'true';
1416
+ _ldraw_?: LabelDrawOps[];
1417
+ likec4_type?: 'folder' | 'file';
1418
+ likec4_path?: string;
1419
+ likec4_id?: Fqn$1;
1420
+ likec4_level?: number;
1421
+ likec4_depth?: number;
1422
+ _gvid: GvId;
1423
+ subgraphs?: GvId[];
1424
+ nodes?: GvId[];
1425
+ edges?: GvId[];
1426
+ }
1427
+ interface GvNodeObject {
1428
+ _draw_: Draw[];
1429
+ _ldraw_?: LabelDrawOps[];
1430
+ likec4_type?: 'folder' | 'file' | 'view';
1431
+ likec4_path?: string;
1432
+ likec4_id?: Fqn$1;
1433
+ likec4_level?: number;
1434
+ _gvid: GvId;
1435
+ height: string;
1436
+ pos: string;
1437
+ shape: 'rect';
1438
+ width: string;
1439
+ label?: string;
1440
+ }
1441
+ interface Draw3 {
1442
+ op: string;
1443
+ grad: string;
1444
+ color: string;
1445
+ points: Point[];
1446
+ }
1447
+ interface Hdraw {
1448
+ op: string;
1449
+ style: string;
1450
+ grad: string;
1451
+ color: string;
1452
+ points: Point[];
1453
+ }
1454
+ interface Edge {
1455
+ _gvid: GvId;
1456
+ tail: GvId;
1457
+ head: GvId;
1458
+ dir?: 'forward' | 'back' | 'both' | 'none';
1459
+ _draw_: DrawOp[];
1460
+ _hdraw_?: DrawOp[];
1461
+ _tdraw_?: DrawOp[];
1462
+ _ldraw_?: LabelDrawOps[];
1463
+ _tldraw_?: LabelDrawOps[];
1464
+ _hldraw_?: LabelDrawOps[];
1465
+ fontname: string;
1466
+ fontsize: string;
1467
+ likec4_id?: EdgeId$1;
1468
+ label: string;
1469
+ lp: string;
1470
+ nojustify?: 'true' | 'false';
1471
+ pos?: string;
1472
+ }
1473
+ } //#endregion
1474
+ //#region src/graphviz/GraphvizLayoter.d.ts
1475
+ interface GraphvizPort extends Disposable {
1476
+ get name(): string;
1477
+ get concurrency(): number;
1478
+ unflatten(dot: DotSource): Promise<DotSource>;
1479
+ acyclic(dot: DotSource): Promise<DotSource>;
1480
+ layoutJson(dot: DotSource): Promise<string>;
1481
+ svg(dot: DotSource): Promise<string>;
1482
+ dispose(): void;
1483
+ }
1484
+ type LayoutTaskParams<A extends aux$1.Any = aux$1.Any> = {
1485
+ view: ComputedView<A>;
1486
+ styles: LikeC4Styles$1;
1487
+ };
1488
+ type LayoutResult<A extends aux$1.Any = aux$1.Any> = {
1489
+ dot: DotSource;
1490
+ diagram: DiagramView<A>;
1491
+ };
1492
+ declare class GraphvizLayouter implements Disposable {
1493
+ private graphviz;
1494
+ constructor(graphviz?: GraphvizPort);
1495
+ dispose(): void;
1496
+ [Symbol.dispose](): void;
1497
+ get graphvizPort(): GraphvizPort;
1498
+ changePort(graphviz: GraphvizPort): void;
1499
+ /**
1500
+ * Generates DOT source for the given view and styles.
1501
+ * If `hints` are provided, they will be used to influence the layout (e.g. by specifying node/edge order).
1502
+ * This method does not perform unflattening or any other post-processing on the DOT output, so it may be used for debugging or to generate DOT for external processing.
1503
+ */
1504
+ printToDot(params: LayoutTaskParams, hints?: AILayoutHints): DotSource;
1505
+ protected newScopedLogger(operation: string): any;
1506
+ dotToJson(dot: DotSource): Promise<GraphvizJson>;
1507
+ layout<A extends AnyAux>(params: LayoutTaskParams<A>): Promise<LayoutResult<A>>;
1508
+ aiLayout<A extends AnyAux>({
1509
+ view,
1510
+ styles
1511
+ }: LayoutTaskParams<A>, hints: AILayoutHints): Promise<LayoutResult<A>>;
1512
+ svg<A extends AnyAux>(params: LayoutTaskParams<A>): Promise<{
1513
+ svg: string;
1514
+ dot: DotSource;
1515
+ }>;
1516
+ dot<A extends AnyAux>(params: LayoutTaskParams<A>): Promise<DotSource>;
1517
+ layoutProjectsView(view: ComputedProjectsView): Promise<LayoutedProjectsView>;
1518
+ } //#endregion
1519
+ //#endregion
1520
+ //#region ../layouts/dist/index.d.mts
1521
+ //#region src/graphviz/QueueGraphvizLayoter.d.ts
1522
+ declare class QueueGraphvizLayoter extends GraphvizLayouter {
1523
+ private queue;
1524
+ private isProcessingBatch;
1525
+ constructor(options?: {
1526
+ graphviz?: GraphvizPort;
1527
+ /**
1528
+ * Concurrency limit.
1529
+ * Minimum: `1`.
1530
+ * @default 2
1531
+ */
1532
+ concurrency?: number;
1533
+ /**
1534
+ * Per-operation timeout in milliseconds. Operations fulfill once `timeout` elapses if they haven't already.
1535
+ * @default 20_000
1536
+ */
1537
+ timeout?: number;
1538
+ /**
1539
+ * Whether or not a timeout is considered an exception.
1540
+ * @default true
1541
+ */
1542
+ throwOnTimeout?: boolean;
1543
+ });
1544
+ private runInQueue;
1545
+ changePort(graphvizPort: GraphvizPort): void;
1546
+ layout<A extends AnyAux>(params: LayoutTaskParams<A>): Promise<LayoutResult<A>>;
1547
+ layoutProjectsView(view: ComputedProjectsView): Promise<LayoutedProjectsView>;
1548
+ batchLayout<A extends AnyAux>(params: {
1549
+ batch: LayoutTaskParams<A>[];
1550
+ cancelToken?: CancellationToken | undefined;
1551
+ onSuccess?: (task: LayoutTaskParams<A>, result: LayoutResult<A>) => void;
1552
+ onError?: (task: LayoutTaskParams<A>, error: unknown) => void;
1553
+ }): Promise<LayoutResult<A>[]>;
1554
+ /**
1555
+ * Custom backpressure
1556
+ * (basically allow same amount of tasks to be in queue as concurrency)
1557
+ */
1558
+ private waitForQueueToShrink;
1559
+ dispose(): void;
1560
+ } //#endregion
1561
+ //#region src/graphviz/wasm/GraphvizWasmAdapter.d.ts
1562
+ //#endregion
1563
+ //#region ../language-server/dist/_chunks/module.d.mts
1564
+ //#region src/documentation/documentation-provider.d.ts
1565
+ /**
1566
+ * Provides documentation for LikeC4 AST nodes, extending JSDoc parsing
1567
+ * with specialized formatting for deployment nodes, deployed instances, and elements.
1568
+ */
1569
+ declare class LikeC4DocumentationProvider extends JSDocDocumentationProvider {
1570
+ private parser;
1571
+ private locator;
1572
+ /**
1573
+ * Creates a new documentation provider.
1574
+ * @param services - The LikeC4 language services.
1575
+ */
1576
+ constructor(services: LikeC4Services);
1577
+ /**
1578
+ * Returns documentation for the given AST node (deployment nodes, deployed instances, elements, or JSDoc fallback).
1579
+ * @param node - The AST node to document.
1580
+ * @returns Formatted documentation string, or undefined if none.
1581
+ */
1582
+ getDocumentation(node: AstNode): string | undefined;
1583
+ } //#endregion
1584
+ //#region src/utils/disposable.d.ts
1585
+ declare abstract class ADisposable implements Disposable$1 {
1586
+ protected toDispose: Disposable$1[];
1587
+ protected isDisposed: boolean;
1588
+ onDispose(...disposable: Disposable$1[]): void;
1589
+ dispose(): void;
1590
+ protected throwIfDisposed(): void;
749
1591
  } //#endregion
750
1592
  //#region src/generated/ast.d.ts
751
1593
  type AnyProperty = DynamicViewProperty | ElementProperty | NavigateToProperty | NotationProperty | NotesProperty | RelationProperty | RelationshipStyleProperty | StringProperty | StyleProperty | ViewProperty;
@@ -1029,9 +1871,9 @@ interface DynamicViewIncludePredicate extends AstNode {
1029
1871
  }
1030
1872
  declare const DynamicViewIncludePredicate = "DynamicViewIncludePredicate";
1031
1873
  interface DynamicViewParallelSteps extends AstNode {
1032
- readonly $container: DynamicViewBody;
1874
+ readonly $container: DynamicViewBody | DynamicViewParallelSteps;
1033
1875
  readonly $type: 'DynamicViewParallelSteps';
1034
- steps: Array<DynamicViewStep>;
1876
+ steps: Array<DynamicViewParallelSteps | DynamicViewStep>;
1035
1877
  }
1036
1878
  declare const DynamicViewParallelSteps = "DynamicViewParallelSteps";
1037
1879
  interface DynamicViewRef extends AstNode {
@@ -2124,95 +2966,402 @@ interface ParsedAstExtendRelation {
2124
2966
  [key: string]: string | string[];
2125
2967
  };
2126
2968
  }
2127
- interface ParsedAstRelation {
2128
- id: c4.RelationId;
2129
- astPath: string;
2130
- source: c4.FqnRef.ModelRef;
2131
- target: c4.FqnRef.ModelRef;
2132
- kind?: c4.RelationshipKind;
2133
- tags?: c4.NonEmptyArray<c4.Tag>;
2134
- title: string;
2135
- description?: c4.MarkdownOrString;
2136
- technology?: string;
2137
- color?: c4.Color;
2138
- line?: c4.RelationshipLineType;
2139
- head?: c4.RelationshipArrowType;
2140
- tail?: c4.RelationshipArrowType;
2141
- links?: c4.NonEmptyArray<c4.Link>;
2142
- navigateTo?: c4.ViewId;
2143
- metadata?: {
2144
- [key: string]: string | string[];
2145
- };
2969
+ interface ParsedAstRelation {
2970
+ id: c4.RelationId;
2971
+ astPath: string;
2972
+ source: c4.FqnRef.ModelRef;
2973
+ target: c4.FqnRef.ModelRef;
2974
+ kind?: c4.RelationshipKind;
2975
+ tags?: c4.NonEmptyArray<c4.Tag>;
2976
+ title: string;
2977
+ description?: c4.MarkdownOrString;
2978
+ technology?: string;
2979
+ color?: c4.Color;
2980
+ line?: c4.RelationshipLineType;
2981
+ head?: c4.RelationshipArrowType;
2982
+ tail?: c4.RelationshipArrowType;
2983
+ links?: c4.NonEmptyArray<c4.Link>;
2984
+ navigateTo?: c4.ViewId;
2985
+ metadata?: {
2986
+ [key: string]: string | string[];
2987
+ };
2988
+ }
2989
+ type ParsedAstDeployment = Simplify<MergeExclusive<ParsedAstDeployment.Node, ParsedAstDeployment.Instance>>;
2990
+ declare namespace ParsedAstDeployment {
2991
+ type Node = c4.DeploymentNode;
2992
+ type Instance = Omit<c4.DeployedInstance, 'element'> & {
2993
+ readonly element: c4.FqnRef.ModelRef;
2994
+ };
2995
+ }
2996
+ type ParsedAstDeploymentRelation = c4.DeploymentRelationship & {
2997
+ astPath: string;
2998
+ };
2999
+ type ParsedAstGlobals = Writable<c4.ModelGlobals>;
3000
+ interface ParsedAstElementView {
3001
+ id: c4.ViewId;
3002
+ viewOf?: c4.Fqn;
3003
+ extends?: c4.ViewId;
3004
+ astPath: string;
3005
+ title: string | null;
3006
+ description: c4.MarkdownOrString | null;
3007
+ tags: c4.NonEmptyArray<c4.Tag> | null;
3008
+ links: c4.NonEmptyArray<c4.Link> | null;
3009
+ rules: c4.ElementViewRule[];
3010
+ }
3011
+ interface ParsedAstDynamicView {
3012
+ id: c4.ViewId;
3013
+ astPath: string;
3014
+ title: string | null;
3015
+ description: c4.MarkdownOrString | null;
3016
+ tags: c4.NonEmptyArray<c4.Tag> | null;
3017
+ links: c4.NonEmptyArray<c4.Link> | null;
3018
+ steps: c4.DynamicViewStep[];
3019
+ rules: Array<c4.DynamicViewRule>;
3020
+ variant: c4.DynamicViewDisplayVariant | undefined;
3021
+ }
3022
+ interface ParsedAstDeploymentView {
3023
+ id: c4.ViewId;
3024
+ astPath: string;
3025
+ title: string | null;
3026
+ description: c4.MarkdownOrString | null;
3027
+ tags: c4.NonEmptyArray<c4.Tag> | null;
3028
+ links: c4.NonEmptyArray<c4.Link> | null;
3029
+ rules: Array<c4.DeploymentViewRule>;
3030
+ }
3031
+ type ParsedAstView = ParsedAstElementView | ParsedAstDynamicView | ParsedAstDeploymentView;
3032
+ interface AstNodeDescriptionWithFqn extends AstNodeDescription {
3033
+ likec4ProjectId: c4.ProjectId;
3034
+ id: c4.Fqn;
3035
+ }
3036
+ type LikeC4AstNode = ValueOf<ConditionalPick<LikeC4AstType, AstNode>>;
3037
+ type LikeC4DocumentDiagnostic = Diagnostic & DiagnosticInfo<LikeC4AstNode>;
3038
+ interface LikeC4DocumentProps {
3039
+ diagnostics?: Array<LikeC4DocumentDiagnostic>;
3040
+ c4Specification?: ParsedAstSpecification;
3041
+ c4Elements?: ParsedAstElement[];
3042
+ c4ExtendElements?: ParsedAstExtend[];
3043
+ c4ExtendDeployments?: ParsedAstExtend[];
3044
+ c4ExtendRelations?: ParsedAstExtendRelation[];
3045
+ c4Relations?: ParsedAstRelation[];
3046
+ c4Globals?: ParsedAstGlobals;
3047
+ c4Views?: ParsedAstView[];
3048
+ c4Deployments?: ParsedAstDeployment[];
3049
+ c4DeploymentRelations?: ParsedAstDeploymentRelation[];
3050
+ c4Imports?: MultiMap<c4.ProjectId, c4.Fqn, Set<c4.Fqn>>;
3051
+ }
3052
+ type LikeC4GrammarDocument = Omit<LangiumDocument<LikeC4Grammar>, 'diagnostics'>;
3053
+ interface LikeC4LangiumDocument extends LikeC4GrammarDocument, LikeC4DocumentProps {
3054
+ likec4ProjectId: c4.ProjectId;
3055
+ }
3056
+ interface ParsedLikeC4LangiumDocument extends LikeC4GrammarDocument, Required<LikeC4DocumentProps> {
3057
+ likec4ProjectId: c4.ProjectId;
3058
+ } //#endregion
3059
+ //#region src/workspace/ProjectsManager.d.ts
3060
+ type NormalizedUri = Tagged<string, 'NormalizedUri'>;
3061
+ type DocOrUri = LangiumDocument | string | URI;
3062
+ /**
3063
+ * A tagged string that represents a project folder URI (with trailing slash).
3064
+ * Used in `startsWith` checks to determine if a document belongs to a project.
3065
+ */
3066
+ type ProjectFolder = Tagged<string, 'ProjectFolder'>;
3067
+ declare function ProjectFolder(folder: URI | string): ProjectFolder;
3068
+ interface Project {
3069
+ id: ProjectId;
3070
+ folderUri: URI;
3071
+ config: LikeC4ProjectConfig;
3072
+ }
3073
+ interface ProjectData extends Project {
3074
+ id: ProjectId;
3075
+ folder: ProjectFolder;
3076
+ config: LikeC4ProjectConfig;
3077
+ configUri: URI;
3078
+ folderUri: URI;
3079
+ exclude?: {
3080
+ (test: string): boolean;
3081
+ };
3082
+ /**
3083
+ * Resolved include paths with both URI and folder string representations.
3084
+ * These are additional directories that are part of this project.
3085
+ */
3086
+ includePaths?: NonEmptyArray$1<{
3087
+ uri: URI;
3088
+ folder: ProjectFolder;
3089
+ }>;
3090
+ /**
3091
+ * Normalized include configuration (paths, maxDepth, fileThreshold).
3092
+ */
3093
+ includeConfig: IncludeConfig;
3094
+ }
3095
+ type RegisterProjectOptions = {
3096
+ config: LikeC4ProjectConfig | LikeC4ProjectConfigInput;
3097
+ } & ({
3098
+ configUri: URI | string;
3099
+ } | {
3100
+ folderUri: URI | string;
3101
+ });
3102
+ declare class ProjectsManager extends ADisposable {
3103
+ #private;
3104
+ protected services: LikeC4SharedServices;
3105
+ /**
3106
+ * The global project ID used for all documents
3107
+ * that are not part of a specific project.
3108
+ */
3109
+ static readonly DefaultProjectId: ProjectId;
3110
+ constructor(services: LikeC4SharedServices);
3111
+ /**
3112
+ * Checks if a document is excluded by workspace-level patterns.
3113
+ * These patterns come from VS Code settings and take precedence over project-level excludes.
3114
+ */
3115
+ isExcludedByWorkspace(uri: NormalizedUri | URI): boolean;
3116
+ /**
3117
+ * Updates the workspace-level exclude patterns from VS Code settings.
3118
+ * Called during initial server startup; dynamic changes restart the server.
3119
+ */
3120
+ setWorkspaceExcludePatterns(patterns: string[] | undefined): void;
3121
+ /**
3122
+ * Returns:
3123
+ * - configured default project ID if set
3124
+ * - the default project ID if there are no projects.
3125
+ * - the ID of the only project
3126
+ * - undefined if there are multiple projects.
3127
+ */
3128
+ get defaultProjectId(): ProjectId | undefined;
3129
+ set defaultProjectId(id: string | ProjectId | undefined);
3130
+ get default(): ProjectData;
3131
+ get all(): NonEmptyReadonlyArray$1<ProjectId>;
3132
+ getProject(arg: ProjectId | LangiumDocument): ProjectData;
3133
+ /**
3134
+ * Returns all projects that overlap with the specified folder (is parent or child)
3135
+ */
3136
+ findOverlaped(folder: URI | string): ReadonlyArray<ProjectData>;
3137
+ /**
3138
+ * Validates and ensures the project ID.
3139
+ * If no project ID is specified, returns default project ID
3140
+ * If there are multiple projects and default project is not set, throws an error
3141
+ */
3142
+ ensureProjectId(projectId?: ProjectId | undefined): ProjectId;
3143
+ /**
3144
+ * Validates and ensures the project data.
3145
+ * If projectId is not specified, returns default project
3146
+ *
3147
+ * If there are multiple projects and default project is not set, throws an error
3148
+ *
3149
+ * @see ensureProjectId - to validate project ID only
3150
+ */
3151
+ ensureProject(projectId?: ProjectId | undefined): ProjectData;
3152
+ hasMultipleProjects(): boolean;
3153
+ /**
3154
+ * Checks if given document (or URI) must be excluded from processing.
3155
+ */
3156
+ isExcluded(document: DocOrUri): boolean;
3157
+ /**
3158
+ * Checks if given document (or URI) must be excluded in the context of the project.
3159
+ */
3160
+ isExcluded(projectId: ProjectId, document: DocOrUri): boolean;
3161
+ /**
3162
+ * Checks if the specified document is included by the project:
3163
+ * - if the document belongs to the project and is not excluded
3164
+ * - if the document is included by the project
3165
+ */
3166
+ isIncluded(projectId: ProjectId, document: LangiumDocument | URI | string): boolean;
3167
+ /**
3168
+ * Registers likec4 project by config file.
3169
+ */
3170
+ registerConfigFile(configUri: URI, cancelToken?: CancellationToken$1): Promise<ProjectData>;
3171
+ /**
3172
+ * Registers (or reloads) likec4 project by config file or config object.
3173
+ * If there is some project registered at same folder, it will be reloaded.
3174
+ */
3175
+ registerProject(opts: RegisterProjectOptions, cancelToken?: CancellationToken$1): Promise<ProjectData>;
3176
+ /**
3177
+ * Determines which project the given document belongs to.
3178
+ * If the document does not belong to any project, returns the default project ID.
3179
+ */
3180
+ ownerProjectId(document: LangiumDocument | URI | string): ProjectId;
3181
+ /**
3182
+ * Returns path to the document relative to the project folder.
3183
+ * If the document does not belong to any project, returns the document URI as string.
3184
+ */
3185
+ relativePath(document: LangiumDocument | URI | string): string;
3186
+ /**
3187
+ * Returns true if the manager is currently initializing or reloading projects.
3188
+ * This is used to prevent duplicate reload operations.
3189
+ */
3190
+ protected get isInitiatingOrReloading(): boolean;
3191
+ reloadProjects(cancelToken?: CancellationToken$1): Promise<void>;
3192
+ protected _reloadProjects(cancelToken?: CancellationToken$1): Promise<void>;
3193
+ protected uniqueProjectId(name: string): ProjectId;
3194
+ protected resetCaches(): void;
3195
+ rebuildProject(projectId: ProjectId, cancelToken?: CancellationToken$1): Promise<void>;
3196
+ /**
3197
+ * Returns all include paths from all projects.
3198
+ * Used by WorkspaceManager to scan additional directories for C4 files.
3199
+ */
3200
+ getAllIncludePaths(): Array<{
3201
+ projectId: ProjectId;
3202
+ includePath: URI;
3203
+ includeConfig: IncludeConfig;
3204
+ }>;
3205
+ /**
3206
+ * Register a listener to be called when the projects configuration has changed.
3207
+ * @returns A disposable that can be used to unregister the callback.
3208
+ */
3209
+ onProjectsUpdate(callback: () => void): Disposable$1;
3210
+ private getWorkspaceFolder;
3211
+ private notifyListeners;
3212
+ private updateIncludesExcludes;
3213
+ private warnIfConfigOverride;
3214
+ } //#endregion
3215
+ //#region src/filesystem/types.d.ts
3216
+ interface FileNode extends FileSystemNode {
3217
+ readonly isFile: true;
3218
+ readonly isDirectory: false;
3219
+ }
3220
+ interface FileSystemProvider$1 extends FileSystemProvider {
3221
+ /**
3222
+ * Scans the project files for the given URI.
3223
+ * @returns The list of file system entries that are contained within the specified directory.
3224
+ */
3225
+ scanProjectFiles(folderUri: URI): Promise<FileNode[]>;
3226
+ /**
3227
+ * Loads the project config from the given file.
3228
+ * @returns The project config.
3229
+ * @throws Error if the file does not exist or is not a valid project config.
3230
+ */
3231
+ loadProjectConfig(filepath: URI): Promise<LikeC4ProjectConfig>;
3232
+ /**
3233
+ * Reads the directory and returns LikeC4 files.
3234
+ *
3235
+ * @param options.recursive If true, recursively reads the directory,
3236
+ * @param options.maxDepth Maximum depth to traverse when recursive is true (default: Infinity)
3237
+ */
3238
+ readDirectory(uri: URI, options?: {
3239
+ recursive?: boolean;
3240
+ maxDepth?: number;
3241
+ }): Promise<FileNode[]>;
3242
+ /**
3243
+ * Finds all files in the given directory, matching the given filter.
3244
+ */
3245
+ scanDirectory(directory: URI, filter: (filepath: string, isDirectory: boolean) => boolean): Promise<FileNode[]>;
3246
+ /**
3247
+ * Writes the content to the file system.
3248
+ * Used by manual layouts.
3249
+ */
3250
+ writeFile(uri: URI, content: string): Promise<void>;
3251
+ /**
3252
+ * Deletes the file from the file system.
3253
+ * Used by manual layouts.
3254
+ * @return true if the file was deleted, false if the file did not exist.
3255
+ */
3256
+ deleteFile(uri: URI): Promise<boolean>;
2146
3257
  }
2147
- type ParsedAstDeployment = Simplify<MergeExclusive<ParsedAstDeployment.Node, ParsedAstDeployment.Instance>>;
2148
- declare namespace ParsedAstDeployment {
2149
- type Node = c4.DeploymentNode;
2150
- type Instance = Omit<c4.DeployedInstance, 'element'> & {
2151
- readonly element: c4.FqnRef.ModelRef;
2152
- };
3258
+ interface FileSystemWatcher extends AsyncDisposable {
3259
+ /**
3260
+ * Watches a folder for changes and triggers a reload of the documents and projects.
3261
+ */
3262
+ watch(folder: string): void;
2153
3263
  }
2154
- type ParsedAstDeploymentRelation = c4.DeploymentRelationship & {
2155
- astPath: string;
3264
+ type ManualLayoutsSnapshot = {
3265
+ hash: string;
3266
+ views: Record<ViewId, LayoutedView>;
2156
3267
  };
2157
- type ParsedAstGlobals = Writable<c4.ModelGlobals>;
2158
- interface ParsedAstElementView {
2159
- id: c4.ViewId;
2160
- viewOf?: c4.Fqn;
2161
- extends?: c4.ViewId;
2162
- astPath: string;
2163
- title: string | null;
2164
- description: c4.MarkdownOrString | null;
2165
- tags: c4.NonEmptyArray<c4.Tag> | null;
2166
- links: c4.NonEmptyArray<c4.Link> | null;
2167
- rules: c4.ElementViewRule[];
2168
- }
2169
- interface ParsedAstDynamicView {
2170
- id: c4.ViewId;
2171
- astPath: string;
2172
- title: string | null;
2173
- description: c4.MarkdownOrString | null;
2174
- tags: c4.NonEmptyArray<c4.Tag> | null;
2175
- links: c4.NonEmptyArray<c4.Link> | null;
2176
- steps: c4.DynamicViewStep[];
2177
- rules: Array<c4.DynamicViewRule>;
2178
- variant: c4.DynamicViewDisplayVariant | undefined;
2179
- }
2180
- interface ParsedAstDeploymentView {
2181
- id: c4.ViewId;
2182
- astPath: string;
2183
- title: string | null;
2184
- description: c4.MarkdownOrString | null;
2185
- tags: c4.NonEmptyArray<c4.Tag> | null;
2186
- links: c4.NonEmptyArray<c4.Link> | null;
2187
- rules: Array<c4.DeploymentViewRule>;
2188
- }
2189
- type ParsedAstView = ParsedAstElementView | ParsedAstDynamicView | ParsedAstDeploymentView;
2190
- interface AstNodeDescriptionWithFqn extends AstNodeDescription {
2191
- likec4ProjectId: c4.ProjectId;
2192
- id: c4.Fqn;
2193
- }
2194
- type LikeC4AstNode = ValueOf<ConditionalPick<LikeC4AstType, AstNode>>;
2195
- type LikeC4DocumentDiagnostic = Diagnostic & DiagnosticInfo<LikeC4AstNode>;
2196
- interface LikeC4DocumentProps {
2197
- diagnostics?: Array<LikeC4DocumentDiagnostic>;
2198
- c4Specification?: ParsedAstSpecification;
2199
- c4Elements?: ParsedAstElement[];
2200
- c4ExtendElements?: ParsedAstExtend[];
2201
- c4ExtendDeployments?: ParsedAstExtend[];
2202
- c4ExtendRelations?: ParsedAstExtendRelation[];
2203
- c4Relations?: ParsedAstRelation[];
2204
- c4Globals?: ParsedAstGlobals;
2205
- c4Views?: ParsedAstView[];
2206
- c4Deployments?: ParsedAstDeployment[];
2207
- c4DeploymentRelations?: ParsedAstDeploymentRelation[];
2208
- c4Imports?: MultiMap<c4.ProjectId, c4.Fqn, Set<c4.Fqn>>;
3268
+ type ManualLayoutUpdateEvent = {
3269
+ updated: URI;
3270
+ projectId: ProjectId;
3271
+ viewId: ViewId;
3272
+ } | {
3273
+ removed: URI;
3274
+ projectId: ProjectId;
3275
+ /**
3276
+ * Missing if triggered by FS event (file was deleted)
3277
+ */
3278
+ viewId?: ViewId;
3279
+ };
3280
+ type ManualLayoutUpdateListener = (event: ManualLayoutUpdateEvent) => void;
3281
+ interface LikeC4ManualLayouts extends Disposable$1 {
3282
+ /**
3283
+ * Reads a single layouted view from the file system by its URI.
3284
+ * Used by the language server to get the current layout state.
3285
+ */
3286
+ readSnapshot(uri: URI): Promise<LayoutedView | null>;
3287
+ read(project: Project): Promise<ManualLayoutsSnapshot | null>;
3288
+ write(project: Project, layouted: LayoutedView): Promise<Location>;
3289
+ remove(project: Project, view: ViewId): Promise<Location | null>;
3290
+ clearCaches(): void;
3291
+ /**
3292
+ * Registers a listener for manual layout updates.
3293
+ * The listener will be called when a manual layout is created, updated, or deleted.
3294
+ */
3295
+ onManualLayoutUpdate(listener: ManualLayoutUpdateListener): Disposable$1;
3296
+ /**
3297
+ * Handles file system updates for manual layouts.
3298
+ * Used by the file system watcher to notify the manual layouts module of changes.
3299
+ * @param event The file system event
3300
+ */
3301
+ handleFileSystemUpdate(event: {
3302
+ update: URI;
3303
+ delete?: never;
3304
+ } | {
3305
+ delete: URI;
3306
+ update?: never;
3307
+ }): Promise<void>;
3308
+ } //#endregion
3309
+ //#region src/filesystem/noop.d.ts
3310
+ //#endregion
3311
+ //#region src/formatting/LikeC4Formatter.d.ts
3312
+ type QuoteStyle = 'single' | 'double' | 'ignore' | 'auto';
3313
+ interface LikeC4FormatterOptions {
3314
+ quoteStyle: QuoteStyle;
2209
3315
  }
2210
- type LikeC4GrammarDocument = Omit<LangiumDocument<LikeC4Grammar>, 'diagnostics'>;
2211
- interface LikeC4LangiumDocument extends LikeC4GrammarDocument, LikeC4DocumentProps {
2212
- likec4ProjectId: c4.ProjectId;
3316
+ type ExtendedFormattingCommandType = 'normalizeQuotes';
3317
+ interface ExtendedFormattingCommand {
3318
+ type: ExtendedFormattingCommandType;
3319
+ region: FormattingRegion;
2213
3320
  }
2214
- interface ParsedLikeC4LangiumDocument extends LikeC4GrammarDocument, Required<LikeC4DocumentProps> {
2215
- likec4ProjectId: c4.ProjectId;
3321
+ declare class LikeC4Formatter extends AbstractFormatter {
3322
+ protected options: LikeC4FormatterOptions;
3323
+ extendedFormattingCommands: ExtendedFormattingCommand[];
3324
+ constructor(services: LikeC4Services);
3325
+ protected doDocumentFormat(document: LangiumDocument, options: FormattingOptions, range?: Range): TextEdit[];
3326
+ protected format(node: AstNode): void;
3327
+ protected formatTags(node: AstNode): void;
3328
+ protected formatDeploymentRelation(node: AstNode): void;
3329
+ protected formatExtendDeployment(node: AstNode): void;
3330
+ protected formatRelation(node: AstNode): void;
3331
+ protected removeIndentFromTopLevelStatements(node: AstNode): void;
3332
+ protected indentContentInBraces(node: AstNode): void;
3333
+ protected appendKeywordsWithSpace(node: AstNode): void;
3334
+ protected formatView(node: AstNode): void;
3335
+ protected formatLeafProperty(node: AstNode): void;
3336
+ protected formatLinkProperty(node: AstNode): void;
3337
+ protected formatNavigateToProperty(node: AstNode): void;
3338
+ protected formatAutolayoutProperty(node: AstNode): void;
3339
+ protected formatMetadataProperty(node: AstNode): void;
3340
+ protected formatElementDeclaration(node: AstNode): void;
3341
+ protected formatExtendElement(node: AstNode): void;
3342
+ protected formatGlobals(node: AstNode): void;
3343
+ protected formatImports(node: AstNode): void;
3344
+ protected formatSpecificationRule(node: AstNode): void;
3345
+ protected formatWithPredicate(node: AstNode): void;
3346
+ protected formatDeploymentNodeDeclaration(node: AstNode): void;
3347
+ protected formatDeployedInstance(node: AstNode): void;
3348
+ protected formatViewRuleGlobalStyle(node: AstNode): void;
3349
+ protected formatViewRuleGlobalPredicate(node: AstNode): void;
3350
+ protected formatViewRuleGroup(node: AstNode): void;
3351
+ protected formatViewRuleStyle(node: AstNode): void;
3352
+ protected formatWhereExpression(node: AstNode): void;
3353
+ protected formatWhereRelationExpression(node: AstNode): void;
3354
+ protected formatWhereElementExpression(node: AstNode): void;
3355
+ protected formatIncludeExcludeExpressions(node: AstNode): void;
3356
+ protected formatRelationExpression(node: AstNode): void;
3357
+ private findPredicateExpressionRoot;
3358
+ private on;
3359
+ private doExtendedFormatting;
3360
+ protected normalizeQuotes(node: AstNode): void;
3361
+ private quotesNormalizerFactory;
3362
+ private escapeQuotesInternalQuotes;
3363
+ private getAutoQuoteStyle;
3364
+ private onConfigurationUpdate;
2216
3365
  } //#endregion
2217
3366
  //#region src/references/name-provider.d.ts
2218
3367
  declare class LikeC4NameProvider extends DefaultNameProvider {
@@ -2362,14 +3511,6 @@ declare class LikeC4ScopeProvider extends DefaultScopeProvider {
2362
3511
  */
2363
3512
  protected getGlobalScope(referenceType: string, context: ReferenceInfo): Scope;
2364
3513
  } //#endregion
2365
- //#region src/utils/disposable.d.ts
2366
- declare abstract class ADisposable implements Disposable$1 {
2367
- protected toDispose: Disposable$1[];
2368
- protected isDisposed: boolean;
2369
- onDispose(...disposable: Disposable$1[]): void;
2370
- dispose(): void;
2371
- protected throwIfDisposed(): void;
2372
- } //#endregion
2373
3514
  //#region src/model/fqn-index.d.ts
2374
3515
  declare class FqnIndex<AstNd = Element> extends ADisposable {
2375
3516
  protected services: LikeC4Services;
@@ -2503,7 +3644,7 @@ declare class MergedSpecification {
2503
3644
  * Provides access to "last seen artifacts" for a given project,
2504
3645
  * (Results of the last successful parsing)
2505
3646
  */
2506
- declare class LastSeenArtifacts {
3647
+ declare class LastSeenArtifacts extends ADisposable {
2507
3648
  #private;
2508
3649
  constructor(services: LikeC4Services);
2509
3650
  /**
@@ -2638,7 +3779,7 @@ type LayoutViewParams = {
2638
3779
  cancelToken?: CancellationToken$1 | undefined; /** Optional AI-generated layout hints */
2639
3780
  layoutHints?: AILayoutHints | undefined;
2640
3781
  };
2641
- interface LikeC4Views {
3782
+ interface LikeC4Views extends Disposable$1 {
2642
3783
  readonly layouter: GraphvizLayouter;
2643
3784
  /**
2644
3785
  * Returns computed views (i.e. views with predicates computed)
@@ -3417,7 +4558,7 @@ declare const DocumentParserFromMixins: {
3417
4558
  };
3418
4559
  } & typeof BaseParser;
3419
4560
  declare class DocumentParser extends DocumentParserFromMixins {}
3420
- declare class LikeC4ModelParser {
4561
+ declare class LikeC4ModelParser extends ADisposable {
3421
4562
  private services;
3422
4563
  protected cachedParsers: any;
3423
4564
  constructor(services: LikeC4Services);
@@ -3767,15 +4908,15 @@ declare class LikeC4 {
3767
4908
  /**
3768
4909
  * File system path to the workspace root
3769
4910
  */
3770
- get workspace(): any;
4911
+ get workspace(): string;
3771
4912
  /**
3772
4913
  * URI of the workspace root
3773
4914
  */
3774
- get workspaceURI(): any;
4915
+ get workspaceURI(): URI;
3775
4916
  /**
3776
4917
  * URL of the workspace root
3777
4918
  */
3778
- get workspaceURL(): any;
4919
+ get workspaceURL(): URL;
3779
4920
  get languageServices(): LikeC4LanguageServices;
3780
4921
  get projectsManager(): ProjectsManager;
3781
4922
  get viewsService(): LikeC4Views;
@@ -3834,9 +4975,11 @@ declare class LikeC4 {
3834
4975
  */
3835
4976
  documentCount(): number;
3836
4977
  /**
3837
- * @returns a function to dispose the listener
4978
+ * Subscribe to model updates
4979
+ * @param listener Function called when the model is updated - receives the project ID that was updated
4980
+ * @returns A function to dispose the listener
3838
4981
  */
3839
- onModelUpdate(listener: () => void): () => void;
4982
+ onModelUpdate(listener: (projectId: ProjectId) => void): () => void;
3840
4983
  /**
3841
4984
  * Formats documents and returns a map of document URI → formatted source text.
3842
4985
  *