@likec4/language-server 0.6.3 → 0.18.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.
- package/contrib/likec4.monarch.ts +1 -1
- package/contrib/likec4.tmLanguage.json +1 -1
- package/dist/ast.d.ts +4 -2
- package/dist/ast.js +13 -3
- package/dist/builtin.d.ts +1 -0
- package/dist/builtin.js +1 -0
- package/dist/elementRef.d.ts +2 -1
- package/dist/elementRef.js +1 -0
- package/dist/generated/ast.d.ts +12 -6
- package/dist/generated/ast.js +14 -2
- package/dist/generated/grammar.d.ts +3 -2
- package/dist/generated/grammar.js +79 -37
- package/dist/generated/module.d.ts +3 -2
- package/dist/generated/module.js +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/logger.d.ts +1 -0
- package/dist/logger.js +1 -0
- package/dist/lsp/DocumentSymbolProvider.d.ts +2 -1
- package/dist/lsp/DocumentSymbolProvider.js +29 -11
- package/dist/lsp/HoverProvider.d.ts +2 -1
- package/dist/lsp/HoverProvider.js +1 -0
- package/dist/lsp/SemanticTokenProvider.d.ts +1 -0
- package/dist/lsp/SemanticTokenProvider.js +9 -44
- package/dist/lsp/index.d.ts +1 -0
- package/dist/lsp/index.js +1 -0
- package/dist/model/fqn-computation.d.ts +4 -0
- package/dist/model/fqn-computation.js +41 -0
- package/dist/model/fqn-index.d.ts +36 -11
- package/dist/model/fqn-index.js +50 -89
- package/dist/model/index.d.ts +2 -0
- package/dist/model/index.js +2 -0
- package/dist/model/model-builder.d.ts +1 -0
- package/dist/model/model-builder.js +44 -30
- package/dist/model/model-locator.d.ts +1 -0
- package/dist/model/model-locator.js +24 -16
- package/dist/module.d.ts +1 -0
- package/dist/module.js +1 -4
- package/dist/protocol.d.ts +36 -0
- package/dist/protocol.js +22 -0
- package/dist/references/index.d.ts +1 -0
- package/dist/references/index.js +1 -0
- package/dist/references/scope-computation.d.ts +5 -1
- package/dist/references/scope-computation.js +11 -3
- package/dist/references/scope-provider.d.ts +4 -0
- package/dist/references/scope-provider.js +40 -30
- package/dist/registerProtocolHandlers.d.ts +1 -0
- package/dist/registerProtocolHandlers.js +48 -17
- package/dist/shared/CodeLensProvider.d.ts +2 -1
- package/dist/shared/CodeLensProvider.js +1 -0
- package/dist/shared/WorkspaceManager.d.ts +3 -2
- package/dist/shared/WorkspaceManager.js +3 -4
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.js +1 -0
- package/dist/test/index.d.ts +2 -0
- package/dist/test/index.js +2 -0
- package/dist/test/testServices.d.ts +16 -0
- package/dist/test/testServices.js +58 -0
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +1 -0
- package/dist/validation/element.d.ts +1 -0
- package/dist/validation/element.js +9 -2
- package/dist/validation/index.d.ts +1 -0
- package/dist/validation/index.js +1 -0
- package/dist/validation/relation.d.ts +1 -0
- package/dist/validation/relation.js +1 -0
- package/dist/validation/specification.d.ts +1 -0
- package/dist/validation/specification.js +1 -0
- package/dist/validation/view.d.ts +1 -0
- package/dist/validation/view.js +1 -0
- package/package.json +24 -42
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Monarch syntax highlighting for the likec4 language.
|
|
2
2
|
export default {
|
|
3
3
|
keywords: [
|
|
4
|
-
'BottomTop','LeftRight','RightLeft','TopBottom','autoLayout','browser','color','cylinder','description','element','exclude','extend','include','it','model','muted','of','person','primary','queue','rectangle','secondary','shape','specification','storage','style','tag','technology','this','title','view','views'
|
|
4
|
+
'BottomTop','LeftRight','RightLeft','TopBottom','amber','autoLayout','blue','browser','color','cylinder','description','element','exclude','extend','gray','green','include','indigo','it','mobile','model','muted','of','person','primary','queue','rectangle','red','secondary','shape','sky','slate','specification','storage','style','tag','technology','this','title','view','views'
|
|
5
5
|
],
|
|
6
6
|
operators: [
|
|
7
7
|
'*','->','.*'
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"name": "keyword.control.likec4",
|
|
15
|
-
"match": "\\b(BottomTop|LeftRight|RightLeft|TopBottom|autoLayout|browser|color|cylinder|description|element|exclude|extend|include|it|model|muted|of|person|primary|queue|rectangle|secondary|shape|specification|storage|style|tag|technology|this|title|view|views)\\b"
|
|
15
|
+
"match": "\\b(BottomTop|LeftRight|RightLeft|TopBottom|amber|autoLayout|blue|browser|color|cylinder|description|element|exclude|extend|gray|green|include|indigo|it|mobile|model|muted|of|person|primary|queue|rectangle|red|secondary|shape|sky|slate|specification|storage|style|tag|technology|this|title|view|views)\\b"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
"name": "string.quoted.double.likec4",
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
package/dist/builtin.js
CHANGED
package/dist/elementRef.d.ts
CHANGED
|
@@ -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
|
package/dist/elementRef.js
CHANGED
package/dist/generated/ast.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
|
-
* This file was generated by langium-cli 1.1.
|
|
2
|
+
* This file was generated by langium-cli 1.2.1.
|
|
3
3
|
* DO NOT EDIT MANUALLY!
|
|
4
4
|
******************************************************************************/
|
|
5
|
-
import { AstNode,
|
|
5
|
+
import type { AstNode, Reference, ReferenceInfo, TypeMetaData } from 'langium';
|
|
6
|
+
import { AbstractAstReflection } from 'langium';
|
|
6
7
|
export type AnyStringProperty = ElementStringProperty | RelationStringProperty | ViewProperty;
|
|
7
8
|
export declare const AnyStringProperty = "AnyStringProperty";
|
|
8
9
|
export declare function isAnyStringProperty(item: unknown): item is AnyStringProperty;
|
|
@@ -15,12 +16,15 @@ export declare function isElementExpression(item: unknown): item is ElementExpre
|
|
|
15
16
|
export type ElementProperty = ElementStringProperty | ElementStyleProperty;
|
|
16
17
|
export declare const ElementProperty = "ElementProperty";
|
|
17
18
|
export declare function isElementProperty(item: unknown): item is ElementProperty;
|
|
18
|
-
export type ElementShape = 'browser' | 'cylinder' | 'person' | 'queue' | 'rectangle' | 'storage';
|
|
19
|
+
export type ElementShape = 'browser' | 'cylinder' | 'mobile' | 'person' | 'queue' | 'rectangle' | 'storage';
|
|
20
|
+
export declare function isElementShape(item: unknown): item is ElementShape;
|
|
19
21
|
export type Expression = ElementExpression | InOutExpression | IncomingExpression | OutgoingExpression | RelationExpression;
|
|
20
22
|
export declare const Expression = "Expression";
|
|
21
23
|
export declare function isExpression(item: unknown): item is Expression;
|
|
22
24
|
export type Name = 'element' | 'model' | ElementShape | ThemeColor | string;
|
|
23
|
-
export
|
|
25
|
+
export declare function isName(item: unknown): item is Name;
|
|
26
|
+
export type ThemeColor = 'amber' | 'blue' | 'gray' | 'green' | 'indigo' | 'muted' | 'primary' | 'red' | 'secondary' | 'sky' | 'slate';
|
|
27
|
+
export declare function isThemeColor(item: unknown): item is ThemeColor;
|
|
24
28
|
export type View = ElementView;
|
|
25
29
|
export declare const View = "View";
|
|
26
30
|
export declare function isView(item: unknown): item is View;
|
|
@@ -28,6 +32,7 @@ export type ViewRule = ViewRuleAutoLayout | ViewRuleExpression | ViewRuleStyle;
|
|
|
28
32
|
export declare const ViewRule = "ViewRule";
|
|
29
33
|
export declare function isViewRule(item: unknown): item is ViewRule;
|
|
30
34
|
export type ViewRuleLayoutDirection = 'BottomTop' | 'LeftRight' | 'RightLeft' | 'TopBottom';
|
|
35
|
+
export declare function isViewRuleLayoutDirection(item: unknown): item is ViewRuleLayoutDirection;
|
|
31
36
|
export interface ColorProperty extends AstNode {
|
|
32
37
|
readonly $container: ElementStyleProperty | SpecificationElementKindStyle | ViewRuleStyle;
|
|
33
38
|
readonly $type: 'ColorProperty';
|
|
@@ -306,7 +311,7 @@ export interface RelationWithSource extends Relation {
|
|
|
306
311
|
}
|
|
307
312
|
export declare const RelationWithSource = "RelationWithSource";
|
|
308
313
|
export declare function isRelationWithSource(item: unknown): item is RelationWithSource;
|
|
309
|
-
export
|
|
314
|
+
export type LikeC4AstType = {
|
|
310
315
|
AStyleProperty: AStyleProperty;
|
|
311
316
|
AnyStringProperty: AnyStringProperty;
|
|
312
317
|
ColorProperty: ColorProperty;
|
|
@@ -349,7 +354,7 @@ export interface LikeC4AstType {
|
|
|
349
354
|
ViewRuleExpression: ViewRuleExpression;
|
|
350
355
|
ViewRuleStyle: ViewRuleStyle;
|
|
351
356
|
WildcardExpression: WildcardExpression;
|
|
352
|
-
}
|
|
357
|
+
};
|
|
353
358
|
export declare class LikeC4AstReflection extends AbstractAstReflection {
|
|
354
359
|
getAllTypes(): string[];
|
|
355
360
|
protected computeIsSubtype(subtype: string, supertype: string): boolean;
|
|
@@ -357,3 +362,4 @@ export declare class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
357
362
|
getTypeMetaData(type: string): TypeMetaData;
|
|
358
363
|
}
|
|
359
364
|
export declare const reflection: LikeC4AstReflection;
|
|
365
|
+
//# sourceMappingURL=ast.d.ts.map
|
package/dist/generated/ast.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
|
-
* This file was generated by langium-cli 1.1.
|
|
2
|
+
* This file was generated by langium-cli 1.2.1.
|
|
3
3
|
* DO NOT EDIT MANUALLY!
|
|
4
4
|
******************************************************************************/
|
|
5
|
-
/* eslint-disable */
|
|
6
5
|
import { AbstractAstReflection } from 'langium';
|
|
7
6
|
export const AnyStringProperty = 'AnyStringProperty';
|
|
8
7
|
export function isAnyStringProperty(item) {
|
|
@@ -20,10 +19,19 @@ export const ElementProperty = 'ElementProperty';
|
|
|
20
19
|
export function isElementProperty(item) {
|
|
21
20
|
return reflection.isInstance(item, ElementProperty);
|
|
22
21
|
}
|
|
22
|
+
export function isElementShape(item) {
|
|
23
|
+
return item === 'rectangle' || item === 'person' || item === 'browser' || item === 'mobile' || item === 'cylinder' || item === 'storage' || item === 'queue';
|
|
24
|
+
}
|
|
23
25
|
export const Expression = 'Expression';
|
|
24
26
|
export function isExpression(item) {
|
|
25
27
|
return reflection.isInstance(item, Expression);
|
|
26
28
|
}
|
|
29
|
+
export function isName(item) {
|
|
30
|
+
return isElementShape(item) || isThemeColor(item) || item === 'element' || item === 'model' || (typeof item === 'string' && (/((([^\W\d_])|(_))((([^\W\d_])|([0-9]))|(_))*)/.test(item)));
|
|
31
|
+
}
|
|
32
|
+
export function isThemeColor(item) {
|
|
33
|
+
return item === 'primary' || item === 'secondary' || item === 'muted' || item === 'slate' || item === 'blue' || item === 'indigo' || item === 'sky' || item === 'red' || item === 'gray' || item === 'green' || item === 'amber';
|
|
34
|
+
}
|
|
27
35
|
export const View = 'View';
|
|
28
36
|
export function isView(item) {
|
|
29
37
|
return reflection.isInstance(item, View);
|
|
@@ -32,6 +40,9 @@ export const ViewRule = 'ViewRule';
|
|
|
32
40
|
export function isViewRule(item) {
|
|
33
41
|
return reflection.isInstance(item, ViewRule);
|
|
34
42
|
}
|
|
43
|
+
export function isViewRuleLayoutDirection(item) {
|
|
44
|
+
return item === 'TopBottom' || item === 'LeftRight' || item === 'BottomTop' || item === 'RightLeft';
|
|
45
|
+
}
|
|
35
46
|
export const ColorProperty = 'ColorProperty';
|
|
36
47
|
export function isColorProperty(item) {
|
|
37
48
|
return reflection.isInstance(item, ColorProperty);
|
|
@@ -374,3 +385,4 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
374
385
|
}
|
|
375
386
|
}
|
|
376
387
|
export const reflection = new LikeC4AstReflection();
|
|
388
|
+
//# sourceMappingURL=ast.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
|
-
* This file was generated by langium-cli 1.1.
|
|
2
|
+
* This file was generated by langium-cli 1.2.1.
|
|
3
3
|
* DO NOT EDIT MANUALLY!
|
|
4
4
|
******************************************************************************/
|
|
5
|
-
import { Grammar } from 'langium';
|
|
5
|
+
import type { 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.
|
|
2
|
+
* This file was generated by langium-cli 1.2.1.
|
|
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": "
|
|
807
|
-
"
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
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
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
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,
|
|
@@ -2054,6 +2059,38 @@ export const LikeC4Grammar = () => loadedLikeC4Grammar ?? (loadedLikeC4Grammar =
|
|
|
2054
2059
|
{
|
|
2055
2060
|
"$type": "Keyword",
|
|
2056
2061
|
"value": "muted"
|
|
2062
|
+
},
|
|
2063
|
+
{
|
|
2064
|
+
"$type": "Keyword",
|
|
2065
|
+
"value": "slate"
|
|
2066
|
+
},
|
|
2067
|
+
{
|
|
2068
|
+
"$type": "Keyword",
|
|
2069
|
+
"value": "blue"
|
|
2070
|
+
},
|
|
2071
|
+
{
|
|
2072
|
+
"$type": "Keyword",
|
|
2073
|
+
"value": "indigo"
|
|
2074
|
+
},
|
|
2075
|
+
{
|
|
2076
|
+
"$type": "Keyword",
|
|
2077
|
+
"value": "sky"
|
|
2078
|
+
},
|
|
2079
|
+
{
|
|
2080
|
+
"$type": "Keyword",
|
|
2081
|
+
"value": "red"
|
|
2082
|
+
},
|
|
2083
|
+
{
|
|
2084
|
+
"$type": "Keyword",
|
|
2085
|
+
"value": "gray"
|
|
2086
|
+
},
|
|
2087
|
+
{
|
|
2088
|
+
"$type": "Keyword",
|
|
2089
|
+
"value": "green"
|
|
2090
|
+
},
|
|
2091
|
+
{
|
|
2092
|
+
"$type": "Keyword",
|
|
2093
|
+
"value": "amber"
|
|
2057
2094
|
}
|
|
2058
2095
|
]
|
|
2059
2096
|
},
|
|
@@ -2083,6 +2120,10 @@ export const LikeC4Grammar = () => loadedLikeC4Grammar ?? (loadedLikeC4Grammar =
|
|
|
2083
2120
|
"$type": "Keyword",
|
|
2084
2121
|
"value": "browser"
|
|
2085
2122
|
},
|
|
2123
|
+
{
|
|
2124
|
+
"$type": "Keyword",
|
|
2125
|
+
"value": "mobile"
|
|
2126
|
+
},
|
|
2086
2127
|
{
|
|
2087
2128
|
"$type": "Keyword",
|
|
2088
2129
|
"value": "cylinder"
|
|
@@ -2540,3 +2581,4 @@ export const LikeC4Grammar = () => loadedLikeC4Grammar ?? (loadedLikeC4Grammar =
|
|
|
2540
2581
|
"interfaces": [],
|
|
2541
2582
|
"usedGrammars": []
|
|
2542
2583
|
}`));
|
|
2584
|
+
//# sourceMappingURL=grammar.js.map
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
|
-
* This file was generated by langium-cli 1.1.
|
|
2
|
+
* This file was generated by langium-cli 1.2.1.
|
|
3
3
|
* DO NOT EDIT MANUALLY!
|
|
4
4
|
******************************************************************************/
|
|
5
|
-
import { LangiumGeneratedServices, LangiumGeneratedSharedServices, LangiumSharedServices, LangiumServices, LanguageMetaData, Module, IParserConfig } from 'langium';
|
|
5
|
+
import type { LangiumGeneratedServices, LangiumGeneratedSharedServices, LangiumSharedServices, LangiumServices, LanguageMetaData, Module, IParserConfig } from 'langium';
|
|
6
6
|
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
|
package/dist/generated/module.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
|
-
* This file was generated by langium-cli 1.1.
|
|
2
|
+
* This file was generated by langium-cli 1.2.1.
|
|
3
3
|
* DO NOT EDIT MANUALLY!
|
|
4
4
|
******************************************************************************/
|
|
5
|
-
import 'langium';
|
|
6
5
|
import { LikeC4AstReflection } from './ast';
|
|
7
6
|
import { LikeC4Grammar } from './grammar';
|
|
8
7
|
export const LikeC4LanguageMetaData = {
|
|
@@ -24,3 +23,4 @@ export const LikeC4GeneratedModule = {
|
|
|
24
23
|
ParserConfig: () => parserConfig
|
|
25
24
|
}
|
|
26
25
|
};
|
|
26
|
+
//# sourceMappingURL=module.js.map
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/logger.d.ts
CHANGED
package/dist/logger.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
88
|
-
|
|
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
|
-
|
|
91
|
-
|
|
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
|
-
|
|
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:
|
|
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
|
|
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
|