@likec4/language-server 1.10.0 → 1.11.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 (55) hide show
  1. package/dist/browser.cjs +5 -1
  2. package/dist/browser.d.cts +9 -8
  3. package/dist/browser.d.mts +9 -8
  4. package/dist/browser.d.ts +9 -8
  5. package/dist/browser.mjs +3 -2
  6. package/dist/index.cjs +15 -2
  7. package/dist/index.d.cts +14 -11
  8. package/dist/index.d.mts +14 -11
  9. package/dist/index.d.ts +14 -11
  10. package/dist/index.mjs +17 -1
  11. package/dist/likec4lib.cjs +949 -952
  12. package/dist/likec4lib.d.cts +1 -1
  13. package/dist/likec4lib.d.mts +1 -1
  14. package/dist/likec4lib.d.ts +1 -1
  15. package/dist/likec4lib.mjs +949 -952
  16. package/dist/model-graph/index.cjs +1 -1
  17. package/dist/model-graph/index.mjs +1 -1
  18. package/dist/protocol.cjs +1 -1
  19. package/dist/protocol.d.cts +3 -1
  20. package/dist/protocol.d.mts +3 -1
  21. package/dist/protocol.d.ts +3 -1
  22. package/dist/protocol.mjs +1 -1
  23. package/dist/shared/{language-server.JWkqVjGv.cjs → language-server.C8lV6gDw.cjs} +120 -118
  24. package/dist/shared/{language-server.DBJJUUgF.mjs → language-server.CCOotWDz.mjs} +120 -119
  25. package/dist/shared/{language-server.DtBRb9os.mjs → language-server.CbqwHp7Q.mjs} +23 -9
  26. package/dist/shared/{language-server.CtKHXJDD.d.ts → language-server.Cyw-bCtc.d.ts} +145 -138
  27. package/dist/shared/{language-server.D-84I33F.d.mts → language-server.DGjTE7xL.d.mts} +145 -138
  28. package/dist/shared/{language-server.DwyCJvXm.cjs → language-server.DJhoJBWh.cjs} +17 -3
  29. package/dist/shared/{language-server.CjFzaJwI.d.cts → language-server.Ol32Kygo.d.cts} +145 -138
  30. package/package.json +34 -29
  31. package/src/Rpc.ts +10 -6
  32. package/src/ast.ts +1 -1
  33. package/src/browser.ts +5 -0
  34. package/src/formatting/LikeC4Formatter.ts +4 -2
  35. package/src/generated/ast.ts +99 -1
  36. package/src/generated/grammar.ts +1 -1
  37. package/src/generated/module.ts +1 -1
  38. package/src/generated-lib/icons.ts +949 -952
  39. package/src/index.ts +23 -2
  40. package/src/likec4lib.ts +1 -1
  41. package/src/logger.ts +16 -16
  42. package/src/lsp/CompletionProvider.ts +1 -1
  43. package/src/model/model-builder.ts +12 -12
  44. package/src/model-graph/compute-view/compute.ts +9 -4
  45. package/src/model-graph/utils/applyCustomRelationProperties.ts +1 -1
  46. package/src/model-graph/utils/uniqueTags.test.ts +42 -0
  47. package/src/model-graph/utils/uniqueTags.ts +19 -0
  48. package/src/protocol.ts +5 -1
  49. package/src/shared/WorkspaceManager.ts +1 -1
  50. package/dist/node.cjs +0 -18
  51. package/dist/node.d.cts +0 -20
  52. package/dist/node.d.mts +0 -20
  53. package/dist/node.d.ts +0 -20
  54. package/dist/node.mjs +0 -16
  55. package/src/node.ts +0 -20
