@likec4/language-server 0.6.3 → 0.8.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 (69) hide show
  1. package/dist/ast.d.ts +4 -2
  2. package/dist/ast.js +13 -3
  3. package/dist/builtin.d.ts +1 -0
  4. package/dist/builtin.js +1 -0
  5. package/dist/elementRef.d.ts +2 -1
  6. package/dist/elementRef.js +1 -0
  7. package/dist/generated/ast.d.ts +8 -3
  8. package/dist/generated/ast.js +14 -1
  9. package/dist/generated/grammar.d.ts +2 -1
  10. package/dist/generated/grammar.js +43 -37
  11. package/dist/generated/module.d.ts +2 -1
  12. package/dist/generated/module.js +2 -1
  13. package/dist/index.d.ts +2 -0
  14. package/dist/index.js +2 -0
  15. package/dist/logger.d.ts +1 -0
  16. package/dist/logger.js +1 -0
  17. package/dist/lsp/DocumentSymbolProvider.d.ts +2 -1
  18. package/dist/lsp/DocumentSymbolProvider.js +29 -11
  19. package/dist/lsp/HoverProvider.d.ts +2 -1
  20. package/dist/lsp/HoverProvider.js +1 -0
  21. package/dist/lsp/SemanticTokenProvider.d.ts +1 -0
  22. package/dist/lsp/SemanticTokenProvider.js +2 -1
  23. package/dist/lsp/index.d.ts +1 -0
  24. package/dist/lsp/index.js +1 -0
  25. package/dist/model/fqn-index.d.ts +35 -11
  26. package/dist/model/fqn-index.js +72 -91
  27. package/dist/model/index.d.ts +1 -0
  28. package/dist/model/index.js +1 -0
  29. package/dist/model/model-builder.d.ts +1 -0
  30. package/dist/model/model-builder.js +12 -5
  31. package/dist/model/model-locator.d.ts +2 -1
  32. package/dist/model/model-locator.js +24 -16
  33. package/dist/module.d.ts +1 -0
  34. package/dist/module.js +1 -0
  35. package/dist/protocol.d.ts +37 -0
  36. package/dist/protocol.js +20 -0
  37. package/dist/references/fqn-computation.d.ts +4 -0
  38. package/dist/references/fqn-computation.js +41 -0
  39. package/dist/references/index.d.ts +1 -0
  40. package/dist/references/index.js +1 -0
  41. package/dist/references/scope-computation.d.ts +5 -1
  42. package/dist/references/scope-computation.js +13 -3
  43. package/dist/references/scope-provider.d.ts +4 -0
  44. package/dist/references/scope-provider.js +40 -30
  45. package/dist/registerProtocolHandlers.d.ts +1 -0
  46. package/dist/registerProtocolHandlers.js +7 -6
  47. package/dist/shared/CodeLensProvider.d.ts +2 -1
  48. package/dist/shared/CodeLensProvider.js +1 -0
  49. package/dist/shared/WorkspaceManager.d.ts +3 -2
  50. package/dist/shared/WorkspaceManager.js +3 -4
  51. package/dist/shared/index.d.ts +1 -0
  52. package/dist/shared/index.js +1 -0
  53. package/dist/test/index.d.ts +2 -0
  54. package/dist/test/index.js +2 -0
  55. package/dist/test/testServices.d.ts +16 -0
  56. package/dist/test/testServices.js +58 -0
  57. package/dist/utils.d.ts +1 -0
  58. package/dist/utils.js +1 -0
  59. package/dist/validation/element.d.ts +1 -0
  60. package/dist/validation/element.js +3 -2
  61. package/dist/validation/index.d.ts +1 -0
  62. package/dist/validation/index.js +1 -0
  63. package/dist/validation/relation.d.ts +1 -0
  64. package/dist/validation/relation.js +1 -0
  65. package/dist/validation/specification.d.ts +1 -0
  66. package/dist/validation/specification.js +1 -0
  67. package/dist/validation/view.d.ts +1 -0
  68. package/dist/validation/view.js +1 -0
  69. package/package.json +26 -31
