@likec4/language-server 1.13.0 → 1.15.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 (48) hide show
  1. package/contrib/likec4.tmLanguage.json +1 -1
  2. package/dist/browser.cjs +1 -1
  3. package/dist/browser.d.cts +2 -2
  4. package/dist/browser.d.mts +2 -2
  5. package/dist/browser.d.ts +2 -2
  6. package/dist/browser.mjs +2 -2
  7. package/dist/index.cjs +1 -1
  8. package/dist/index.d.cts +2 -2
  9. package/dist/index.d.mts +2 -2
  10. package/dist/index.d.ts +2 -2
  11. package/dist/index.mjs +2 -2
  12. package/dist/likec4lib.cjs +0 -1
  13. package/dist/likec4lib.mjs +0 -1
  14. package/dist/model-graph/index.cjs +1 -1
  15. package/dist/model-graph/index.mjs +1 -1
  16. package/dist/shared/{language-server.CbDa016p.cjs → language-server.80ITEDo5.cjs} +272 -64
  17. package/dist/shared/{language-server.C2ebP2pZ.cjs → language-server.BUtiWTKg.cjs} +383 -32
  18. package/dist/shared/{language-server.DFLaUdYu.mjs → language-server.DXC9g4_f.mjs} +274 -66
  19. package/dist/shared/{language-server.ryB8CivX.d.mts → language-server.DfMwkd2l.d.mts} +81 -15
  20. package/dist/shared/{language-server.Cnq_hgfm.d.cts → language-server.U2piOAVt.d.cts} +81 -15
  21. package/dist/shared/{language-server.eY70DuKx.d.ts → language-server.j-ShR6as.d.ts} +81 -15
  22. package/dist/shared/{language-server.CrE0nFSB.mjs → language-server.zY53FGJE.mjs} +385 -34
  23. package/package.json +12 -12
  24. package/src/ast.ts +11 -0
  25. package/src/generated/ast.ts +177 -17
  26. package/src/generated/grammar.ts +1 -1
  27. package/src/generated-lib/icons.ts +0 -1
  28. package/src/like-c4.langium +50 -4
  29. package/src/lsp/CompletionProvider.ts +70 -2
  30. package/src/model/model-builder.ts +25 -3
  31. package/src/model/model-parser.ts +150 -33
  32. package/src/model-graph/compute-view/__test__/fixture.ts +45 -4
  33. package/src/model-graph/compute-view/compute.ts +223 -40
  34. package/src/model-graph/compute-view/predicates.ts +12 -6
  35. package/src/model-graph/utils/applyCustomElementProperties.ts +18 -4
  36. package/src/model-graph/utils/applyCustomRelationProperties.ts +2 -1
  37. package/src/model-graph/utils/applyViewRuleStyles.ts +30 -25
  38. package/src/model-graph/utils/buildComputeNodes.ts +69 -17
  39. package/src/model-graph/utils/elementExpressionToPredicate.ts +3 -1
  40. package/src/model-graph/utils/sortNodes.ts +11 -7
  41. package/src/references/scope-computation.ts +24 -1
  42. package/src/validation/index.ts +4 -0
  43. package/src/validation/specification.ts +30 -0
  44. package/src/view-utils/index.ts +1 -0
  45. package/src/view-utils/resolve-global-rules.ts +72 -0
  46. package/dist/shared/language-server.B-9_mDoo.d.mts +0 -1238
  47. package/dist/shared/language-server.C3oS5yhF.d.cts +0 -1238
  48. package/dist/shared/language-server.r5AXAWzc.d.ts +0 -1238