@@ -1,15 +1,44 @@
1
+ import { LangiumDocument, ReferenceDescription, MaybePromise, AstNode, Reference, MultiMap, AstNodeDescription, DiagnosticInfo, LangiumDocuments, Stream, Cancellation, Disposable, URI, DefaultScopeComputation, PrecomputedScopes, DefaultScopeProvider, ReferenceInfo, Scope, DefaultWorkspaceManager, WorkspaceCache, Module } from 'langium';
2
+ import { CodeLensProvider, DefaultCompletionProvider, 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';
1
5
  import * as c4 from '@likec4/core';
2
6
  import { Fqn, ViewID } from '@likec4/core';
3
- import { AstNode, Reference, LangiumDocument, MultiMap, AstNodeDescription, DiagnosticInfo, ReferenceDescription, MaybePromise, DefaultScopeComputation, PrecomputedScopes, DefaultScopeProvider, ReferenceInfo, Scope, Disposable, DefaultWorkspaceManager, WorkspaceCache, Module, LangiumDocuments, Stream, Cancellation, URI as URI$1 } from 'langium';
4
7
  import { SetRequired, ValueOf, ConditionalPick } from 'type-fest';
5
- import { Diagnostic, DocumentSymbol, SymbolKind, Hover, Location, Range, TextEdit, CompletionItemKind } from 'vscode-languageserver-types';
6
- import { CodeLensProvider, DefaultCompletionProvider, DefaultDocumentHighlightProvider, DocumentLinkProvider, DocumentSymbolProvider, NodeKindProvider as NodeKindProvider$1, AstNodeHoverProvider, AbstractSemanticTokenProvider, SemanticTokenAcceptor, LangiumSharedServices, DefaultWorkspaceSymbolProvider, LangiumServices, PartialLangiumServices, DefaultSharedModuleContext } from 'langium/lsp';
7
- import { CodeLensParams, CancellationToken, CodeLens, DocumentHighlight, DocumentLinkParams, DocumentLink, WorkspaceFolder } from 'vscode-languageserver';
8
8
  import { ChangeViewRequestParams } from '../protocol.js';
9
- import { URI } from 'vscode-uri';
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
+ }
24
+
25
+ declare class LikeC4DocumentHighlightProvider extends DefaultDocumentHighlightProvider {
26
+ /**
27
+ * Override this method to determine the highlight kind of the given reference.
28
+ */
29
+ protected createDocumentHighlight(reference: ReferenceDescription): DocumentHighlight;
30
+ }
31
+
32
+ declare class LikeC4DocumentLinkProvider implements DocumentLinkProvider {
33
+ private services;
34
+ constructor(services: LikeC4Services);
35
+ getDocumentLinks(doc: LangiumDocument, _params: DocumentLinkParams): MaybePromise<DocumentLink[]>;
36
+ resolveLink(doc: LangiumDocument, link: string): string;
37
+ relativeLink(doc: LangiumDocument, link: string): string | null;
38
+ }
10
39
 
11
40
  /******************************************************************************
12
- * This file was generated by langium-cli 3.1.1.
41
+ * This file was generated by langium-cli 3.2.0.
13
42
  * DO NOT EDIT MANUALLY!
14
43
  ******************************************************************************/
15
44
 
@@ -923,7 +952,7 @@ interface ParsedLikeC4LangiumDocument extends Omit<LangiumDocument<LikeC4Grammar
923
952
  }
924
953
  type Guard<N extends AstNode> = (n: AstNode) => n is N;
925
954
  type Guarded<G> = G extends Guard<infer N> ? N : never;
926
- declare const isValidatableAstNode: (n: AstNode) => n is Guarded<typeof isLikeC4View | typeof isRelation | 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>;
955
+ declare const isValidatableAstNode: (n: AstNode) => n is Guarded<typeof isRelation | typeof isExtendElement | typeof isElement | typeof isLikeC4View | 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>;
927
956
  type ValidatableAstNode = Guarded<typeof isValidatableAstNode>;