package/dist/ast.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import * as ast from './generated/ast';
3
- import type { LangiumDocument } from 'langium';
3
+ import type { LangiumDocument, MultiMap } from 'langium';
4
4
  import type { LikeC4Document } from './generated/ast';
5
5
  import type * as c4 from '@likec4/core/types';
6
6
  export { ast };
@@ -42,7 +42,7 @@ export declare const ElementViewOps: {
42
42
  readId(node: ast.ElementView): c4.ViewID | undefined;
43
43
  };
44
44
  export declare const ElementOps: {
45
- writeId(node: ast.Element, id: c4.Fqn): ast.Element;
45
+ writeId(node: ast.Element, id: c4.Fqn | null): ast.Element;
46
46
  readId(node: ast.Element): c4.Fqn | undefined;
47
47
  };
48
48
  export interface LikeC4LangiumDocument extends LangiumDocument<LikeC4Document> {
@@ -51,6 +51,7 @@ export interface LikeC4LangiumDocument extends LangiumDocument<LikeC4Document> {
51
51
  c4Elements: ParsedAstElement[];
52
52
  c4Relations: ParsedAstRelation[];
53
53
  c4Views: ParsedAstElementView[];
54
+ c4fqns?: MultiMap<c4.Fqn, string> | undefined;
54
55
  }
55
56
  export declare function cleanParsedModel(doc: LikeC4LangiumDocument): {
56
57
  elements: ParsedAstElement[];
@@ -71,3 +72,4 @@ export declare function toElementStyle(props?: ast.AStyleProperty[]): {
71
72
  shape?: c4.ElementShape;
72
73
  };
73
74
  export declare function toAutoLayout(direction: ast.ViewRuleLayoutDirection): c4.ViewRuleAutoLayout['autoLayout'];
75
+ //# sourceMappingURL=ast.d.ts.map
package/dist/ast.js CHANGED
@@ -17,7 +17,8 @@ export function c4hash({ c4Specification, c4Elements, c4Relations, c4Views }) {
17
17
  const idattr = Symbol.for('idattr');
18
18
  export const ElementViewOps = {
19
19
  writeId(node, id) {
20
- Object.assign(node, { [idattr]: id });
20
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
+ node[idattr] = id;
21
22
  return node;
22
23
  },
23
24
  readId(node) {
@@ -27,7 +28,13 @@ export const ElementViewOps = {
27
28
  };
28
29
  export const ElementOps = {
29
30
  writeId(node, id) {
30
- Object.assign(node, { [idattr]: id });
31
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
+ if (id === null) {
33
+ delete node[idattr];
34
+ }
35
+ else {
36
+ node[idattr] = id;
37
+ }
31
38
  return node;
32
39
  },
33
40
  readId(node) {
@@ -70,7 +77,9 @@ export function* streamModel(doc) {
70
77
  let el;
71
78
  while ((el = traverseStack.shift())) {
72
79
  if (ast.isExtendElement(el)) {
73
- traverseStack.push(...el.body.elements);
80
+ if (!!el.body) {
81
+ traverseStack.push(...el.body.elements);
82
+ }
74
83
  continue;
75
84
  }
76
85
  if (ast.isElement(el) && el.body) {
@@ -131,3 +140,4 @@ export function toAutoLayout(direction) {
131
140
  }
132
141
  }
133
142
  }
143
+ //# sourceMappingURL=ast.js.map
package/dist/builtin.d.ts CHANGED
@@ -2,3 +2,4 @@ export declare const specification: {
2
2
  uri: string;
3
3
  document: string;
4
4
  };
5
+ //# sourceMappingURL=builtin.d.ts.map
package/dist/builtin.js CHANGED
@@ -6,3 +6,4 @@ specification {
6
6
  }
7
7
  `.trimStart()
8
8
  };
9
+ //# sourceMappingURL=builtin.js.map
@@ -1,6 +1,7 @@
1
1
  import type * as c4 from '@likec4/core/types';
2
2
  import { ast } from './ast';
3
3
  export declare function isElementRefHead(node: ast.ElementRef | ast.StrictElementRef): boolean;
4
- export declare function elementRef(node: ast.ElementRef): ast.Element | undefined;
4
+ export declare function elementRef(node: ast.ElementRef | ast.StrictElementRef): ast.Element | undefined;
5
5
  export declare function strictElementRefFqn(node: ast.StrictElementRef): c4.Fqn;
6
6
  export declare function parentStrictElementRef(node: ast.StrictElementRef): c4.Fqn;
7
+ //# sourceMappingURL=elementRef.d.ts.map
@@ -37,3 +37,4 @@ export function parentStrictElementRef(node) {
37
37
  }
38
38
  return path.join('.');
39
39
  }
40
+ //# sourceMappingURL=elementRef.js.map
@@ -1,5 +1,5 @@
1
1
  /******************************************************************************
2
- * This file was generated by langium-cli 1.1.0.
2
+ * This file was generated by langium-cli 1.2.0.
3
3
  * DO NOT EDIT MANUALLY!
4
4
  ******************************************************************************/
5
5
  import { AstNode, AbstractAstReflection, Reference, ReferenceInfo, TypeMetaData } from 'langium';
@@ -16,11 +16,14 @@ export type ElementProperty = ElementStringProperty | ElementStyleProperty;
16
16
  export declare const ElementProperty = "ElementProperty";
17
17
  export declare function isElementProperty(item: unknown): item is ElementProperty;
18
18
  export type ElementShape = 'browser' | 'cylinder' | 'person' | 'queue' | 'rectangle' | 'storage';
19
+ export declare function isElementShape(item: unknown): item is ElementShape;
19
20
  export type Expression = ElementExpression | InOutExpression | IncomingExpression | OutgoingExpression | RelationExpression;
20
21
  export declare const Expression = "Expression";
21
22
  export declare function isExpression(item: unknown): item is Expression;
22
23
  export type Name = 'element' | 'model' | ElementShape | ThemeColor | string;
24
+ export declare function isName(item: unknown): item is Name;
23
25
  export type ThemeColor = 'muted' | 'primary' | 'secondary';
26
+ export declare function isThemeColor(item: unknown): item is ThemeColor;
24
27
  export type View = ElementView;
25
28
  export declare const View = "View";
26
29
  export declare function isView(item: unknown): item is View;
@@ -28,6 +31,7 @@ export type ViewRule = ViewRuleAutoLayout | ViewRuleExpression | ViewRuleStyle;
28
31
  export declare const ViewRule = "ViewRule";
29
32
  export declare function isViewRule(item: unknown): item is ViewRule;
30
33
  export type ViewRuleLayoutDirection = 'BottomTop' | 'LeftRight' | 'RightLeft' | 'TopBottom';
34
+ export declare function isViewRuleLayoutDirection(item: unknown): item is ViewRuleLayoutDirection;
31
35
  export interface ColorProperty extends AstNode {
32
36
  readonly $container: ElementStyleProperty | SpecificationElementKindStyle | ViewRuleStyle;
33
37
  readonly $type: 'ColorProperty';
@@ -306,7 +310,7 @@ export interface RelationWithSource extends Relation {
306
310
  }
307
311
  export declare const RelationWithSource = "RelationWithSource";
308
312
  export declare function isRelationWithSource(item: unknown): item is RelationWithSource;
309
- export interface LikeC4AstType {
313
+ export type LikeC4AstType = {
310
314
  AStyleProperty: AStyleProperty;
311
315
  AnyStringProperty: AnyStringProperty;
312
316
  ColorProperty: ColorProperty;
@@ -349,7 +353,7 @@ export interface LikeC4AstType {
349
353
  ViewRuleExpression: ViewRuleExpression;
350
354
  ViewRuleStyle: ViewRuleStyle;
351
355
  WildcardExpression: WildcardExpression;
352
- }
356
+ };
353
357
  export declare class LikeC4AstReflection extends AbstractAstReflection {
354
358
  getAllTypes(): string[];
355
359
  protected computeIsSubtype(subtype: string, supertype: string): boolean;
@@ -357,3 +361,4 @@ export declare class LikeC4AstReflection extends AbstractAstReflection {
357
361
  getTypeMetaData(type: string): TypeMetaData;
358
362
  }
359
363
  export declare const reflection: LikeC4AstReflection;
364
+ //# sourceMappingURL=ast.d.ts.map
@@ -1,5 +1,5 @@
1
1
  /******************************************************************************
2
- * This file was generated by langium-cli 1.1.0.
2
+ * This file was generated by langium-cli 1.2.0.
3
3
  * DO NOT EDIT MANUALLY!
4
4
  ******************************************************************************/
5
5
  /* eslint-disable */
@@ -20,10 +20,19 @@ export const ElementProperty = 'ElementProperty';
20
20
  export function isElementProperty(item) {
21
21
  return reflection.isInstance(item, ElementProperty);
22
22
  }
23
+ export function isElementShape(item) {
24
+ return item === 'rectangle' || item === 'person' || item === 'browser' || item === 'cylinder' || item === 'storage' || item === 'queue';
25
+ }
23
26
  export const Expression = 'Expression';
24
27
  export function isExpression(item) {
25
28
  return reflection.isInstance(item, Expression);
26
29
  }
30
+ export function isName(item) {
31
+ return isElementShape(item) || isThemeColor(item) || item === 'element' || item === 'model' || (typeof item === 'string' && (/((([^\W\d_])|(_))((([^\W\d_])|([0-9]))|(_))*)/.test(item)));
32
+ }
33
+ export function isThemeColor(item) {
34
+ return item === 'primary' || item === 'secondary' || item === 'muted';
35
+ }
27
36
  export const View = 'View';
28
37
  export function isView(item) {
29
38
  return reflection.isInstance(item, View);
@@ -32,6 +41,9 @@ export const ViewRule = 'ViewRule';
32
41
  export function isViewRule(item) {
33
42
  return reflection.isInstance(item, ViewRule);
34
43
  }
44
+ export function isViewRuleLayoutDirection(item) {
45
+ return item === 'TopBottom' || item === 'LeftRight' || item === 'BottomTop' || item === 'RightLeft';
46
+ }
35
47
  export const ColorProperty = 'ColorProperty';
36
48
  export function isColorProperty(item) {
37
49
  return reflection.isInstance(item, ColorProperty);
@@ -374,3 +386,4 @@ export class LikeC4AstReflection extends AbstractAstReflection {
374
386
  }
375
387
  }
376
388
  export const reflection = new LikeC4AstReflection();
389
+ //# sourceMappingURL=ast.js.map
@@ -1,6 +1,7 @@
1
1
  /******************************************************************************
2
- * This file was generated by langium-cli 1.1.0.
2
+ * This file was generated by langium-cli 1.2.0.
3
3
  * DO NOT EDIT MANUALLY!
4
4
  ******************************************************************************/
5
5
  import { Grammar } from 'langium';
6
6
  export declare const LikeC4Grammar: () => Grammar;
7
+ //# sourceMappingURL=grammar.d.ts.map
@@ -1,5 +1,5 @@
1
1
  /******************************************************************************
2
- * This file was generated by langium-cli 1.1.0.
2
+ * This file was generated by langium-cli 1.2.0.
3
3
  * DO NOT EDIT MANUALLY!
4
4
  ******************************************************************************/
5
5
  import { loadGrammarFromJson } from 'langium';
@@ -764,13 +764,6 @@ export const LikeC4Grammar = () => loadedLikeC4Grammar ?? (loadedLikeC4Grammar =
764
764
  "arguments": []
765
765
  }
766
766
  },
767
- {
768
- "$type": "RuleCall",
769
- "rule": {
770
- "$ref": "#/rules@45"
771
- },
772
- "arguments": []
773
- },
774
767
  {
775
768
  "$type": "Assignment",
776
769
  "feature": "body",
@@ -782,13 +775,6 @@ export const LikeC4Grammar = () => loadedLikeC4Grammar ?? (loadedLikeC4Grammar =
782
775
  },
783
776
  "arguments": []
784
777
  }
785
- },
786
- {
787
- "$type": "RuleCall",
788
- "rule": {
789
- "$ref": "#/rules@46"
790
- },
791
- "arguments": []
792
778
  }
793
779
  ]
794
780
  },
@@ -803,29 +789,48 @@ export const LikeC4Grammar = () => loadedLikeC4Grammar ?? (loadedLikeC4Grammar =
803
789
  "$type": "ParserRule",
804
790
  "name": "ExtendElementBody",
805
791
  "definition": {
806
- "$type": "Assignment",
807
- "feature": "elements",
808
- "operator": "+=",
809
- "terminal": {
810
- "$type": "Alternatives",
811
- "elements": [
812
- {
813
- "$type": "RuleCall",
814
- "rule": {
815
- "$ref": "#/rules@6"
816
- },
817
- "arguments": []
792
+ "$type": "Group",
793
+ "elements": [
794
+ {
795
+ "$type": "RuleCall",
796
+ "rule": {
797
+ "$ref": "#/rules@45"
818
798
  },
819
- {
820
- "$type": "RuleCall",
821
- "rule": {
822
- "$ref": "#/rules@17"
823
- },
824
- "arguments": []
825
- }
826
- ]
827
- },
828
- "cardinality": "*"
799
+ "arguments": []
800
+ },
801
+ {
802
+ "$type": "Assignment",
803
+ "feature": "elements",
804
+ "operator": "+=",
805
+ "terminal": {
806
+ "$type": "Alternatives",
807
+ "elements": [
808
+ {
809
+ "$type": "RuleCall",
810
+ "rule": {
811
+ "$ref": "#/rules@6"
812
+ },
813
+ "arguments": []
814
+ },
815
+ {
816
+ "$type": "RuleCall",
817
+ "rule": {
818
+ "$ref": "#/rules@17"
819
+ },
820
+ "arguments": []
821
+ }
822
+ ]
823
+ },
824
+ "cardinality": "*"
825
+ },
826
+ {
827
+ "$type": "RuleCall",
828
+ "rule": {
829
+ "$ref": "#/rules@46"
830
+ },
831
+ "arguments": []
832
+ }
833
+ ]
829
834
  },
830
835
  "definesHiddenTokens": false,
831
836
  "entry": false,
@@ -2540,3 +2545,4 @@ export const LikeC4Grammar = () => loadedLikeC4Grammar ?? (loadedLikeC4Grammar =
2540
2545
  "interfaces": [],
2541
2546
  "usedGrammars": []
2542
2547
  }`));
2548
+ //# sourceMappingURL=grammar.js.map
@@ -1,5 +1,5 @@
1
1
  /******************************************************************************
2
- * This file was generated by langium-cli 1.1.0.
2
+ * This file was generated by langium-cli 1.2.0.
3
3
  * DO NOT EDIT MANUALLY!
4
4
  ******************************************************************************/
5
5
  import { LangiumGeneratedServices, LangiumGeneratedSharedServices, LangiumSharedServices, LangiumServices, LanguageMetaData, Module, IParserConfig } from 'langium';
@@ -7,3 +7,4 @@ export declare const LikeC4LanguageMetaData: LanguageMetaData;
7
7
  export declare const parserConfig: IParserConfig;
8
8
  export declare const LikeC4GeneratedSharedModule: Module<LangiumSharedServices, LangiumGeneratedSharedServices>;
9
9
  export declare const LikeC4GeneratedModule: Module<LangiumServices, LangiumGeneratedServices>;
10
+ //# sourceMappingURL=module.d.ts.map
@@ -1,5 +1,5 @@
1
1
  /******************************************************************************
2
- * This file was generated by langium-cli 1.1.0.
2
+ * This file was generated by langium-cli 1.2.0.
3
3
  * DO NOT EDIT MANUALLY!
4
4
  ******************************************************************************/
5
5
  import 'langium';
@@ -24,3 +24,4 @@ export const LikeC4GeneratedModule = {
24
24
  ParserConfig: () => parserConfig
25
25
  }
26
26
  };
27
+ //# sourceMappingURL=module.js.map
package/dist/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
1
  export { createLanguageServices } from './module';
2
2
  export type { LikeC4Services } from './module';
3
+ export * as protocol from './protocol';
4
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1 +1,3 @@
1
1
  export { createLanguageServices } from './module';
2
+ export * as protocol from './protocol';
3
+ //# sourceMappingURL=index.js.map
package/dist/logger.d.ts CHANGED
@@ -6,3 +6,4 @@ export declare const logger: {
6
6
  error(message: string | Error | unknown): void;
7
7
  trace(message: string): void;
8
8
  };
9
+ //# sourceMappingURL=logger.d.ts.map
package/dist/logger.js CHANGED
@@ -18,3 +18,4 @@ export const logger = {
18
18
  console.debug(message);
19
19
  }
20
20
  };
21
+ //# sourceMappingURL=logger.js.map
@@ -5,7 +5,7 @@
5
5
  ******************************************************************************/
6
6
  /// <reference types="react" />
7
7
  import { type DocumentSymbolProvider, type MaybePromise } from 'langium';
8
- import { type DocumentSymbol } from 'vscode-languageserver-protocol';
8
+ import { type DocumentSymbol } from 'vscode-languageserver';
9
9
  import { type LikeC4LangiumDocument, ast } from '../ast';
10
10
  import type { LikeC4Services } from '../module';
11
11
  export declare class LikeC4DocumentSymbolProvider implements DocumentSymbolProvider {
@@ -19,3 +19,4 @@ export declare class LikeC4DocumentSymbolProvider implements DocumentSymbolProvi
19
19
  protected getElementSymbol: (astElement: ast.Element) => DocumentSymbol[];
20
20
  protected getModelViewsSymbols: (astViews: ast.ModelViews | undefined) => DocumentSymbol[];
21
21
  }
22
+ //# sourceMappingURL=DocumentSymbolProvider.d.ts.map
@@ -5,8 +5,9 @@
5
5
  ******************************************************************************/
6
6
  import invariant from 'tiny-invariant';
7
7
  import { findNodeForProperty } from 'langium';
8
- import { SymbolKind } from 'vscode-languageserver-protocol';
8
+ import { SymbolKind } from 'vscode-languageserver';
9
9
  import { ast } from '../ast';
10
+ import { logger } from '../logger';
10
11
  export class LikeC4DocumentSymbolProvider {
11
12
  services;
12
13
  constructor(services) {
@@ -39,7 +40,12 @@ export class LikeC4DocumentSymbolProvider {
39
40
  };
40
41
  };
41
42
  for (const astKind of astSpec.elementKinds) {
42
- specSymbols.push(getElementKindSymbol(astKind));
43
+ try {
44
+ specSymbols.push(getElementKindSymbol(astKind));
45
+ }
46
+ catch (e) {
47
+ logger.error(e);
48
+ }
43
49
  }
44
50
  const getTagSymbol = (astTag) => {
45
51
  invariant(astTag.$cstNode, 'TagSpec must have a CST node');
@@ -52,7 +58,12 @@ export class LikeC4DocumentSymbolProvider {
52
58
  };
53
59
  };
54
60
  for (const astTag of astSpec.tags) {
55
- specSymbols.push(getTagSymbol(astTag));
61
+ try {
62
+ specSymbols.push(getTagSymbol(astTag));
63
+ }
64
+ catch (e) {
65
+ logger.error(e);
66
+ }
56
67
  }
57
68
  if (specSymbols.length === 0)
58
69
  return [];
@@ -79,23 +90,29 @@ export class LikeC4DocumentSymbolProvider {
79
90
  name: astModel.name,
80
91
  range: cstModel.range,
81
92
  selectionRange: nameNode.range,
82
- children: astModel.elements.flatMap(this.getElementsSymbol)
93
+ children: astModel.elements.flatMap(e => this.getElementsSymbol(e))
83
94
  }
84
95
  ];
85
96
  };
86
97
  getElementsSymbol = (el) => {
87
- if (ast.isExtendElement(el)) {
88
- return this.getExtendElementSymbol(el);
98
+ try {
99
+ if (ast.isExtendElement(el)) {
100
+ return this.getExtendElementSymbol(el);
101
+ }
102
+ if (ast.isElement(el)) {
103
+ return this.getElementSymbol(el);
104
+ }
89
105
  }
90
- if (ast.isElement(el)) {
91
- return this.getElementSymbol(el);
106
+ catch (e) {
107
+ logger.error(e);
92
108
  }
93
109
  return [];
94
110
  };
95
111
  getExtendElementSymbol = (astElement) => {
96
112
  const cst = astElement.$cstNode;
97
113
  const nameNode = astElement.element.$cstNode;
98
- if (!cst || !nameNode)
114
+ const body = astElement.body;
115
+ if (!cst || !nameNode || !body)
99
116
  return [];
100
117
  return [
101
118
  {
@@ -103,7 +120,7 @@ export class LikeC4DocumentSymbolProvider {
103
120
  name: nameNode.text,
104
121
  range: cst.range,
105
122
  selectionRange: nameNode.range,
106
- children: astElement.body.elements.flatMap(this.getElementsSymbol)
123
+ children: body.elements.flatMap(e => this.getElementsSymbol(e))
107
124
  }
108
125
  ];
109
126
  };
@@ -125,7 +142,7 @@ export class LikeC4DocumentSymbolProvider {
125
142
  range: cst.range,
126
143
  selectionRange: nameNode.range,
127
144
  detail,
128
- children: astElement.body?.elements.flatMap(this.getElementsSymbol) ?? []
145
+ children: astElement.body?.elements.flatMap(e => this.getElementsSymbol(e)) ?? []
129
146
  }
130
147
  ];
131
148
  };
@@ -147,3 +164,4 @@ export class LikeC4DocumentSymbolProvider {
147
164
  ];
148
165
  };
149
166
  }
167
+ //# sourceMappingURL=DocumentSymbolProvider.js.map
@@ -1,8 +1,9 @@
1
1
  import { type AstNode, AstNodeHoverProvider, type MaybePromise } from 'langium';
2
- import type { Hover } from 'vscode-languageserver-protocol';
2
+ import type { Hover } from 'vscode-languageserver';
3
3
  import type { LikeC4Services } from '../module';
4
4
  export declare class LikeC4HoverProvider extends AstNodeHoverProvider {
5
5
  private locator;
6
6
  constructor(services: LikeC4Services);
7
7
  protected getAstNodeHoverContent(node: AstNode): MaybePromise<Hover | undefined>;
8
8
  }
9
+ //# sourceMappingURL=HoverProvider.d.ts.map
@@ -52,3 +52,4 @@ export class LikeC4HoverProvider extends AstNodeHoverProvider {
52
52
  return;
53
53
  }
54
54
  }
55
+ //# sourceMappingURL=HoverProvider.js.map
@@ -4,3 +4,4 @@ export declare class LikeC4SemanticTokenProvider extends AbstractSemanticTokenPr
4
4
  private highlightAstElement;
5
5
  private highlightView;
6
6
  }