@@ -1,1238 +0,0 @@
1
- import { LangiumDocument, GrammarAST, MaybePromise, ReferenceDescription, AstNode, Reference, MultiMap, AstNodeDescription, DiagnosticInfo, LangiumDocuments, Stream, Cancellation, Disposable, URI, DefaultScopeComputation, PrecomputedScopes, DefaultScopeProvider, ReferenceInfo, Scope, DefaultWorkspaceManager, WorkspaceCache, Module } from 'langium';
2
- import { CodeLensProvider, DefaultCompletionProvider, CompletionContext, CompletionAcceptor, DefaultDocumentHighlightProvider, DocumentLinkProvider, DocumentSymbolProvider, NodeKindProvider as NodeKindProvider$1, AstNodeHoverProvider, AbstractSemanticTokenProvider, SemanticTokenAcceptor, LangiumSharedServices, DefaultWorkspaceSymbolProvider, LangiumServices, PartialLangiumServices, DefaultSharedModuleContext } from 'langium/lsp';
3
- import { CodeLensParams, CancellationToken, CodeLens, DocumentHighlight, DocumentLinkParams, DocumentLink, WorkspaceFolder } from 'vscode-languageserver';
4
- import { Diagnostic, DocumentSymbol, SymbolKind, Hover, Location, Range, TextEdit, CompletionItemKind } from 'vscode-languageserver-types';
5
- import * as c4 from '@likec4/core';
6
- import { Fqn, ViewID } from '@likec4/core';
7
- import { SetRequired, ValueOf, ConditionalPick } from 'type-fest';
8
- import { ChangeViewRequestParams } from '../protocol.js';
9
- import { URI as URI$1 } from 'vscode-uri';
10
- import * as _likec4_log from '@likec4/log';
11
- import { LogLevels } from '@likec4/log';
12
-
13
- declare class LikeC4CodeLensProvider implements CodeLensProvider {
14
- private services;
15
- constructor(services: LikeC4Services);
16
- provideCodeLens(doc: LangiumDocument, _params: CodeLensParams, cancelToken?: CancellationToken): Promise<CodeLens[] | undefined>;
17
- }
18
-
19
- declare class LikeC4CompletionProvider extends DefaultCompletionProvider {
20
- readonly completionOptions: {
21
- triggerCharacters: string[];
22
- };
23
- protected completionForKeyword(context: CompletionContext, keyword: GrammarAST.Keyword, acceptor: CompletionAcceptor): MaybePromise<void>;
24
- }
25
-
26
- declare class LikeC4DocumentHighlightProvider extends DefaultDocumentHighlightProvider {
27
- /**
28
- * Override this method to determine the highlight kind of the given reference.
29
- */
30
- protected createDocumentHighlight(reference: ReferenceDescription): DocumentHighlight;
31
- }
32
-
33
- declare class LikeC4DocumentLinkProvider implements DocumentLinkProvider {
34
- private services;
35
- constructor(services: LikeC4Services);
36
- getDocumentLinks(doc: LangiumDocument, _params: DocumentLinkParams): MaybePromise<DocumentLink[]>;
37
- resolveLink(doc: LangiumDocument, link: string): string;
38
- relativeLink(doc: LangiumDocument, link: string): string | null;
39
- }
40
-
41
- /******************************************************************************
42
- * This file was generated by langium-cli 3.2.0.
43
- * DO NOT EDIT MANUALLY!
44
- ******************************************************************************/
45
-
46
- type ArrowType = 'crow' | 'diamond' | 'dot' | 'none' | 'normal' | 'odiamond' | 'odot' | 'onormal' | 'open' | 'vee';
47
- type BorderStyleValue = 'none' | LineOptions;
48
- type CustomColorId = 'element' | 'model' | ArrowType | ElementShape | LineOptions | string;
49
- type CustomColorValue = string;
50
- type DynamicViewRule = DynamicViewIncludePredicate | ViewRuleAutoLayout | ViewRuleStyle;
51
- declare const DynamicViewRule = "DynamicViewRule";
52
- declare function isDynamicViewRule(item: unknown): item is DynamicViewRule;
53
- type ElementExpression = ElementDescedantsExpression | ElementKindExpression | ElementRef | ElementTagExpression | ExpandElementExpression | WildcardExpression;
54
- declare const ElementExpression = "ElementExpression";
55
- declare function isElementExpression(item: unknown): item is ElementExpression;
56
- type ElementPredicate = ElementPredicateOrWhere | ElementPredicateWith;
57
- declare const ElementPredicate = "ElementPredicate";
58
- type ElementPredicateOrWhere = ElementExpression | ElementPredicateWhere;
59
- declare const ElementPredicateOrWhere = "ElementPredicateOrWhere";
60
- type ElementProperty = ElementStringProperty | ElementStyleProperty | IconProperty | LinkProperty | MetadataProperty;
61
- declare const ElementProperty = "ElementProperty";
62
- declare function isElementProperty(item: unknown): item is ElementProperty;
63
- type ElementShape = 'browser' | 'cylinder' | 'mobile' | 'person' | 'queue' | 'rectangle' | 'storage';
64
- type IconId = string;
65
- type Id = 'element' | 'model' | ArrowType | ElementShape | LineOptions | ThemeColor | string;
66
- type LikeC4View = DynamicView | ElementView;
67
- declare const LikeC4View = "LikeC4View";
68
- declare function isLikeC4View(item: unknown): item is LikeC4View;
69
- type LineOptions = 'dashed' | 'dotted' | 'solid';
70
- type MetadataProperty = MetadataBody;
71
- declare const MetadataProperty = "MetadataProperty";
72
- type Predicate = ElementPredicate | RelationPredicate;
73
- declare const Predicate = "Predicate";
74
- type RelationExpression = DirectedRelationExpression | InOutRelationExpression | IncomingRelationExpression | OutgoingRelationExpression;
75
- declare const RelationExpression = "RelationExpression";
76
- declare function isRelationExpression(item: unknown): item is RelationExpression;
77
- type RelationPredicate = RelationPredicateOrWhere | RelationPredicateWith;
78
- declare const RelationPredicate = "RelationPredicate";
79
- type RelationPredicateOrWhere = RelationExpression | RelationPredicateWhere;
80
- declare const RelationPredicateOrWhere = "RelationPredicateOrWhere";
81
- type RelationProperty = LinkProperty | MetadataProperty | RelationNavigateToProperty | RelationStringProperty | RelationStyleProperty;
82
- declare const RelationProperty = "RelationProperty";
83
- declare function isRelationProperty(item: unknown): item is RelationProperty;
84
- type RelationshipStyleProperty = ArrowProperty | ColorProperty | LineProperty;
85
- declare const RelationshipStyleProperty = "RelationshipStyleProperty";
86
- type StringProperty = ElementStringProperty | MetadataAttribute | NotationProperty | NotesProperty | RelationStringProperty | SpecificationElementStringProperty | SpecificationRelationshipStringProperty | ViewStringProperty;
87
- declare const StringProperty = "StringProperty";
88
- type StyleProperty = BorderProperty | ColorProperty | IconProperty | OpacityProperty | ShapeProperty;
89
- declare const StyleProperty = "StyleProperty";
90
- declare function isStyleProperty(item: unknown): item is StyleProperty;
91
- type ThemeColor = 'amber' | 'blue' | 'gray' | 'green' | 'indigo' | 'muted' | 'primary' | 'red' | 'secondary' | 'sky' | 'slate';
92
- type Uri = string;
93
- type ViewLayoutDirection = 'BottomTop' | 'LeftRight' | 'RightLeft' | 'TopBottom';
94
- type ViewProperty = LinkProperty | ViewStringProperty;
95
- declare const ViewProperty = "ViewProperty";
96
- declare function isViewProperty(item: unknown): item is ViewProperty;
97
- type ViewRule = ViewRuleAutoLayout | ViewRulePredicate | ViewRuleStyle;
98
- declare const ViewRule = "ViewRule";
99
- declare function isViewRule(item: unknown): item is ViewRule;
100
- type ViewRulePredicate = ExcludePredicate | IncludePredicate;
101
- declare const ViewRulePredicate = "ViewRulePredicate";
102
- type WhereElement = WhereElementKind | WhereElementTag;
103
- declare const WhereElement = "WhereElement";
104
- type WhereElementExpression = WhereBinaryExpression | WhereElement | WhereElementNegation;
105
- declare const WhereElementExpression = "WhereElementExpression";
106
- type WhereExpression = WhereElementExpression | WhereRelationExpression;
107
- declare const WhereExpression = "WhereExpression";
108
- type WhereKindEqual = WhereElementKind | WhereRelationKind;
109
- declare const WhereKindEqual = "WhereKindEqual";
110
- type WhereRelation = WhereRelationKind | WhereRelationTag;
111
- declare const WhereRelation = "WhereRelation";
112
- type WhereRelationExpression = WhereBinaryExpression | WhereRelation | WhereRelationNegation;
113
- declare const WhereRelationExpression = "WhereRelationExpression";
114
- type WhereTagEqual = WhereElementTag | WhereRelationTag;
115
- declare const WhereTagEqual = "WhereTagEqual";
116
- interface ArrowProperty extends AstNode {
117
- readonly $container: CustomRelationProperties | RelationStyleProperty | SpecificationRelationshipKind;
118
- readonly $type: 'ArrowProperty';
119
- key: 'head' | 'tail';
120
- value: ArrowType;
121
- }
122
- declare const ArrowProperty = "ArrowProperty";
123
- interface BorderProperty extends AstNode {
124
- readonly $container: CustomElementProperties | ElementStyleProperty | ViewRuleStyle;
125
- readonly $type: 'BorderProperty';
126
- key: 'border';
127
- value: BorderStyleValue;
128
- }
129
- declare const BorderProperty = "BorderProperty";
130
- interface ColorProperty extends AstNode {
131
- readonly $container: CustomElementProperties | CustomRelationProperties | ElementStyleProperty | RelationStyleProperty | SpecificationRelationshipKind | ViewRuleStyle;
132
- readonly $type: 'ColorProperty';
133
- customColor?: Reference<CustomColor>;
134
- key: 'color';
135
- themeColor?: ThemeColor;
136
- }
137
- declare const ColorProperty = "ColorProperty";
138
- interface CustomColor extends AstNode {
139
- readonly $container: SpecificationColor;
140
- readonly $type: 'CustomColor';
141
- name: CustomColorId;
142
- }
143
- declare const CustomColor = "CustomColor";
144
- interface CustomElementProperties extends AstNode {
145
- readonly $container: ElementPredicateWith;
146
- readonly $type: 'CustomElementProperties';
147
- props: Array<ElementStringProperty | NavigateToProperty | NotationProperty | StyleProperty>;
148
- }
149
- declare const CustomElementProperties = "CustomElementProperties";
150
- interface CustomRelationProperties extends AstNode {
151
- readonly $container: DynamicViewStep | RelationPredicateWith;
152
- readonly $type: 'CustomRelationProperties';
153
- props: Array<NotationProperty | NotesProperty | RelationNavigateToProperty | RelationStringProperty | RelationshipStyleProperty>;
154
- }
155
- declare const CustomRelationProperties = "CustomRelationProperties";
156
- interface DirectedRelationExpression extends AstNode {
157
- readonly $container: Predicates | RelationPredicateWhere | RelationPredicateWith;
158
- readonly $type: 'DirectedRelationExpression';
159
- source: OutgoingRelationExpression;
160
- target: ElementExpression;
161
- }
162
- declare const DirectedRelationExpression = "DirectedRelationExpression";
163
- interface DynamicView extends AstNode {
164
- readonly $container: ModelViews;
165
- readonly $type: 'DynamicView';
166
- body?: DynamicViewBody;
167
- name: Id;
168
- }
169
- declare const DynamicView = "DynamicView";
170
- interface DynamicViewBody extends AstNode {
171
- readonly $container: DynamicView;
172
- readonly $type: 'DynamicViewBody';
173
- props: Array<ViewProperty>;
174
- rules: Array<DynamicViewRule>;
175
- steps: Array<DynamicViewParallelSteps | DynamicViewStep>;
176
- tags?: Tags;
177
- }
178
- declare const DynamicViewBody = "DynamicViewBody";
179
- declare function isDynamicViewBody(item: unknown): item is DynamicViewBody;
180
- interface DynamicViewIncludePredicate extends AstNode {
181
- readonly $container: DynamicViewBody;
182
- readonly $type: 'DynamicViewIncludePredicate';
183
- predicates: DynamicViewPredicateIterator;
184
- }
185
- declare const DynamicViewIncludePredicate = "DynamicViewIncludePredicate";
186
- interface DynamicViewParallelSteps extends AstNode {
187
- readonly $container: DynamicViewBody;
188
- readonly $type: 'DynamicViewParallelSteps';
189
- steps: Array<DynamicViewStep>;
190
- }
191
- declare const DynamicViewParallelSteps = "DynamicViewParallelSteps";
192
- declare function isDynamicViewParallelSteps(item: unknown): item is DynamicViewParallelSteps;
193
- interface DynamicViewPredicateIterator extends AstNode {
194
- readonly $container: DynamicViewIncludePredicate | DynamicViewPredicateIterator;
195
- readonly $type: 'DynamicViewPredicateIterator';
196
- prev?: DynamicViewPredicateIterator;
197
- value: ElementPredicate;
198
- }
199
- declare const DynamicViewPredicateIterator = "DynamicViewPredicateIterator";
200
- declare function isDynamicViewPredicateIterator(item: unknown): item is DynamicViewPredicateIterator;
201
- interface DynamicViewRef extends AstNode {
202
- readonly $container: RelationNavigateToProperty;
203
- readonly $type: 'DynamicViewRef';
204
- view: Reference<DynamicView>;
205
- }
206
- declare const DynamicViewRef = "DynamicViewRef";
207
- interface DynamicViewStep extends AstNode {
208
- readonly $container: DynamicViewBody | DynamicViewParallelSteps;
209
- readonly $type: 'DynamicViewStep';
210
- custom?: CustomRelationProperties;
211
- isBackward: boolean;
212
- kind?: Reference<RelationshipKind>;
213
- source: ElementRef;
214
- target: ElementRef;
215
- title?: string;
216
- }
217
- declare const DynamicViewStep = "DynamicViewStep";
218
- declare function isDynamicViewStep(item: unknown): item is DynamicViewStep;
219
- interface Element extends AstNode {
220
- readonly $container: ElementBody | ExtendElementBody | Model;
221
- readonly $type: 'Element';
222
- body?: ElementBody;
223
- kind: Reference<ElementKind>;
224
- name: Id;
225
- props: Array<string>;
226
- }
227
- declare const Element = "Element";
228
- declare function isElement(item: unknown): item is Element;
229
- interface ElementBody extends AstNode {
230
- readonly $container: Element;
231
- readonly $type: 'ElementBody';
232
- elements: Array<Element | Relation>;
233
- props: Array<ElementProperty>;
234
- tags?: Tags;
235
- }
236
- declare const ElementBody = "ElementBody";
237
- declare function isElementBody(item: unknown): item is ElementBody;
238
- interface ElementDescedantsExpression extends AstNode {
239
- readonly $container: DirectedRelationExpression | DynamicViewPredicateIterator | ElementExpressionsIterator | ElementPredicateWhere | ElementPredicateWith | IncomingRelationExpression | OutgoingRelationExpression | Predicates;
240
- readonly $type: 'ElementDescedantsExpression';
241
- parent: ElementRef;
242
- }
243
- declare const ElementDescedantsExpression = "ElementDescedantsExpression";
244
- interface ElementExpressionsIterator extends AstNode {
245
- readonly $container: ElementExpressionsIterator | ViewRuleStyle;
246
- readonly $type: 'ElementExpressionsIterator';
247
- prev?: ElementExpressionsIterator;
248
- value: ElementExpression;
249
- }
250
- declare const ElementExpressionsIterator = "ElementExpressionsIterator";
251
- interface ElementKind extends AstNode {
252
- readonly $container: SpecificationElementKind;
253
- readonly $type: 'ElementKind';
254
- name: Id;
255
- }
256
- declare const ElementKind = "ElementKind";
257
- interface ElementKindExpression extends AstNode {
258
- readonly $container: DirectedRelationExpression | DynamicViewPredicateIterator | ElementExpressionsIterator | ElementPredicateWhere | ElementPredicateWith | IncomingRelationExpression | OutgoingRelationExpression | Predicates;
259
- readonly $type: 'ElementKindExpression';
260
- isEqual: boolean;
261
- kind?: Reference<ElementKind>;
262
- }
263
- declare const ElementKindExpression = "ElementKindExpression";
264
- interface ElementPredicateWhere extends AstNode {
265
- readonly $container: DynamicViewPredicateIterator | ElementPredicateWith | Predicates;
266
- readonly $type: 'ElementPredicateWhere';
267
- subject: ElementExpression;
268
- where?: WhereElementExpression;
269
- }
270
- declare const ElementPredicateWhere = "ElementPredicateWhere";
271
- interface ElementPredicateWith extends AstNode {
272
- readonly $container: DynamicViewPredicateIterator | Predicates;
273
- readonly $type: 'ElementPredicateWith';
274
- custom?: CustomElementProperties;
275
- subject: ElementPredicateOrWhere;
276
- }
277
- declare const ElementPredicateWith = "ElementPredicateWith";
278
- declare function isElementPredicateWith(item: unknown): item is ElementPredicateWith;
279
- interface ElementRef extends AstNode {
280
- readonly $container: DirectedRelationExpression | DynamicViewPredicateIterator | DynamicViewStep | ElementDescedantsExpression | ElementExpressionsIterator | ElementPredicateWhere | ElementPredicateWith | ElementRef | ElementView | ExpandElementExpression | IncomingRelationExpression | OutgoingRelationExpression | Predicates | Relation;
281
- readonly $type: 'ElementRef';
282
- el: Reference<Element>;
283
- parent?: ElementRef;
284
- }
285
- declare const ElementRef = "ElementRef";
286
- interface ElementStringProperty extends AstNode {
287
- readonly $container: CustomElementProperties | ElementBody;
288
- readonly $type: 'ElementStringProperty';
289
- key: 'description' | 'technology' | 'title';
290
- value: string;
291
- }
292
- declare const ElementStringProperty = "ElementStringProperty";
293
- interface ElementStyleProperty extends AstNode {
294
- readonly $container: ElementBody | SpecificationElementKind;
295
- readonly $type: 'ElementStyleProperty';
296
- key: 'style';
297
- props: Array<StyleProperty>;
298
- }
299
- declare const ElementStyleProperty = "ElementStyleProperty";
300
- interface ElementTagExpression extends AstNode {
301
- readonly $container: DirectedRelationExpression | DynamicViewPredicateIterator | ElementExpressionsIterator | ElementPredicateWhere | ElementPredicateWith | IncomingRelationExpression | OutgoingRelationExpression | Predicates;
302
- readonly $type: 'ElementTagExpression';
303
- isEqual: boolean;
304
- tag?: Reference<Tag>;
305
- }
306
- declare const ElementTagExpression = "ElementTagExpression";
307
- interface ElementView extends AstNode {
308
- readonly $container: ModelViews;
309
- readonly $type: 'ElementView';
310
- body?: ElementViewBody;
311
- extends?: ElementViewRef;
312
- name?: Id;
313
- viewOf?: ElementRef;
314
- }
315
- declare const ElementView = "ElementView";
316
- interface ElementViewBody extends AstNode {
317
- readonly $container: ElementView;
318
- readonly $type: 'ElementViewBody';
319
- props: Array<ViewProperty>;
320
- rules: Array<ViewRule>;
321
- tags?: Tags;
322
- }
323
- declare const ElementViewBody = "ElementViewBody";
324
- declare function isElementViewBody(item: unknown): item is ElementViewBody;
325
- interface ElementViewRef extends AstNode {
326
- readonly $container: ElementView;
327
- readonly $type: 'ElementViewRef';
328
- view: Reference<ElementView>;
329
- }
330
- declare const ElementViewRef = "ElementViewRef";
331
- interface ExcludePredicate extends AstNode {
332
- readonly $container: ElementViewBody;
333
- readonly $type: 'ExcludePredicate';
334
- predicates: Predicates;
335
- }
336
- declare const ExcludePredicate = "ExcludePredicate";
337
- interface ExpandElementExpression extends AstNode {
338
- readonly $container: DirectedRelationExpression | DynamicViewPredicateIterator | ElementExpressionsIterator | ElementPredicateWhere | ElementPredicateWith | IncomingRelationExpression | OutgoingRelationExpression | Predicates;
339
- readonly $type: 'ExpandElementExpression';
340
- expand: ElementRef;
341
- }
342
- declare const ExpandElementExpression = "ExpandElementExpression";
343
- interface ExtendElement extends AstNode {
344
- readonly $container: Model;
345
- readonly $type: 'ExtendElement';
346
- body: ExtendElementBody;
347
- element: FqnElementRef;
348
- }
349
- declare const ExtendElement = "ExtendElement";
350
- declare function isExtendElement(item: unknown): item is ExtendElement;
351
- interface ExtendElementBody extends AstNode {
352
- readonly $container: ExtendElement;
353
- readonly $type: 'ExtendElementBody';
354
- elements: Array<Element | Relation>;
355
- }
356
- declare const ExtendElementBody = "ExtendElementBody";
357
- declare function isExtendElementBody(item: unknown): item is ExtendElementBody;
358
- interface FqnElementRef extends AstNode {
359
- readonly $container: ExtendElement | FqnElementRef;
360
- readonly $type: 'FqnElementRef';
361
- el: Reference<Element>;
362
- parent?: FqnElementRef;
363
- }
364
- declare const FqnElementRef = "FqnElementRef";
365
- interface IconProperty extends AstNode {
366
- readonly $container: CustomElementProperties | ElementBody | ElementStyleProperty | ViewRuleStyle;
367
- readonly $type: 'IconProperty';
368
- key: 'icon';
369
- libicon?: Reference<LibIcon>;
370
- value?: Uri;
371
- }
372
- declare const IconProperty = "IconProperty";
373
- interface IncludePredicate extends AstNode {
374
- readonly $container: ElementViewBody;
375
- readonly $type: 'IncludePredicate';
376
- predicates: Predicates;
377
- }
378
- declare const IncludePredicate = "IncludePredicate";
379
- interface IncomingRelationExpression extends AstNode {
380
- readonly $container: InOutRelationExpression | Predicates | RelationPredicateWhere | RelationPredicateWith;
381
- readonly $type: 'IncomingRelationExpression';
382
- to: ElementExpression;
383
- }
384
- declare const IncomingRelationExpression = "IncomingRelationExpression";
385
- interface InOutRelationExpression extends AstNode {
386
- readonly $container: Predicates | RelationPredicateWhere | RelationPredicateWith;
387
- readonly $type: 'InOutRelationExpression';
388
- inout: IncomingRelationExpression;
389
- }
390
- declare const InOutRelationExpression = "InOutRelationExpression";
391
- interface LibIcon extends AstNode {
392
- readonly $container: LikeC4Lib;
393
- readonly $type: 'LibIcon';
394
- name: IconId;
395
- }
396
- declare const LibIcon = "LibIcon";
397
- interface LikeC4Grammar extends AstNode {
398
- readonly $type: 'LikeC4Grammar';
399
- likec4lib: Array<LikeC4Lib>;
400
- models: Array<Model>;
401
- specifications: Array<SpecificationRule>;
402
- views: Array<ModelViews>;
403
- }
404
- declare const LikeC4Grammar = "LikeC4Grammar";
405
- interface LikeC4Lib extends AstNode {
406
- readonly $container: LikeC4Grammar;
407
- readonly $type: 'LikeC4Lib';
408
- icons: Array<LibIcon>;
409
- }
410
- declare const LikeC4Lib = "LikeC4Lib";
411
- interface LineProperty extends AstNode {
412
- readonly $container: CustomRelationProperties | RelationStyleProperty | SpecificationRelationshipKind;
413
- readonly $type: 'LineProperty';
414
- key: 'line';
415
- value: LineOptions;
416
- }
417
- declare const LineProperty = "LineProperty";
418
- interface LinkProperty extends AstNode {
419
- readonly $container: DynamicViewBody | ElementBody | ElementViewBody | RelationBody;
420
- readonly $type: 'LinkProperty';
421
- key: 'link';
422
- title?: string;
423
- value: Uri;
424
- }
425
- declare const LinkProperty = "LinkProperty";
426
- interface MetadataAttribute extends AstNode {
427
- readonly $container: MetadataBody;
428
- readonly $type: 'MetadataAttribute';
429
- key: string;
430
- value: string;
431
- }
432
- declare const MetadataAttribute = "MetadataAttribute";
433
- interface MetadataBody extends AstNode {
434
- readonly $container: ElementBody | RelationBody;
435
- readonly $type: 'MetadataBody';
436
- props: Array<MetadataAttribute>;
437
- }
438
- declare const MetadataBody = "MetadataBody";
439
- interface Model extends AstNode {
440
- readonly $container: LikeC4Grammar;
441
- readonly $type: 'Model';
442
- elements: Array<Element | ExtendElement | Relation>;
443
- name: 'model';
444
- }
445
- declare const Model = "Model";
446
- declare function isModel(item: unknown): item is Model;
447
- interface ModelViews extends AstNode {
448
- readonly $container: LikeC4Grammar;
449
- readonly $type: 'ModelViews';
450
- name: 'views';
451
- styles: Array<ViewRuleStyle>;
452
- views: Array<LikeC4View>;
453
- }
454
- declare const ModelViews = "ModelViews";
455
- declare function isModelViews(item: unknown): item is ModelViews;
456
- interface NavigateToProperty extends AstNode {
457
- readonly $container: CustomElementProperties;
458
- readonly $type: 'NavigateToProperty';
459
- key: 'navigateTo';
460
- value: ViewRef;
461
- }
462
- declare const NavigateToProperty = "NavigateToProperty";
463
- interface NotationProperty extends AstNode {
464
- readonly $container: CustomElementProperties | CustomRelationProperties | ViewRuleStyle;
465
- readonly $type: 'NotationProperty';
466
- key: 'notation';
467
- value: string;
468
- }
469
- declare const NotationProperty = "NotationProperty";
470
- interface NotesProperty extends AstNode {
471
- readonly $container: CustomRelationProperties;
472
- readonly $type: 'NotesProperty';
473
- key: 'notes';
474
- value: string;
475
- }
476
- declare const NotesProperty = "NotesProperty";
477
- interface OpacityProperty extends AstNode {
478
- readonly $container: CustomElementProperties | ElementStyleProperty | ViewRuleStyle;
479
- readonly $type: 'OpacityProperty';
480
- key: 'opacity';
481
- value: string;
482
- }
483
- declare const OpacityProperty = "OpacityProperty";
484
- interface OutgoingRelationExpression extends AstNode {
485
- readonly $container: DirectedRelationExpression | Predicates | RelationPredicateWhere | RelationPredicateWith;
486
- readonly $type: 'OutgoingRelationExpression';
487
- from: ElementExpression;
488
- isBidirectional: boolean;
489
- kind?: Reference<RelationshipKind>;
490
- }
491
- declare const OutgoingRelationExpression = "OutgoingRelationExpression";
492
- interface Predicates extends AstNode {
493
- readonly $container: ExcludePredicate | IncludePredicate | Predicates;
494
- readonly $type: 'Predicates';
495
- prev?: Predicates;
496
- value: Predicate;
497
- }
498
- declare const Predicates = "Predicates";
499
- interface Relation extends AstNode {
500
- readonly $container: ElementBody | ExtendElementBody | Model;
501
- readonly $type: 'Relation';
502
- body?: RelationBody;
503
- kind?: Reference<RelationshipKind>;
504
- source?: ElementRef;
505
- tags?: Tags;
506
- target: ElementRef;
507
- technology?: string;
508
- title?: string;
509
- }
510
- declare const Relation = "Relation";
511
- declare function isRelation(item: unknown): item is Relation;
512
- interface RelationBody extends AstNode {
513
- readonly $container: Relation;
514
- readonly $type: 'RelationBody';
515
- props: Array<RelationProperty>;
516
- tags?: Tags;
517
- }
518
- declare const RelationBody = "RelationBody";
519
- declare function isRelationBody(item: unknown): item is RelationBody;
520
- interface RelationNavigateToProperty extends AstNode {
521
- readonly $container: CustomRelationProperties | RelationBody;
522
- readonly $type: 'RelationNavigateToProperty';
523
- key: 'navigateTo';
524
- value: DynamicViewRef;
525
- }
526
- declare const RelationNavigateToProperty = "RelationNavigateToProperty";
527
- interface RelationPredicateWhere extends AstNode {
528
- readonly $container: Predicates | RelationPredicateWith;
529
- readonly $type: 'RelationPredicateWhere';
530
- subject: RelationExpression;
531
- where?: WhereRelationExpression;
532
- }
533
- declare const RelationPredicateWhere = "RelationPredicateWhere";
534
- interface RelationPredicateWith extends AstNode {
535
- readonly $container: Predicates;
536
- readonly $type: 'RelationPredicateWith';
537
- custom?: CustomRelationProperties;
538
- subject: RelationPredicateOrWhere;
539
- }
540
- declare const RelationPredicateWith = "RelationPredicateWith";
541
- declare function isRelationPredicateWith(item: unknown): item is RelationPredicateWith;
542
- interface RelationshipKind extends AstNode {
543
- readonly $container: SpecificationRelationshipKind;
544
- readonly $type: 'RelationshipKind';
545
- name: Id;
546
- }
547
- declare const RelationshipKind = "RelationshipKind";
548
- interface RelationStringProperty extends AstNode {
549
- readonly $container: CustomRelationProperties | RelationBody;
550
- readonly $type: 'RelationStringProperty';
551
- key: 'description' | 'technology' | 'title';
552
- value: string;
553
- }
554
- declare const RelationStringProperty = "RelationStringProperty";
555
- interface RelationStyleProperty extends AstNode {
556
- readonly $container: RelationBody;
557
- readonly $type: 'RelationStyleProperty';
558
- key: 'style';
559
- props: Array<RelationshipStyleProperty>;
560
- }
561
- declare const RelationStyleProperty = "RelationStyleProperty";
562
- interface ShapeProperty extends AstNode {
563
- readonly $container: CustomElementProperties | ElementStyleProperty | ViewRuleStyle;
564
- readonly $type: 'ShapeProperty';
565
- key: 'shape';
566
- value: ElementShape;
567
- }
568
- declare const ShapeProperty = "ShapeProperty";
569
- interface SpecificationColor extends AstNode {
570
- readonly $container: SpecificationRule;
571
- readonly $type: 'SpecificationColor';
572
- color: CustomColorValue;
573
- name: CustomColor;
574
- }
575
- declare const SpecificationColor = "SpecificationColor";
576
- declare function isSpecificationColor(item: unknown): item is SpecificationColor;
577
- interface SpecificationElementKind extends AstNode {
578
- readonly $container: SpecificationRule;
579
- readonly $type: 'SpecificationElementKind';
580
- kind: ElementKind;
581
- props: Array<ElementStyleProperty | SpecificationElementStringProperty>;
582
- }
583
- declare const SpecificationElementKind = "SpecificationElementKind";
584
- declare function isSpecificationElementKind(item: unknown): item is SpecificationElementKind;
585
- interface SpecificationElementStringProperty extends AstNode {
586
- readonly $container: SpecificationElementKind;
587
- readonly $type: 'SpecificationElementStringProperty';
588
- key: 'notation' | 'technology';
589
- value: string;
590
- }
591
- declare const SpecificationElementStringProperty = "SpecificationElementStringProperty";
592
- interface SpecificationRelationshipKind extends AstNode {
593
- readonly $container: SpecificationRule;
594
- readonly $type: 'SpecificationRelationshipKind';
595
- kind: RelationshipKind;
596
- props: Array<RelationshipStyleProperty | SpecificationRelationshipStringProperty>;
597
- }
598
- declare const SpecificationRelationshipKind = "SpecificationRelationshipKind";
599
- declare function isSpecificationRelationshipKind(item: unknown): item is SpecificationRelationshipKind;
600
- interface SpecificationRelationshipStringProperty extends AstNode {
601
- readonly $container: SpecificationRelationshipKind;
602
- readonly $type: 'SpecificationRelationshipStringProperty';
603
- key: 'notation' | 'technology';
604
- value: string;
605
- }
606
- declare const SpecificationRelationshipStringProperty = "SpecificationRelationshipStringProperty";
607
- interface SpecificationRule extends AstNode {
608
- readonly $container: LikeC4Grammar;
609
- readonly $type: 'SpecificationRule';
610
- colors: Array<SpecificationColor>;
611
- elements: Array<SpecificationElementKind>;
612
- name: 'specification';
613
- relationships: Array<SpecificationRelationshipKind>;
614
- tags: Array<SpecificationTag>;
615
- }
616
- declare const SpecificationRule = "SpecificationRule";
617
- declare function isSpecificationRule(item: unknown): item is SpecificationRule;
618
- interface SpecificationTag extends AstNode {
619
- readonly $container: SpecificationRule;
620
- readonly $type: 'SpecificationTag';
621
- tag: Tag;
622
- }
623
- declare const SpecificationTag = "SpecificationTag";
624
- declare function isSpecificationTag(item: unknown): item is SpecificationTag;
625
- interface Tag extends AstNode {
626
- readonly $container: SpecificationTag;
627
- readonly $type: 'Tag';
628
- name: Id;
629
- }
630
- declare const Tag = "Tag";
631
- interface Tags extends AstNode {
632
- readonly $container: DynamicViewBody | ElementBody | ElementViewBody | Relation | RelationBody | Tags;
633
- readonly $type: 'Tags';
634
- prev?: Tags;
635
- values: Array<Reference<Tag>>;
636
- }
637
- declare const Tags = "Tags";
638
- declare function isTags(item: unknown): item is Tags;
639
- interface ViewRef extends AstNode {
640
- readonly $container: NavigateToProperty;
641
- readonly $type: 'ViewRef';
642
- view: Reference<LikeC4View>;
643
- }
644
- declare const ViewRef = "ViewRef";
645
- interface ViewRuleAutoLayout extends AstNode {
646
- readonly $container: DynamicViewBody | ElementViewBody;
647
- readonly $type: 'ViewRuleAutoLayout';
648
- direction: ViewLayoutDirection;
649
- nodeSep?: number;
650
- rankSep?: number;
651
- }
652
- declare const ViewRuleAutoLayout = "ViewRuleAutoLayout";
653
- interface ViewRuleStyle extends AstNode {
654
- readonly $container: DynamicViewBody | ElementViewBody | ModelViews;
655
- readonly $type: 'ViewRuleStyle';
656
- props: Array<NotationProperty | StyleProperty>;
657
- target: ElementExpressionsIterator;
658
- }
659
- declare const ViewRuleStyle = "ViewRuleStyle";
660
- interface ViewStringProperty extends AstNode {
661
- readonly $container: DynamicViewBody | ElementViewBody;
662
- readonly $type: 'ViewStringProperty';
663
- key: 'description' | 'title';
664
- value: string;
665
- }
666
- declare const ViewStringProperty = "ViewStringProperty";
667
- interface WhereBinaryExpression extends AstNode {
668
- readonly $container: ElementPredicateWhere | RelationPredicateWhere | WhereBinaryExpression | WhereElementNegation | WhereRelationNegation;
669
- readonly $type: 'WhereBinaryExpression';
670
- left: WhereElementExpression | WhereRelationExpression;
671
- operator: 'and' | 'or';
672
- right: WhereElementExpression | WhereRelationExpression;
673
- }
674
- declare const WhereBinaryExpression = "WhereBinaryExpression";
675
- interface WhereElementKind extends AstNode {
676
- readonly $container: ElementPredicateWhere | WhereBinaryExpression | WhereElementNegation;
677
- readonly $type: 'WhereElementKind';
678
- not: boolean;
679
- operator: 'is' | string;
680
- value?: Reference<ElementKind>;
681
- }
682
- declare const WhereElementKind = "WhereElementKind";
683
- interface WhereElementNegation extends AstNode {
684
- readonly $container: ElementPredicateWhere | WhereBinaryExpression | WhereElementNegation;
685
- readonly $type: 'WhereElementNegation';
686
- value: WhereElementExpression;
687
- }
688
- declare const WhereElementNegation = "WhereElementNegation";
689
- interface WhereElementTag extends AstNode {
690
- readonly $container: ElementPredicateWhere | WhereBinaryExpression | WhereElementNegation;
691
- readonly $type: 'WhereElementTag';
692
- not: boolean;
693
- operator: 'is' | string;
694
- value?: Reference<Tag>;
695
- }
696
- declare const WhereElementTag = "WhereElementTag";
697
- interface WhereRelationKind extends AstNode {
698
- readonly $container: RelationPredicateWhere | WhereBinaryExpression | WhereRelationNegation;
699
- readonly $type: 'WhereRelationKind';
700
- not: boolean;
701
- operator: 'is' | string;
702
- value?: Reference<RelationshipKind>;
703
- }
704
- declare const WhereRelationKind = "WhereRelationKind";
705
- interface WhereRelationNegation extends AstNode {
706
- readonly $container: RelationPredicateWhere | WhereBinaryExpression | WhereRelationNegation;
707
- readonly $type: 'WhereRelationNegation';
708
- value: WhereRelationExpression;
709
- }
710
- declare const WhereRelationNegation = "WhereRelationNegation";
711
- interface WhereRelationTag extends AstNode {
712
- readonly $container: RelationPredicateWhere | WhereBinaryExpression | WhereRelationNegation;
713
- readonly $type: 'WhereRelationTag';
714
- not: boolean;
715
- operator: 'is' | string;
716
- value?: Reference<Tag>;
717
- }
718
- declare const WhereRelationTag = "WhereRelationTag";
719
- interface WildcardExpression extends AstNode {
720
- readonly $container: DirectedRelationExpression | DynamicViewPredicateIterator | ElementExpressionsIterator | ElementPredicateWhere | ElementPredicateWith | IncomingRelationExpression | OutgoingRelationExpression | Predicates;
721
- readonly $type: 'WildcardExpression';
722
- isWildcard: boolean;
723
- }
724
- declare const WildcardExpression = "WildcardExpression";
725
- type LikeC4AstType = {
726
- ArrowProperty: ArrowProperty;
727
- BorderProperty: BorderProperty;
728
- ColorProperty: ColorProperty;
729
- CustomColor: CustomColor;
730
- CustomElementProperties: CustomElementProperties;
731
- CustomRelationProperties: CustomRelationProperties;
732
- DirectedRelationExpression: DirectedRelationExpression;
733
- DynamicView: DynamicView;
734
- DynamicViewBody: DynamicViewBody;
735
- DynamicViewIncludePredicate: DynamicViewIncludePredicate;
736
- DynamicViewParallelSteps: DynamicViewParallelSteps;
737
- DynamicViewPredicateIterator: DynamicViewPredicateIterator;
738
- DynamicViewRef: DynamicViewRef;
739
- DynamicViewRule: DynamicViewRule;
740
- DynamicViewStep: DynamicViewStep;
741
- Element: Element;
742
- ElementBody: ElementBody;
743
- ElementDescedantsExpression: ElementDescedantsExpression;
744
- ElementExpression: ElementExpression;
745
- ElementExpressionsIterator: ElementExpressionsIterator;
746
- ElementKind: ElementKind;
747
- ElementKindExpression: ElementKindExpression;
748
- ElementPredicate: ElementPredicate;
749
- ElementPredicateOrWhere: ElementPredicateOrWhere;
750
- ElementPredicateWhere: ElementPredicateWhere;
751
- ElementPredicateWith: ElementPredicateWith;
752
- ElementProperty: ElementProperty;
753
- ElementRef: ElementRef;
754
- ElementStringProperty: ElementStringProperty;
755
- ElementStyleProperty: ElementStyleProperty;
756
- ElementTagExpression: ElementTagExpression;
757
- ElementView: ElementView;
758
- ElementViewBody: ElementViewBody;
759
- ElementViewRef: ElementViewRef;
760
- ExcludePredicate: ExcludePredicate;
761
- ExpandElementExpression: ExpandElementExpression;
762
- ExtendElement: ExtendElement;
763
- ExtendElementBody: ExtendElementBody;
764
- FqnElementRef: FqnElementRef;
765
- IconProperty: IconProperty;
766
- InOutRelationExpression: InOutRelationExpression;
767
- IncludePredicate: IncludePredicate;
768
- IncomingRelationExpression: IncomingRelationExpression;
769
- LibIcon: LibIcon;
770
- LikeC4Grammar: LikeC4Grammar;
771
- LikeC4Lib: LikeC4Lib;
772
- LikeC4View: LikeC4View;
773
- LineProperty: LineProperty;
774
- LinkProperty: LinkProperty;
775
- MetadataAttribute: MetadataAttribute;
776
- MetadataBody: MetadataBody;
777
- MetadataProperty: MetadataProperty;
778
- Model: Model;
779
- ModelViews: ModelViews;
780
- NavigateToProperty: NavigateToProperty;
781
- NotationProperty: NotationProperty;
782
- NotesProperty: NotesProperty;
783
- OpacityProperty: OpacityProperty;
784
- OutgoingRelationExpression: OutgoingRelationExpression;
785
- Predicate: Predicate;
786
- Predicates: Predicates;
787
- Relation: Relation;
788
- RelationBody: RelationBody;
789
- RelationExpression: RelationExpression;
790
- RelationNavigateToProperty: RelationNavigateToProperty;
791
- RelationPredicate: RelationPredicate;
792
- RelationPredicateOrWhere: RelationPredicateOrWhere;
793
- RelationPredicateWhere: RelationPredicateWhere;
794
- RelationPredicateWith: RelationPredicateWith;
795
- RelationProperty: RelationProperty;
796
- RelationStringProperty: RelationStringProperty;
797
- RelationStyleProperty: RelationStyleProperty;
798
- RelationshipKind: RelationshipKind;
799
- RelationshipStyleProperty: RelationshipStyleProperty;
800
- ShapeProperty: ShapeProperty;
801
- SpecificationColor: SpecificationColor;
802
- SpecificationElementKind: SpecificationElementKind;
803
- SpecificationElementStringProperty: SpecificationElementStringProperty;
804
- SpecificationRelationshipKind: SpecificationRelationshipKind;
805
- SpecificationRelationshipStringProperty: SpecificationRelationshipStringProperty;
806
- SpecificationRule: SpecificationRule;
807
- SpecificationTag: SpecificationTag;
808
- StringProperty: StringProperty;
809
- StyleProperty: StyleProperty;
810
- Tag: Tag;
811
- Tags: Tags;
812
- ViewProperty: ViewProperty;
813
- ViewRef: ViewRef;
814
- ViewRule: ViewRule;
815
- ViewRuleAutoLayout: ViewRuleAutoLayout;
816
- ViewRulePredicate: ViewRulePredicate;
817
- ViewRuleStyle: ViewRuleStyle;
818
- ViewStringProperty: ViewStringProperty;
819
- WhereBinaryExpression: WhereBinaryExpression;
820
- WhereElement: WhereElement;
821
- WhereElementExpression: WhereElementExpression;
822
- WhereElementKind: WhereElementKind;
823
- WhereElementNegation: WhereElementNegation;
824
- WhereElementTag: WhereElementTag;
825
- WhereExpression: WhereExpression;
826
- WhereKindEqual: WhereKindEqual;
827
- WhereRelation: WhereRelation;
828
- WhereRelationExpression: WhereRelationExpression;
829
- WhereRelationKind: WhereRelationKind;
830
- WhereRelationNegation: WhereRelationNegation;
831
- WhereRelationTag: WhereRelationTag;
832
- WhereTagEqual: WhereTagEqual;
833
- WildcardExpression: WildcardExpression;
834
- };
835
-
836
- declare const idattr: unique symbol;
837
- declare module './generated/ast' {
838
- interface Element {
839
- [idattr]?: c4.Fqn | undefined;
840
- }
841
- interface ElementView {
842
- [idattr]?: c4.ViewID | undefined;
843
- }
844
- interface DynamicView {
845
- [idattr]?: c4.ViewID | undefined;
846
- }
847
- }
848
- type ParsedElementStyle = {
849
- shape?: c4.ElementShape;
850
- icon?: c4.IconUrl;
851
- color?: c4.Color;
852
- border?: c4.BorderStyle;
853
- opacity?: number;
854
- };
855
- interface ParsedAstSpecification {
856
- tags: Set<c4.Tag>;
857
- elements: Record<c4.ElementKind, {
858
- technology?: string;
859
- notation?: string;
860
- style: ParsedElementStyle;
861
- }>;
862
- relationships: Record<c4.RelationshipKind, {
863
- technology?: string;
864
- notation?: string;
865
- color?: c4.Color;
866
- line?: c4.RelationshipLineType;
867
- head?: c4.RelationshipArrowType;
868
- tail?: c4.RelationshipArrowType;
869
- }>;
870
- colors: Record<c4.CustomColor, {
871
- color: c4.HexColorLiteral;
872
- }>;
873
- }
874
- interface ParsedAstElement {
875
- id: c4.Fqn;
876
- astPath: string;
877
- kind: c4.ElementKind;
878
- title: string;
879
- description?: string;
880
- technology?: string;
881
- tags?: c4.NonEmptyArray<c4.Tag>;
882
- links?: c4.NonEmptyArray<ParsedLink>;
883
- style: ParsedElementStyle;
884
- metadata?: {
885
- [key: string]: string;
886
- };
887
- }
888
- interface ParsedAstRelation {
889
- id: c4.RelationID;
890
- astPath: string;
891
- source: c4.Fqn;
892
- target: c4.Fqn;
893
- kind?: c4.RelationshipKind;
894
- tags?: c4.NonEmptyArray<c4.Tag>;
895
- title: string;
896
- description?: string;
897
- technology?: string;
898
- color?: c4.Color;
899
- line?: c4.RelationshipLineType;
900
- head?: c4.RelationshipArrowType;
901
- tail?: c4.RelationshipArrowType;
902
- links?: c4.NonEmptyArray<ParsedLink>;
903
- navigateTo?: c4.ViewID;
904
- metadata?: {
905
- [key: string]: string;
906
- };
907
- }
908
- interface ParsedAstElementView {
909
- __: 'element';
910
- id: c4.ViewID;
911
- viewOf?: c4.Fqn;
912
- extends?: c4.ViewID;
913
- astPath: string;
914
- title: string | null;
915
- description: string | null;
916
- tags: c4.NonEmptyArray<c4.Tag> | null;
917
- links: c4.NonEmptyArray<ParsedLink> | null;
918
- rules: c4.ViewRule[];
919
- manualLayout?: c4.ViewManualLayout;
920
- }
921
- interface ParsedAstDynamicView {
922
- __: 'dynamic';
923
- id: c4.ViewID;
924
- astPath: string;
925
- title: string | null;
926
- description: string | null;
927
- tags: c4.NonEmptyArray<c4.Tag> | null;
928
- links: c4.NonEmptyArray<ParsedLink> | null;
929
- steps: c4.DynamicViewStepOrParallel[];
930
- rules: Array<c4.DynamicViewRule>;
931
- manualLayout?: c4.ViewManualLayout;
932
- }
933
- type ParsedAstView = ParsedAstElementView | ParsedAstDynamicView;
934
- interface ParsedLink {
935
- title?: string;
936
- url: string;
937
- }
938
- interface DocFqnIndexAstNodeDescription extends AstNodeDescription {
939
- fqn: c4.Fqn;
940
- }
941
- type LikeC4AstNode = ValueOf<ConditionalPick<LikeC4AstType, AstNode>>;
942
- type LikeC4DocumentDiagnostic = Diagnostic & DiagnosticInfo<LikeC4AstNode>;
943
- interface LikeC4DocumentProps {
944
- diagnostics?: Array<LikeC4DocumentDiagnostic>;
945
- c4Specification?: ParsedAstSpecification;
946
- c4Elements?: ParsedAstElement[];
947
- c4Relations?: ParsedAstRelation[];
948
- c4Views?: ParsedAstView[];
949
- c4fqnIndex?: MultiMap<c4.Fqn, DocFqnIndexAstNodeDescription>;
950
- }
951
- interface LikeC4LangiumDocument extends Omit<LangiumDocument<LikeC4Grammar>, 'diagnostics'>, LikeC4DocumentProps {
952
- }
953
- interface FqnIndexedDocument extends Omit<LangiumDocument<LikeC4Grammar>, 'diagnostics'>, SetRequired<LikeC4DocumentProps, 'c4fqnIndex'> {
954
- }
955
- interface ParsedLikeC4LangiumDocument extends Omit<LangiumDocument<LikeC4Grammar>, 'diagnostics'>, Required<LikeC4DocumentProps> {
956
- }
957
- type Guard<N extends AstNode> = (n: AstNode) => n is N;
958
- type Guarded<G> = G extends Guard<infer N> ? N : never;
959
- declare const isValidatableAstNode: (n: AstNode) => n is Guarded<typeof isRelation | typeof isLikeC4View | typeof isExtendElement | typeof isElement | typeof isDynamicViewPredicateIterator | typeof isElementPredicateWith | typeof isRelationPredicateWith | typeof isElementExpression | typeof isRelationExpression | typeof isDynamicViewParallelSteps | typeof isDynamicViewStep | typeof isViewProperty | typeof isStyleProperty | typeof isTags | typeof isViewRule | typeof isDynamicViewRule | typeof isElementViewBody | typeof isDynamicViewBody | typeof isRelationProperty | typeof isRelationBody | typeof isElementProperty | typeof isElementBody | typeof isExtendElementBody | typeof isSpecificationElementKind | typeof isSpecificationRelationshipKind | typeof isSpecificationTag | typeof isSpecificationColor | typeof isSpecificationRule | typeof isModelViews | typeof isModel>;
960
- type ValidatableAstNode = Guarded<typeof isValidatableAstNode>;
961
- declare function checksFromDiagnostics(doc: LikeC4LangiumDocument): {
962
- isValid: (n: ValidatableAstNode) => boolean;
963
- invalidNodes: WeakSet<any>;
964
- };
965
- type ChecksFromDiagnostics = ReturnType<typeof checksFromDiagnostics>;
966
-
967
- declare class LikeC4DocumentSymbolProvider implements DocumentSymbolProvider {
968
- private services;
969
- protected readonly nodeKindProvider: NodeKindProvider$1;
970
- constructor(services: LikeC4Services);
971
- getSymbols({ parseResult: { value: { specifications, models, views, likec4lib } } }: LikeC4LangiumDocument): MaybePromise<DocumentSymbol[]>;
972
- protected getLikec4LibSymbol(astLib: LikeC4Lib): DocumentSymbol[];
973
- protected getSpecSymbol(astSpec: SpecificationRule): DocumentSymbol[];
974
- protected getModelSymbol(astModel: Model): DocumentSymbol[];
975
- protected getElementsSymbol(el: Element | Relation | ExtendElement): DocumentSymbol[];
976
- protected getExtendElementSymbol(astElement: ExtendElement): DocumentSymbol[];
977
- protected getElementSymbol(astElement: Element): DocumentSymbol[];
978
- protected getModelViewsSymbol(astViews: ModelViews): DocumentSymbol[];
979
- protected getKindSymbol(astKind: SpecificationElementKind | SpecificationRelationshipKind): DocumentSymbol | null;
980
- protected getTagSymbol(astTag: SpecificationTag): DocumentSymbol | null;
981
- protected getLibIconSymbol(astTag: LibIcon): DocumentSymbol | null;
982
- protected getViewSymbol(astView: LikeC4View): DocumentSymbol[];
983
- protected symbolKind(node: AstNode): SymbolKind;
984
- }
985
-
986
- declare class LikeC4HoverProvider extends AstNodeHoverProvider {
987
- private locator;
988
- constructor(services: LikeC4Services);
989
- protected getAstNodeHoverContent(node: AstNode): MaybePromise<Hover | undefined>;
990
- }
991
-
992
- declare class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider {
993
- protected highlightElement(node: AstNode, acceptor: SemanticTokenAcceptor): void | undefined | 'prune';
994
- private highlightAstElement;
995
- private highlightView;
996
- }
997
-
998
- declare function computeDocumentFqn(document: LikeC4LangiumDocument, services: LikeC4Services): void;
999
-
1000
- interface FqnIndexEntry {
1001
- fqn: Fqn;
1002
- name: string;
1003
- el: Element;
1004
- doc: FqnIndexedDocument;
1005
- path: string;
1006
- }
1007
- declare class FqnIndex {
1008
- private services;
1009
- protected langiumDocuments: LangiumDocuments;
1010
- constructor(services: LikeC4Services);
1011
- get documents(): Stream<FqnIndexedDocument>;
1012
- private entries;
1013
- getFqn(el: Element): Fqn | null;
1014
- byFqn(fqn: Fqn): Stream<AstNodeDescription>;
1015
- directChildrenOf(parent: Fqn): Stream<AstNodeDescription>;
1016
- /**
1017
- * Returns descedant elements with unique names in the scope
1018
- */
1019
- uniqueDescedants(parent: Fqn): Stream<AstNodeDescription>;
1020
- }
1021
-
1022
- type ModelParsedListener$1 = (docs: URI[]) => void;
1023
- declare class LikeC4ModelBuilder {
1024
- private services;
1025
- private langiumDocuments;
1026
- private listeners;
1027
- constructor(services: LikeC4Services);
1028
- /**
1029
- * WARNING:
1030
- * This method is internal and should to be called only when all documents are known to be parsed.
1031
- * Otherwise, the model may be incomplete.
1032
- */
1033
- unsafeSyncBuildModel(): c4.ParsedLikeC4Model | null;
1034
- buildModel(cancelToken?: Cancellation.CancellationToken): Promise<c4.ParsedLikeC4Model | null>;
1035
- private previousViews;
1036
- /**
1037
- * WARNING:
1038
- * This method is internal and should to be called only when all documents are known to be parsed.
1039
- * Otherwise, the model may be incomplete.
1040
- */
1041
- unsafeSyncBuildComputedModel(model: c4.ParsedLikeC4Model): c4.ComputedLikeC4Model;
1042
- buildComputedModel(cancelToken?: Cancellation.CancellationToken): Promise<c4.ComputedLikeC4Model | null>;
1043
- computeView(viewId: ViewID, cancelToken?: Cancellation.CancellationToken): Promise<c4.ComputedView | null>;
1044
- onModelParsed(callback: ModelParsedListener$1): Disposable;
1045
- private documents;
1046
- private notifyListeners;
1047
- }
1048
-
1049
- declare class LikeC4ModelLocator {
1050
- private services;
1051
- private fqnIndex;
1052
- private langiumDocuments;
1053
- constructor(services: LikeC4Services);
1054
- private documents;
1055
- getParsedElement(astNode: Element): ParsedAstElement | null;
1056
- locateElement(fqn: c4.Fqn, _prop?: string): Location | null;
1057
- locateRelation(relationId: c4.RelationID): Location | null;
1058
- locateViewAst(viewId: c4.ViewID): {
1059
- doc: ParsedLikeC4LangiumDocument;
1060
- view: ParsedAstView;
1061
- viewAst: LikeC4View;
1062
- };
1063
- locateView(viewId: c4.ViewID): Location | null;
1064
- }
1065
-
1066
- type ModelParsedListener = () => void;
1067
- type IsValidFn = ChecksFromDiagnostics['isValid'];
1068
- declare class LikeC4ModelParser {
1069
- private services;
1070
- private fqnIndex;
1071
- constructor(services: LikeC4Services);
1072
- parse(doc: LangiumDocument | LangiumDocument[]): ParsedLikeC4LangiumDocument[];
1073
- protected parseLikeC4Document(_doc: FqnIndexedDocument): ParsedLikeC4LangiumDocument;
1074
- private parseSpecification;
1075
- private parseModel;
1076
- private parseElement;
1077
- private parseRelation;
1078
- private parseViews;
1079
- private parseViewRulePredicate;
1080
- private parsePredicate;
1081
- private parseElementExpressionsIterator;
1082
- private parseElementPredicate;
1083
- private parseElementExpr;
1084
- private parseElementPredicateWith;
1085
- private parseElementPredicateWhere;
1086
- private parseRelationPredicate;
1087
- private parseRelationPredicateWhere;
1088
- private parseRelationPredicateWith;
1089
- private parseRelationExpr;
1090
- private parseViewRule;
1091
- private parseViewRuleStyle;
1092
- private parseRuleStyle;
1093
- private parseViewManualLaout;
1094
- private parseDynamicParallelSteps;
1095
- private parseDynamicStep;
1096
- private parseElementView;
1097
- private parseDynamicElementView;
1098
- private parseDynamicViewRule;
1099
- private parseDynamicViewIncludePredicate;
1100
- protected resolveFqn(node: Element | ExtendElement): c4.Fqn;
1101
- private getAstNodePath;
1102
- private getMetadata;
1103
- private convertTags;
1104
- private convertLinks;
1105
- }
1106
-
1107
- declare class LikeC4ModelChanges {
1108
- private services;
1109
- private locator;
1110
- constructor(services: LikeC4Services);
1111
- applyChange(changeView: ChangeViewRequestParams): Promise<Location | null>;
1112
- protected convertToTextEdit({ viewId, change }: ChangeViewRequestParams): {
1113
- doc: ParsedLikeC4LangiumDocument;
1114
- modifiedRange: Range;
1115
- edits: TextEdit[];
1116
- };
1117
- }
1118
-
1119
- type ElementsContainer = Model | ElementBody | ExtendElementBody;
1120
- declare class LikeC4ScopeComputation extends DefaultScopeComputation {
1121
- computeExports(document: LikeC4LangiumDocument, _cancelToken?: CancellationToken): Promise<AstNodeDescription[]>;
1122
- private exportViews;
1123
- private exportModel;
1124
- private exportLibrary;
1125
- private exportSpecification;
1126
- computeLocalScopes(document: LikeC4LangiumDocument, _cancelToken?: CancellationToken): Promise<PrecomputedScopes>;
1127
- protected processContainer(container: ElementsContainer, scopes: PrecomputedScopes, document: LikeC4LangiumDocument): MultiMap<string, AstNodeDescription>;
1128
- }
1129
-
1130
- declare class LikeC4ScopeProvider extends DefaultScopeProvider {
1131
- private fqnIndex;
1132
- constructor(services: LikeC4Services);
1133
- private directChildrenOf;
1134
- private uniqueDescedants;
1135
- private scopeElementRef;
1136
- private scopeExtendElement;
1137
- private scopeElementView;
1138
- getScope(context: ReferenceInfo): Scope;
1139
- protected computeScope(context: ReferenceInfo): Scope;
1140
- /**
1141
- * Create a global scope filtered for the given reference type.
1142
- */
1143
- protected getGlobalScope(referenceType: string): Scope;
1144
- }
1145
-
1146
- declare class Rpc implements Disposable {
1147
- private services;
1148
- private disposables;
1149
- constructor(services: LikeC4Services);
1150
- init(): void;
1151
- dispose(): void;
1152
- }
1153
-
1154
- declare class NodeKindProvider implements NodeKindProvider$1 {
1155
- private services;
1156
- constructor(services: LangiumSharedServices);
1157
- /**
1158
- * Returns a `SymbolKind` as used by `WorkspaceSymbolProvider` or `DocumentSymbolProvider`.
1159
- */
1160
- getSymbolKind(node: AstNode | AstNodeDescription): SymbolKind;
1161
- /**
1162
- * Returns a `CompletionItemKind` as used by the `CompletionProvider`.
1163
- */
1164
- getCompletionItemKind(node: AstNode | AstNodeDescription): CompletionItemKind;
1165
- }
1166
-
1167
- declare class LikeC4WorkspaceManager extends DefaultWorkspaceManager {
1168
- private documentFactory;
1169
- constructor(services: LangiumSharedServices);
1170
- /**
1171
- * Load all additional documents that shall be visible in the context of the given workspace
1172
- * folders and add them to the collector. This can be used to include built-in libraries of
1173
- * your language, which can be either loaded from provided files or constructed in memory.
1174
- */
1175
- protected loadAdditionalDocuments(folders: WorkspaceFolder[], collector: (document: LangiumDocument) => void): Promise<void>;
1176
- workspace(): WorkspaceFolder;
1177
- get workspaceUri(): URI$1;
1178
- get workspaceURL(): URL;
1179
- }
1180
-
1181
- declare class WorkspaceSymbolProvider extends DefaultWorkspaceSymbolProvider {
1182
- }
1183
-
1184
- interface LikeC4AddedSharedServices {
1185
- lsp: {
1186
- NodeKindProvider: NodeKindProvider;
1187
- WorkspaceSymbolProvider: WorkspaceSymbolProvider;
1188
- };
1189
- workspace: {
1190
- WorkspaceManager: LikeC4WorkspaceManager;
1191
- };
1192
- }
1193
- type LikeC4SharedServices = LangiumSharedServices & LikeC4AddedSharedServices;
1194
- /**
1195
- * Declaration of custom services - add your own service classes here.
1196
- */
1197
- interface LikeC4AddedServices {
1198
- WorkspaceCache: WorkspaceCache<string, any>;
1199
- Rpc: Rpc;
1200
- likec4: {
1201
- FqnIndex: FqnIndex;
1202
- ModelParser: LikeC4ModelParser;
1203
- ModelBuilder: LikeC4ModelBuilder;
1204
- ModelLocator: LikeC4ModelLocator;
1205
- ModelChanges: LikeC4ModelChanges;
1206
- };
1207
- lsp: {
1208
- CompletionProvider: LikeC4CompletionProvider;
1209
- DocumentHighlightProvider: LikeC4DocumentHighlightProvider;
1210
- DocumentSymbolProvider: LikeC4DocumentSymbolProvider;
1211
- SemanticTokenProvider: LikeC4SemanticTokenProvider;
1212
- HoverProvider: LikeC4HoverProvider;
1213
- CodeLensProvider: LikeC4CodeLensProvider;
1214
- DocumentLinkProvider: LikeC4DocumentLinkProvider;
1215
- };
1216
- references: {
1217
- ScopeComputation: LikeC4ScopeComputation;
1218
- ScopeProvider: LikeC4ScopeProvider;
1219
- };
1220
- shared?: LikeC4SharedServices;
1221
- }
1222
- type LikeC4Services = LangiumServices & LikeC4AddedServices;
1223
- declare const LikeC4Module: Module<LikeC4Services, PartialLangiumServices & LikeC4AddedServices>;
1224
- type LanguageServicesContext = Partial<DefaultSharedModuleContext>;
1225
- declare function createCustomLanguageServices<I1, I2, I3, I extends I1 & I2 & I3 & LikeC4Services>(context: LanguageServicesContext, module: Module<I, I1>, module2?: Module<I, I2>, module3?: Module<I, I3>): {
1226
- shared: LikeC4SharedServices;
1227
- likec4: I;
1228
- };
1229
- declare function createSharedServices(context?: LanguageServicesContext): LikeC4SharedServices;
1230
- declare function createLanguageServices(context?: LanguageServicesContext): {
1231
- shared: LikeC4SharedServices;
1232
- likec4: LikeC4Services;
1233
- };
1234
-
1235
- declare const logger: _likec4_log.ConsolaInstance;
1236
- declare function setLogLevel(level: keyof typeof LogLevels): void;
1237
-
1238
- export { type FqnIndexEntry as F, type IsValidFn as I, type LikeC4SharedServices as L, type ModelParsedListener as M, type LikeC4Services as a, createLanguageServices as b, createCustomLanguageServices as c, LikeC4Module as d, computeDocumentFqn as e, FqnIndex as f, LikeC4ModelBuilder as g, LikeC4ModelLocator as h, LikeC4ModelParser as i, type LikeC4AddedServices as j, type LanguageServicesContext as k, createSharedServices as l, logger as m, setLogLevel as s };