928
957
  declare function checksFromDiagnostics(doc: LikeC4LangiumDocument): {
929
958
  isValid: (n: ValidatableAstNode) => boolean;
@@ -931,33 +960,6 @@ declare function checksFromDiagnostics(doc: LikeC4LangiumDocument): {
931
960
  };
932
961
  type ChecksFromDiagnostics = ReturnType<typeof checksFromDiagnostics>;
933
962
 
934
- declare class LikeC4CodeLensProvider implements CodeLensProvider {
935
- private services;
936
- constructor(services: LikeC4Services);
937
- provideCodeLens(doc: LangiumDocument, _params: CodeLensParams, cancelToken?: CancellationToken): Promise<CodeLens[] | undefined>;
938
- }
939
-
940
- declare class LikeC4CompletionProvider extends DefaultCompletionProvider {
941
- readonly completionOptions: {
942
- triggerCharacters: string[];
943
- };
944
- }
945
-
946
- declare class LikeC4DocumentHighlightProvider extends DefaultDocumentHighlightProvider {
947
- /**
948
- * Override this method to determine the highlight kind of the given reference.
949
- */
950
- protected createDocumentHighlight(reference: ReferenceDescription): DocumentHighlight;
951
- }
952
-
953
- declare class LikeC4DocumentLinkProvider implements DocumentLinkProvider {
954
- private services;
955
- constructor(services: LikeC4Services);
956
- getDocumentLinks(doc: LangiumDocument, _params: DocumentLinkParams): MaybePromise<DocumentLink[]>;
957
- resolveLink(doc: LangiumDocument, link: string): string;
958
- relativeLink(doc: LangiumDocument, link: string): string | null;
959
- }
960
-
961
963
  declare class LikeC4DocumentSymbolProvider implements DocumentSymbolProvider {
962
964
  private services;
963
965
  protected readonly nodeKindProvider: NodeKindProvider$1;
@@ -989,6 +991,111 @@ declare class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider
989
991
  private highlightView;
990
992
  }
991
993
 
994
+ declare function computeDocumentFqn(document: LikeC4LangiumDocument, services: LikeC4Services): void;
995
+
996
+ interface FqnIndexEntry {
997
+ fqn: Fqn;
998
+ name: string;
999
+ el: Element;
1000
+ doc: FqnIndexedDocument;
1001
+ path: string;
1002
+ }
1003
+ declare class FqnIndex {
1004
+ private services;
1005
+ protected langiumDocuments: LangiumDocuments;
1006
+ constructor(services: LikeC4Services);
1007
+ get documents(): Stream<FqnIndexedDocument>;
1008
+ private entries;
1009
+ getFqn(el: Element): Fqn | null;
1010
+ byFqn(fqn: Fqn): Stream<AstNodeDescription>;
1011
+ directChildrenOf(parent: Fqn): Stream<AstNodeDescription>;
1012
+ /**
1013
+ * Returns descedant elements with unique names in the scope
1014
+ */
1015
+ uniqueDescedants(parent: Fqn): Stream<AstNodeDescription>;
1016
+ }
1017
+
1018
+ type ModelParsedListener$1 = (docs: URI[]) => void;
1019
+ declare class LikeC4ModelBuilder {
1020
+ private services;
1021
+ private langiumDocuments;
1022
+ private listeners;
1023
+ constructor(services: LikeC4Services);
1024
+ /**
1025
+ * WARNING:
1026
+ * This method is internal and should to be called only when all documents are known to be parsed.
1027
+ * Otherwise, the model may be incomplete.
1028
+ */
1029
+ unsafeSyncBuildModel(): c4.ParsedLikeC4Model | null;
1030
+ buildModel(cancelToken?: Cancellation.CancellationToken): Promise<c4.ParsedLikeC4Model | null>;
1031
+ private previousViews;
1032
+ /**
1033
+ * WARNING:
1034
+ * This method is internal and should to be called only when all documents are known to be parsed.
1035
+ * Otherwise, the model may be incomplete.
1036
+ */
1037
+ unsafeSyncBuildComputedModel(model: c4.ParsedLikeC4Model): c4.ComputedLikeC4Model;
1038
+ buildComputedModel(cancelToken?: Cancellation.CancellationToken): Promise<c4.ComputedLikeC4Model | null>;
1039
+ computeView(viewId: ViewID, cancelToken?: Cancellation.CancellationToken): Promise<c4.ComputedView | null>;
1040
+ onModelParsed(callback: ModelParsedListener$1): Disposable;
1041
+ private documents;
1042
+ private notifyListeners;
1043
+ }
1044
+
1045
+ declare class LikeC4ModelLocator {
1046
+ private services;
1047
+ private fqnIndex;
1048
+ private langiumDocuments;
1049
+ constructor(services: LikeC4Services);
1050
+ private documents;
1051
+ getParsedElement(astNode: Element): ParsedAstElement | null;
1052
+ locateElement(fqn: c4.Fqn, _prop?: string): Location | null;
1053
+ locateRelation(relationId: c4.RelationID): Location | null;
1054
+ locateViewAst(viewId: c4.ViewID): {
1055
+ doc: ParsedLikeC4LangiumDocument;
1056
+ view: ParsedAstView;
1057
+ viewAst: LikeC4View;
1058
+ };
1059
+ locateView(viewId: c4.ViewID): Location | null;
1060
+ }
1061
+
1062
+ type ModelParsedListener = () => void;
1063
+ type IsValidFn = ChecksFromDiagnostics['isValid'];
1064
+ declare class LikeC4ModelParser {
1065
+ private services;
1066
+ private fqnIndex;
1067
+ constructor(services: LikeC4Services);
1068
+ parse(doc: LangiumDocument | LangiumDocument[]): ParsedLikeC4LangiumDocument[];
1069
+ protected parseLikeC4Document(_doc: FqnIndexedDocument): ParsedLikeC4LangiumDocument;
1070
+ private parseSpecification;
1071
+ private parseModel;
1072
+ private parseElement;
1073
+ private parseRelation;
1074
+ private parseViews;
1075
+ private parseViewRulePredicate;
1076
+ private parsePredicate;
1077
+ private parseElementExpressionsIterator;
1078
+ private parseElementPredicate;
1079
+ private parseElementExpr;
1080
+ private parseElementPredicateWith;
1081
+ private parseElementPredicateWhere;
1082
+ private parseRelationPredicate;
1083
+ private parseRelationPredicateWhere;
1084
+ private parseRelationPredicateWith;
1085
+ private parseRelationExpr;
1086
+ private parseViewRule;
1087
+ private parseViewManualLaout;
1088
+ private parseDynamicParallelSteps;
1089
+ private parseDynamicStep;
1090
+ private parseElementView;
1091
+ private parseDynamicElementView;
1092
+ protected resolveFqn(node: Element | ExtendElement): c4.Fqn;
1093
+ private getAstNodePath;
1094
+ private getMetadata;
1095
+ private convertTags;
1096
+ private convertLinks;
1097
+ }
1098
+
992
1099
  declare class LikeC4ModelChanges {
993
1100
  private services;
994
1101
  private locator;
@@ -1059,7 +1166,7 @@ declare class LikeC4WorkspaceManager extends DefaultWorkspaceManager {
1059
1166
  */
1060
1167
  protected loadAdditionalDocuments(folders: WorkspaceFolder[], collector: (document: LangiumDocument) => void): Promise<void>;
1061
1168
  workspace(): WorkspaceFolder;
1062
- get workspaceUri(): URI;
1169
+ get workspaceUri(): URI$1;
1063
1170
  get workspaceURL(): URL;
1064
1171
  }
1065
1172
 
@@ -1117,107 +1224,7 @@ declare function createLanguageServices(context?: LanguageServicesContext): {
1117
1224
  likec4: LikeC4Services;
1118
1225
  };
1119
1226
 
1120
- interface FqnIndexEntry {
1121
- fqn: Fqn;
1122
- name: string;
1123
- el: Element;
1124
- doc: FqnIndexedDocument;
1125
- path: string;
1126
- }
1127
- declare class FqnIndex {
1128
- private services;
1129
- protected langiumDocuments: LangiumDocuments;
1130
- constructor(services: LikeC4Services);
1131
- get documents(): Stream<FqnIndexedDocument>;
1132
- private entries;
1133
- getFqn(el: Element): Fqn | null;
1134
- byFqn(fqn: Fqn): Stream<AstNodeDescription>;
1135
- directChildrenOf(parent: Fqn): Stream<AstNodeDescription>;
1136
- /**
1137
- * Returns descedant elements with unique names in the scope
1138
- */
1139
- uniqueDescedants(parent: Fqn): Stream<AstNodeDescription>;
1140
- }
1141
-
1142
- type ModelParsedListener$1 = (docs: URI$1[]) => void;
1143
- declare class LikeC4ModelBuilder {
1144
- private services;
1145
- private langiumDocuments;
1146
- private listeners;
1147
- constructor(services: LikeC4Services);
1148
- /**
1149
- * WARNING:
1150
- * This method is internal and should to be called only when all documents are known to be parsed.
1151
- * Otherwise, the model may be incomplete.
1152
- */
1153
- unsafeSyncBuildModel(): c4.ParsedLikeC4Model | null;
1154
- buildModel(cancelToken?: Cancellation.CancellationToken): Promise<c4.ParsedLikeC4Model | null>;
1155
- private previousViews;
1156
- /**
1157
- * WARNING:
1158
- * This method is internal and should to be called only when all documents are known to be parsed.
1159
- * Otherwise, the model may be incomplete.
1160
- */
1161
- unsafeSyncBuildComputedModel(model: c4.ParsedLikeC4Model): c4.ComputedLikeC4Model;
1162
- buildComputedModel(cancelToken?: Cancellation.CancellationToken): Promise<c4.ComputedLikeC4Model | null>;
1163
- computeView(viewId: ViewID, cancelToken?: Cancellation.CancellationToken): Promise<c4.ComputedView | null>;
1164
- onModelParsed(callback: ModelParsedListener$1): Disposable;
1165
- private documents;
1166
- private notifyListeners;
1167
- }
1168
-
1169
- declare class LikeC4ModelLocator {
1170
- private services;
1171
- private fqnIndex;
1172
- private langiumDocuments;
1173
- constructor(services: LikeC4Services);
1174
- private documents;
1175
- getParsedElement(astNode: Element): ParsedAstElement | null;
1176
- locateElement(fqn: c4.Fqn, _prop?: string): Location | null;
1177
- locateRelation(relationId: c4.RelationID): Location | null;
1178
- locateViewAst(viewId: c4.ViewID): {
1179
- doc: ParsedLikeC4LangiumDocument;
1180
- view: ParsedAstView;
1181
- viewAst: LikeC4View;
1182
- };
1183
- locateView(viewId: c4.ViewID): Location | null;
1184
- }
1185
-
1186
- type ModelParsedListener = () => void;
1187
- type IsValidFn = ChecksFromDiagnostics['isValid'];
1188
- declare class LikeC4ModelParser {
1189
- private services;
1190
- private fqnIndex;
1191
- constructor(services: LikeC4Services);
1192
- parse(doc: LangiumDocument | LangiumDocument[]): ParsedLikeC4LangiumDocument[];
1193
- protected parseLikeC4Document(_doc: FqnIndexedDocument): ParsedLikeC4LangiumDocument;
1194
- private parseSpecification;
1195
- private parseModel;
1196
- private parseElement;
1197
- private parseRelation;
1198
- private parseViews;
1199
- private parseViewRulePredicate;
1200
- private parsePredicate;
1201
- private parseElementExpressionsIterator;
1202
- private parseElementPredicate;
1203
- private parseElementExpr;
1204
- private parseElementPredicateWith;
1205
- private parseElementPredicateWhere;
1206
- private parseRelationPredicate;
1207
- private parseRelationPredicateWhere;
1208
- private parseRelationPredicateWith;
1209
- private parseRelationExpr;
1210
- private parseViewRule;
1211
- private parseViewManualLaout;
1212
- private parseDynamicParallelSteps;
1213
- private parseDynamicStep;
1214
- private parseElementView;
1215
- private parseDynamicElementView;
1216
- protected resolveFqn(node: Element | ExtendElement): c4.Fqn;
1217
- private getAstNodePath;
1218
- private getMetadata;
1219
- private convertTags;
1220
- private convertLinks;
1221
- }
1227
+ declare const logger: _likec4_log.ConsolaInstance;
1228
+ declare function setLogLevel(level: keyof typeof LogLevels): void;
1222
1229
 
1223
- export { type FqnIndexEntry as F, type IsValidFn as I, type LikeC4LangiumDocument as L, type ModelParsedListener as M, type LikeC4Services as a, createLanguageServices as b, createCustomLanguageServices as c, LikeC4Module as d, FqnIndex as e, LikeC4ModelBuilder as f, LikeC4ModelLocator as g, LikeC4ModelParser as h, type LikeC4SharedServices as i, type LikeC4AddedServices as j, type LanguageServicesContext as k, createSharedServices as l };
1230
+ 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 };
@@ -1,15 +1,44 @@
1
+ import { LangiumDocument, ReferenceDescription, MaybePromise, AstNode, Reference, MultiMap, AstNodeDescription, DiagnosticInfo, LangiumDocuments, Stream, Cancellation, Disposable, URI, DefaultScopeComputation, PrecomputedScopes, DefaultScopeProvider, ReferenceInfo, Scope, DefaultWorkspaceManager, WorkspaceCache, Module } from 'langium';
2
+ import { CodeLensProvider, DefaultCompletionProvider, 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';
1
5
  import * as c4 from '@likec4/core';
2
6
  import { Fqn, ViewID } from '@likec4/core';
3
- import { AstNode, Reference, LangiumDocument, MultiMap, AstNodeDescription, DiagnosticInfo, ReferenceDescription, MaybePromise, DefaultScopeComputation, PrecomputedScopes, DefaultScopeProvider, ReferenceInfo, Scope, Disposable, DefaultWorkspaceManager, WorkspaceCache, Module, LangiumDocuments, Stream, Cancellation, URI as URI$1 } from 'langium';
4
7
  import { SetRequired, ValueOf, ConditionalPick } from 'type-fest';
5
- import { Diagnostic, DocumentSymbol, SymbolKind, Hover, Location, Range, TextEdit, CompletionItemKind } from 'vscode-languageserver-types';
6
- import { CodeLensProvider, DefaultCompletionProvider, DefaultDocumentHighlightProvider, DocumentLinkProvider, DocumentSymbolProvider, NodeKindProvider as NodeKindProvider$1, AstNodeHoverProvider, AbstractSemanticTokenProvider, SemanticTokenAcceptor, LangiumSharedServices, DefaultWorkspaceSymbolProvider, LangiumServices, PartialLangiumServices, DefaultSharedModuleContext } from 'langium/lsp';
7
- import { CodeLensParams, CancellationToken, CodeLens, DocumentHighlight, DocumentLinkParams, DocumentLink, WorkspaceFolder } from 'vscode-languageserver';
8
8
  import { ChangeViewRequestParams } from '../protocol.mjs';
9
- import { URI } from 'vscode-uri';
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
+ }
24
+
25
+ declare class LikeC4DocumentHighlightProvider extends DefaultDocumentHighlightProvider {
26
+ /**
27
+ * Override this method to determine the highlight kind of the given reference.
28
+ */
29
+ protected createDocumentHighlight(reference: ReferenceDescription): DocumentHighlight;
30
+ }
31
+
32
+ declare class LikeC4DocumentLinkProvider implements DocumentLinkProvider {
33
+ private services;
34
+ constructor(services: LikeC4Services);
35
+ getDocumentLinks(doc: LangiumDocument, _params: DocumentLinkParams): MaybePromise<DocumentLink[]>;
36
+ resolveLink(doc: LangiumDocument, link: string): string;
37
+ relativeLink(doc: LangiumDocument, link: string): string | null;
38
+ }
10
39
 
11
40
  /******************************************************************************
12
- * This file was generated by langium-cli 3.1.1.
41
+ * This file was generated by langium-cli 3.2.0.
13
42
  * DO NOT EDIT MANUALLY!
14
43
  ******************************************************************************/
15
44
 
@@ -923,7 +952,7 @@ interface ParsedLikeC4LangiumDocument extends Omit<LangiumDocument<LikeC4Grammar
923
952
  }