7
+ //# sourceMappingURL=SemanticTokenProvider.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { AbstractSemanticTokenProvider } from 'langium';
2
- import { SemanticTokenModifiers, SemanticTokenTypes } from 'vscode-languageserver-protocol';
2
+ import { SemanticTokenModifiers, SemanticTokenTypes } from 'vscode-languageserver';
3
3
  import { ast } from '../ast';
4
4
  import { isElementRefHead } from '../elementRef';
5
5
  export class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider {
@@ -219,3 +219,4 @@ export class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider {
219
219
  });
220
220
  }
221
221
  }
222
+ //# sourceMappingURL=SemanticTokenProvider.js.map
@@ -1,3 +1,4 @@
1
1
  export * from './DocumentSymbolProvider';
2
2
  export * from './HoverProvider';
3
3
  export * from './SemanticTokenProvider';
4
+ //# sourceMappingURL=index.d.ts.map
package/dist/lsp/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './DocumentSymbolProvider';
2
2
  export * from './HoverProvider';
3
3
  export * from './SemanticTokenProvider';
4
+ //# sourceMappingURL=index.js.map
@@ -1,17 +1,41 @@
1
- import { StreamImpl } from 'langium';
2
- import type { AstNodeDescription, AstNodeDescriptionProvider } from 'langium';
3
- import { ast } from '../ast';
1
+ import { DocumentState, MultiMap, StreamImpl } from 'langium';
2
+ import type { URI } from 'vscode-uri';
3
+ import type { ast } from '../ast';
4
+ import { type LikeC4LangiumDocument } from '../ast';
4
5
  import type { LikeC4Services } from '../module';