924
953
  type Guard<N extends AstNode> = (n: AstNode) => n is N;
925
954
  type Guarded<G> = G extends Guard<infer N> ? N : never;
926
- declare const isValidatableAstNode: (n: AstNode) => n is Guarded<typeof isLikeC4View | typeof isRelation | 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>;
955
+ declare const isValidatableAstNode: (n: AstNode) => n is Guarded<typeof isRelation | typeof isExtendElement | typeof isElement | typeof isLikeC4View | 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>;
927
956
  type ValidatableAstNode = Guarded<typeof isValidatableAstNode>;
928
957
  declare function checksFromDiagnostics(doc: LikeC4LangiumDocument): {
929
958
  isValid: (n: ValidatableAstNode) => boolean;
@@ -931,33 +960,6 @@ declare function checksFromDiagnostics(doc: LikeC4LangiumDocument): {
931
960
  };
932
961
  type ChecksFromDiagnostics = ReturnType<typeof checksFromDiagnostics>;
933
962
 
934
- declare class LikeC4CodeLensProvider implements CodeLensProvider {
935
- private services;
936
- constructor(services: LikeC4Services);
937
- provideCodeLens(doc: LangiumDocument, _params: CodeLensParams, cancelToken?: CancellationToken): Promise<CodeLens[] | undefined>;
938
- }
939
-
940
- declare class LikeC4CompletionProvider extends DefaultCompletionProvider {
941
- readonly completionOptions: {
942
- triggerCharacters: string[];
943
- };
944
- }
945
-
946
- declare class LikeC4DocumentHighlightProvider extends DefaultDocumentHighlightProvider {
947
- /**
948
- * Override this method to determine the highlight kind of the given reference.
949
- */
950
- protected createDocumentHighlight(reference: ReferenceDescription): DocumentHighlight;
951
- }
952
-
953
- declare class LikeC4DocumentLinkProvider implements DocumentLinkProvider {
954
- private services;
955
- constructor(services: LikeC4Services);
956
- getDocumentLinks(doc: LangiumDocument, _params: DocumentLinkParams): MaybePromise<DocumentLink[]>;
957
- resolveLink(doc: LangiumDocument, link: string): string;
958
- relativeLink(doc: LangiumDocument, link: string): string | null;
959
- }
960
-
961
963
  declare class LikeC4DocumentSymbolProvider implements DocumentSymbolProvider {
962
964
  private services;
963
965
  protected readonly nodeKindProvider: NodeKindProvider$1;
@@ -989,6 +991,111 @@ declare class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider
989
991
  private highlightView;
990
992
  }
991
993
 
994
+ declare function computeDocumentFqn(document: LikeC4LangiumDocument, services: LikeC4Services): void;
995
+
996
+ interface FqnIndexEntry {
997
+ fqn: Fqn;
998
+ name: string;
999
+ el: Element;
1000
+ doc: FqnIndexedDocument;
1001
+ path: string;
1002
+ }
1003
+ declare class FqnIndex {
1004
+ private services;
1005
+ protected langiumDocuments: LangiumDocuments;
1006
+ constructor(services: LikeC4Services);
1007
+ get documents(): Stream<FqnIndexedDocument>;
1008
+ private entries;
1009
+ getFqn(el: Element): Fqn | null;
1010
+ byFqn(fqn: Fqn): Stream<AstNodeDescription>;
1011
+ directChildrenOf(parent: Fqn): Stream<AstNodeDescription>;
1012
+ /**
1013
+ * Returns descedant elements with unique names in the scope
1014
+ */
1015
+ uniqueDescedants(parent: Fqn): Stream<AstNodeDescription>;
1016
+ }
1017
+
1018
+ type ModelParsedListener$1 = (docs: URI[]) => void;
1019
+ declare class LikeC4ModelBuilder {
1020
+ private services;
1021
+ private langiumDocuments;
1022
+ private listeners;
1023
+ constructor(services: LikeC4Services);
1024
+ /**
1025
+ * WARNING:
1026
+ * This method is internal and should to be called only when all documents are known to be parsed.
1027
+ * Otherwise, the model may be incomplete.
1028
+ */
1029
+ unsafeSyncBuildModel(): c4.ParsedLikeC4Model | null;
1030
+ buildModel(cancelToken?: Cancellation.CancellationToken): Promise<c4.ParsedLikeC4Model | null>;
1031
+ private previousViews;
1032
+ /**
1033
+ * WARNING:
1034
+ * This method is internal and should to be called only when all documents are known to be parsed.
1035
+ * Otherwise, the model may be incomplete.
1036
+ */
1037
+ unsafeSyncBuildComputedModel(model: c4.ParsedLikeC4Model): c4.ComputedLikeC4Model;
1038
+ buildComputedModel(cancelToken?: Cancellation.CancellationToken): Promise<c4.ComputedLikeC4Model | null>;
1039
+ computeView(viewId: ViewID, cancelToken?: Cancellation.CancellationToken): Promise<c4.ComputedView | null>;
1040
+ onModelParsed(callback: ModelParsedListener$1): Disposable;
1041
+ private documents;
1042
+ private notifyListeners;
1043
+ }
1044
+
1045
+ declare class LikeC4ModelLocator {
1046
+ private services;
1047
+ private fqnIndex;
1048
+ private langiumDocuments;
1049
+ constructor(services: LikeC4Services);
1050
+ private documents;
1051
+ getParsedElement(astNode: Element): ParsedAstElement | null;
1052
+ locateElement(fqn: c4.Fqn, _prop?: string): Location | null;
1053
+ locateRelation(relationId: c4.RelationID): Location | null;
1054
+ locateViewAst(viewId: c4.ViewID): {
1055
+ doc: ParsedLikeC4LangiumDocument;
1056
+ view: ParsedAstView;
1057
+ viewAst: LikeC4View;
1058
+ };
1059
+ locateView(viewId: c4.ViewID): Location | null;
1060
+ }
1061
+
1062
+ type ModelParsedListener = () => void;
1063
+ type IsValidFn = ChecksFromDiagnostics['isValid'];
1064
+ declare class LikeC4ModelParser {
1065
+ private services;
1066
+ private fqnIndex;
1067
+ constructor(services: LikeC4Services);
1068
+ parse(doc: LangiumDocument | LangiumDocument[]): ParsedLikeC4LangiumDocument[];
1069
+ protected parseLikeC4Document(_doc: FqnIndexedDocument): ParsedLikeC4LangiumDocument;
1070
+ private parseSpecification;
1071
+ private parseModel;
1072
+ private parseElement;
1073
+ private parseRelation;
1074
+ private parseViews;
1075
+ private parseViewRulePredicate;
1076
+ private parsePredicate;
1077
+ private parseElementExpressionsIterator;
1078
+ private parseElementPredicate;
1079
+ private parseElementExpr;
1080
+ private parseElementPredicateWith;
1081
+ private parseElementPredicateWhere;
1082
+ private parseRelationPredicate;
1083
+ private parseRelationPredicateWhere;
1084
+ private parseRelationPredicateWith;
1085
+ private parseRelationExpr;
1086
+ private parseViewRule;
1087
+ private parseViewManualLaout;
1088
+ private parseDynamicParallelSteps;
1089
+ private parseDynamicStep;
1090
+ private parseElementView;
1091
+ private parseDynamicElementView;
1092
+ protected resolveFqn(node: Element | ExtendElement): c4.Fqn;
1093
+ private getAstNodePath;
1094
+ private getMetadata;
1095
+ private convertTags;
1096
+ private convertLinks;
1097
+ }
1098
+
992
1099
  declare class LikeC4ModelChanges {
993
1100
  private services;
994
1101
  private locator;
@@ -1059,7 +1166,7 @@ declare class LikeC4WorkspaceManager extends DefaultWorkspaceManager {
1059
1166
  */
1060
1167
  protected loadAdditionalDocuments(folders: WorkspaceFolder[], collector: (document: LangiumDocument) => void): Promise<void>;
1061
1168
  workspace(): WorkspaceFolder;
1062
- get workspaceUri(): URI;
1169
+ get workspaceUri(): URI$1;
1063
1170
  get workspaceURL(): URL;
1064
1171
  }
1065
1172
 
@@ -1117,107 +1224,7 @@ declare function createLanguageServices(context?: LanguageServicesContext): {
1117
1224
  likec4: LikeC4Services;
1118
1225
  };
1119
1226
 
1120
- interface FqnIndexEntry {
1121
- fqn: Fqn;
1122
- name: string;
1123
- el: Element;
1124
- doc: FqnIndexedDocument;
1125
- path: string;
1126
- }
1127
- declare class FqnIndex {
1128
- private services;
1129
- protected langiumDocuments: LangiumDocuments;
1130
- constructor(services: LikeC4Services);
1131
- get documents(): Stream<FqnIndexedDocument>;
1132
- private entries;
1133
- getFqn(el: Element): Fqn | null;
1134
- byFqn(fqn: Fqn): Stream<AstNodeDescription>;
1135
- directChildrenOf(parent: Fqn): Stream<AstNodeDescription>;
1136
- /**
1137
- * Returns descedant elements with unique names in the scope
1138
- */
1139
- uniqueDescedants(parent: Fqn): Stream<AstNodeDescription>;
1140
- }
1141
-
1142
- type ModelParsedListener$1 = (docs: URI$1[]) => void;
1143
- declare class LikeC4ModelBuilder {
1144
- private services;
1145
- private langiumDocuments;
1146
- private listeners;
1147
- constructor(services: LikeC4Services);
1148
- /**
1149
- * WARNING:
1150
- * This method is internal and should to be called only when all documents are known to be parsed.
1151
- * Otherwise, the model may be incomplete.
1152
- */
1153
- unsafeSyncBuildModel(): c4.ParsedLikeC4Model | null;
1154
- buildModel(cancelToken?: Cancellation.CancellationToken): Promise<c4.ParsedLikeC4Model | null>;
1155
- private previousViews;
1156
- /**
1157
- * WARNING:
1158
- * This method is internal and should to be called only when all documents are known to be parsed.
1159
- * Otherwise, the model may be incomplete.
1160
- */
1161
- unsafeSyncBuildComputedModel(model: c4.ParsedLikeC4Model): c4.ComputedLikeC4Model;
1162
- buildComputedModel(cancelToken?: Cancellation.CancellationToken): Promise<c4.ComputedLikeC4Model | null>;
1163
- computeView(viewId: ViewID, cancelToken?: Cancellation.CancellationToken): Promise<c4.ComputedView | null>;
1164
- onModelParsed(callback: ModelParsedListener$1): Disposable;
1165
- private documents;
1166
- private notifyListeners;
1167
- }
1168
-
1169
- declare class LikeC4ModelLocator {
1170
- private services;
1171
- private fqnIndex;
1172
- private langiumDocuments;
1173
- constructor(services: LikeC4Services);
1174
- private documents;
1175
- getParsedElement(astNode: Element): ParsedAstElement | null;
1176
- locateElement(fqn: c4.Fqn, _prop?: string): Location | null;
1177
- locateRelation(relationId: c4.RelationID): Location | null;
1178
- locateViewAst(viewId: c4.ViewID): {
1179
- doc: ParsedLikeC4LangiumDocument;
1180
- view: ParsedAstView;
1181
- viewAst: LikeC4View;
1182
- };
1183
- locateView(viewId: c4.ViewID): Location | null;
1184
- }
1185
-
1186
- type ModelParsedListener = () => void;
1187
- type IsValidFn = ChecksFromDiagnostics['isValid'];
1188
- declare class LikeC4ModelParser {
1189
- private services;
1190
- private fqnIndex;
1191
- constructor(services: LikeC4Services);
1192
- parse(doc: LangiumDocument | LangiumDocument[]): ParsedLikeC4LangiumDocument[];
1193
- protected parseLikeC4Document(_doc: FqnIndexedDocument): ParsedLikeC4LangiumDocument;
1194
- private parseSpecification;
1195
- private parseModel;
1196
- private parseElement;
1197
- private parseRelation;
1198
- private parseViews;
1199
- private parseViewRulePredicate;
1200
- private parsePredicate;
1201
- private parseElementExpressionsIterator;
1202
- private parseElementPredicate;
1203
- private parseElementExpr;
1204
- private parseElementPredicateWith;
1205
- private parseElementPredicateWhere;
1206
- private parseRelationPredicate;
1207
- private parseRelationPredicateWhere;
1208
- private parseRelationPredicateWith;
1209
- private parseRelationExpr;
1210
- private parseViewRule;
1211
- private parseViewManualLaout;
1212
- private parseDynamicParallelSteps;
1213
- private parseDynamicStep;
1214
- private parseElementView;
1215
- private parseDynamicElementView;
1216
- protected resolveFqn(node: Element | ExtendElement): c4.Fqn;
1217
- private getAstNodePath;
1218
- private getMetadata;
1219
- private convertTags;
1220
- private convertLinks;
1221
- }
1227
+ declare const logger: _likec4_log.ConsolaInstance;
1228
+ declare function setLogLevel(level: keyof typeof LogLevels): void;
1222
1229
 
1223
- export { type FqnIndexEntry as F, type IsValidFn as I, type LikeC4LangiumDocument as L, type ModelParsedListener as M, type LikeC4Services as a, createLanguageServices as b, createCustomLanguageServices as c, LikeC4Module as d, FqnIndex as e, LikeC4ModelBuilder as f, LikeC4ModelLocator as g, LikeC4ModelParser as h, type LikeC4SharedServices as i, type LikeC4AddedServices as j, type LanguageServicesContext as k, createSharedServices as l };
1230
+ 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 };