5
- import { Fqn } from '@likec4/core/types';
6
+ import type { Fqn } from '@likec4/core/types';
7
+ import type { SetNonNullable } from 'type-fest';
8
+ export interface FqnIndexEntry {
9
+ fqn: Fqn;
10
+ name: string;
11
+ doc: LikeC4LangiumDocument;
12
+ path: string;
13
+ }
6
14
  export declare class FqnIndex {
7
- #private;
8
15
  private services;
9
- protected readonly descriptions: AstNodeDescriptionProvider;
10
16
  constructor(services: LikeC4Services);
17
+ private documents;
18
+ private entries;
11
19
  get(el: ast.Element): Fqn | null;
12
- byFqn(fqn: Fqn): readonly AstNodeDescription[];
13
- directChildrenOf(parent: Fqn): import("langium").Stream<AstNodeDescription>;
14
- uniqueDescedants(parent: Fqn): StreamImpl<IterableIterator<AstNodeDescription> | null, AstNodeDescription>;
15
- private doIndexElements;
16
- private cleanIndexedElements;
20
+ byFqn(fqn: Fqn): import("langium").Stream<{
21
+ path: string;
22
+ doc: SetNonNullable<{
23
+ c4hash?: string;
24
+ c4Specification: import("../ast").ParsedAstSpecification;
25
+ c4Elements: import("../ast").ParsedAstElement[];
26
+ c4Relations: import("../ast").ParsedAstRelation[];
27
+ c4Views: import("../ast").ParsedAstElementView[];
28
+ readonly uri: URI;
29
+ readonly textDocument: import("vscode-languageserver-textdocument").TextDocument;
30
+ state: DocumentState;
31
+ parseResult: import("langium").ParseResult<ast.LikeC4Document>;
32
+ precomputedScopes?: import("langium").PrecomputedScopes;
33
+ references: import("langium").Reference<import("langium").AstNode>[];
34
+ diagnostics?: import("vscode-languageserver-types").Diagnostic[];
35
+ c4fqns: MultiMap<Fqn, string> | undefined;
36
+ }, "c4fqns">;
37
+ }>;
38
+ directChildrenOf(parent: Fqn): import("langium").Stream<FqnIndexEntry>;
39
+ uniqueDescedants(parent: Fqn): StreamImpl<IterableIterator<FqnIndexEntry> | null, FqnIndexEntry>;
17
40
  }
41
+ //# sourceMappingURL=fqn-index.d.ts.map