@likec4/language-server 0.45.0 → 0.46.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 +9 -8
- package/dist/Rpc.js +14 -60
- package/dist/ast.d.ts +9 -10
- package/dist/ast.js +14 -22
- package/dist/elementRef.d.ts +5 -11
- package/dist/elementRef.js +5 -32
- package/dist/generated/ast.d.ts +62 -60
- package/dist/generated/ast.js +59 -33
- package/dist/generated/grammar.d.ts +1 -1
- package/dist/generated/grammar.js +1 -1
- package/dist/generated/module.d.ts +1 -1
- package/dist/generated/module.js +1 -0
- package/dist/lsp/CodeLensProvider.js +2 -1
- package/dist/lsp/DocumentSymbolProvider.d.ts +1 -1
- package/dist/lsp/DocumentSymbolProvider.js +8 -5
- package/dist/lsp/SemanticTokenProvider.js +29 -63
- package/dist/model/fqn-computation.js +5 -5
- package/dist/model/fqn-index.d.ts +2 -1
- package/dist/model/fqn-index.js +26 -31
- package/dist/model/model-builder.js +20 -11
- package/dist/model/model-locator.js +4 -11
- package/dist/model/model-parser.d.ts +6 -3
- package/dist/model/model-parser.js +41 -36
- package/dist/module.js +4 -0
- package/dist/protocol.d.ts +0 -3
- package/dist/protocol.js +1 -4
- package/dist/references/scope-computation.js +19 -17
- package/dist/references/scope-provider.js +19 -19
- package/dist/shared/NodeKindProvider.d.ts +13 -0
- package/dist/shared/NodeKindProvider.js +29 -0
- package/dist/test/testServices.js +8 -8
- package/dist/utils.js +1 -1
- package/dist/validation/index.js +13 -3
- package/dist/validation/relation.js +12 -18
- package/dist/validation/specification.d.ts +3 -0
- package/dist/validation/specification.js +30 -0
- package/package.json +9 -9
|
@@ -4,9 +4,9 @@ export default {
|
|
|
4
4
|
'BottomTop','LeftRight','RightLeft','TopBottom','amber','autoLayout','blue','browser','color','crow','cylinder','dashed','description','diamond','dotted','element','exclude','extend','extends','gray','green','head','icon','include','indigo','it','kind','line','link','mobile','model','muted','none','normal','odiamond','of','onormal','open','person','primary','queue','rectangle','red','relationship','secondary','shape','sky','slate','solid','specification','storage','style','tag','tail','technology','this','title','vee','view','views'
|
|
5
5
|
],
|
|
6
6
|
operators: [
|
|
7
|
-
'*'
|
|
7
|
+
'*'
|
|
8
8
|
],
|
|
9
|
-
symbols: /\*|-\[
|
|
9
|
+
symbols: /\*|-\[|\]->/,
|
|
10
10
|
|
|
11
11
|
tokenizer: {
|
|
12
12
|
initial: [
|
|
@@ -15,13 +15,14 @@ export default {
|
|
|
15
15
|
{ regex: /-/, action: {"token":"DASH"} },
|
|
16
16
|
{ regex: /[^\W\d_]/, action: { cases: { '@keywords': {"token":"keyword"}, '@default': {"token":"LETTER"} }} },
|
|
17
17
|
{ regex: /[0-9]/, action: {"token":"DIGIT"} },
|
|
18
|
-
{ regex: /[\
|
|
18
|
+
{ regex: /[\r?\n]/, action: {"token":"NEWLINE"} },
|
|
19
19
|
{ regex: /\w+:\/\/\S+/, action: {"token":"URI_WITH_SCHEMA"} },
|
|
20
20
|
{ regex: /\.{0,2}\/[^\/]\S+/, action: {"token":"URI_RELATIVE"} },
|
|
21
|
-
{ regex: /->/, action: {"token":"
|
|
22
|
-
{ regex: /\b
|
|
21
|
+
{ regex: /->/, action: {"token":"RArrow"} },
|
|
22
|
+
{ regex: /\b\.\*/, action: {"token":"DotWildcard"} },
|
|
23
|
+
{ regex: /\b\./, action: {"token":"Dot"} },
|
|
23
24
|
{ regex: /!=/, action: {"token":"NotEqual"} },
|
|
24
|
-
{ regex:
|
|
25
|
+
{ regex: /\={1,2}/, action: {"token":"Eq"} },
|
|
25
26
|
{ regex: /\{/, action: {"token":"OpenBlock"} },
|
|
26
27
|
{ regex: /\}/, action: {"token":"CloseBlock"} },
|
|
27
28
|
{ regex: /:/, action: {"token":"Colon"} },
|
|
@@ -34,10 +35,10 @@ export default {
|
|
|
34
35
|
{ regex: /@symbols/, action: { cases: { '@operators': {"token":"operator"}, '@default': {"token":""} }} },
|
|
35
36
|
],
|
|
36
37
|
whitespace: [
|
|
38
|
+
{ regex: /[^\S\r\n]/, action: {"token":"white"} },
|
|
37
39
|
{ regex: /\/\*/, action: {"token":"comment","next":"@comment"} },
|
|
38
40
|
{ regex: /\/\/[^\n\r]*/, action: {"token":"comment"} },
|
|
39
|
-
{ regex: /(([\
|
|
40
|
-
{ regex: /[^\S\r\n]/, action: {"token":"white"} },
|
|
41
|
+
{ regex: /(([\r?\n])|([^\S\r\n]))+/, action: {"token":"white"} },
|
|
41
42
|
],
|
|
42
43
|
comment: [
|
|
43
44
|
{ regex: /[^/\*]+/, action: {"token":"comment"} },
|
package/dist/Rpc.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { logError, logger } from "./logger.js";
|
|
2
2
|
import pThrottle from "p-throttle";
|
|
3
3
|
import { nonexhaustive } from "@likec4/core";
|
|
4
|
-
import { URI } from "langium";
|
|
4
|
+
import { URI, UriUtils } from "langium";
|
|
5
5
|
import { isLikeC4LangiumDocument } from "./ast.js";
|
|
6
6
|
import {
|
|
7
7
|
buildDocuments,
|
|
@@ -9,17 +9,18 @@ import {
|
|
|
9
9
|
fetchModel,
|
|
10
10
|
fetchRawModel,
|
|
11
11
|
locate,
|
|
12
|
-
onDidChangeModel
|
|
13
|
-
rebuild
|
|
12
|
+
onDidChangeModel
|
|
14
13
|
} from "./protocol.js";
|
|
15
14
|
export class Rpc {
|
|
16
15
|
constructor(services) {
|
|
17
16
|
this.services = services;
|
|
18
17
|
}
|
|
19
18
|
init() {
|
|
20
|
-
const
|
|
19
|
+
const modelBuilder = this.services.likec4.ModelBuilder;
|
|
20
|
+
const modelLocator = this.services.likec4.ModelLocator;
|
|
21
21
|
const connection = this.services.shared.lsp.Connection;
|
|
22
22
|
if (!connection) {
|
|
23
|
+
logger.info(`[ServerRpc] no connection, not initializing`);
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
25
26
|
logger.info(`[ServerRpc] init`);
|
|
@@ -52,67 +53,20 @@ export class Rpc {
|
|
|
52
53
|
}
|
|
53
54
|
return Promise.resolve({ rawmodel });
|
|
54
55
|
});
|
|
55
|
-
connection.onRequest(computeView, ({ viewId }) => {
|
|
56
|
-
return {
|
|
56
|
+
connection.onRequest(computeView, async ({ viewId }, _cancelToken) => {
|
|
57
|
+
return Promise.resolve({
|
|
57
58
|
view: modelBuilder.computeView(viewId)
|
|
58
|
-
};
|
|
59
|
-
});
|
|
60
|
-
connection.onRequest(rebuild, async (cancelToken) => {
|
|
61
|
-
const changed = LangiumDocuments.all.map((d) => {
|
|
62
|
-
if (isLikeC4LangiumDocument(d)) {
|
|
63
|
-
delete d.c4Specification;
|
|
64
|
-
delete d.c4Elements;
|
|
65
|
-
delete d.c4Relations;
|
|
66
|
-
delete d.c4Views;
|
|
67
|
-
delete d.c4fqns;
|
|
68
|
-
}
|
|
69
|
-
return d.uri;
|
|
70
|
-
}).toArray();
|
|
71
|
-
logger.debug(`[ServerRpc] rebuild all documents: [
|
|
72
|
-
${changed.map((d) => d.toString()).join("\n ")}
|
|
73
|
-
]`);
|
|
74
|
-
await DocumentBuilder.update(changed, [], cancelToken);
|
|
75
|
-
return {
|
|
76
|
-
docs: changed.map((d) => d.toString())
|
|
77
|
-
};
|
|
59
|
+
});
|
|
78
60
|
});
|
|
79
61
|
connection.onRequest(buildDocuments, async ({ docs }, cancelToken) => {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
62
|
+
const changed = docs.map((d) => URI.parse(d));
|
|
63
|
+
const notChanged = (uri) => changed.every((c) => !UriUtils.equals(c, uri));
|
|
64
|
+
const deleted = LangiumDocuments.all.filter((d) => isLikeC4LangiumDocument(d) && notChanged(d.uri)).map((d) => d.uri).toArray();
|
|
84
65
|
logger.debug(
|
|
85
|
-
`[ServerRpc] received request to
|
|
86
|
-
${docs.map((d) => "
|
|
66
|
+
`[ServerRpc] received request to build:
|
|
67
|
+
changed (total ${changed.length}):${docs.map((d) => "\n - " + d).join("")}
|
|
68
|
+
deleted (total ${deleted.length}):${deleted.map((d) => "\n - " + d.toString()).join("\n")}`
|
|
87
69
|
);
|
|
88
|
-
const deleted = LangiumDocuments.all.filter((d) => !docs.includes(d.uri.toString())).map((d) => d.uri).toArray();
|
|
89
|
-
const changed = [];
|
|
90
|
-
for (const d of docs) {
|
|
91
|
-
try {
|
|
92
|
-
const uri = URI.parse(d);
|
|
93
|
-
if (LangiumDocuments.hasDocument(uri)) {
|
|
94
|
-
changed.push(uri);
|
|
95
|
-
} else {
|
|
96
|
-
logger.warn(`[ServerRpc] LangiumDocuments does not have document: ${d}`);
|
|
97
|
-
LangiumDocuments.getOrCreateDocument(uri);
|
|
98
|
-
}
|
|
99
|
-
} catch (e) {
|
|
100
|
-
logError(e);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
if (changed.length !== docs.length) {
|
|
104
|
-
const all = LangiumDocuments.all.map((d) => d.uri.toString()).toArray();
|
|
105
|
-
logger.warn(
|
|
106
|
-
`
|
|
107
|
-
[ServerRpc] We have in LangiumDocuments: [
|
|
108
|
-
${all.join("\n ")}
|
|
109
|
-
]
|
|
110
|
-
We rebuild: [
|
|
111
|
-
${changed.join("\n ")}
|
|
112
|
-
]
|
|
113
|
-
`.trim()
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
70
|
await DocumentBuilder.update(changed, deleted, cancelToken);
|
|
117
71
|
});
|
|
118
72
|
connection.onRequest(locate, (params) => {
|
package/dist/ast.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type c4 } from '@likec4/core';
|
|
3
3
|
import type { LangiumDocument, MultiMap } from 'langium';
|
|
4
|
-
import type {
|
|
4
|
+
import type { LikeC4Grammar } from './generated/ast';
|
|
5
5
|
import * as ast from './generated/ast';
|
|
6
6
|
export { ast };
|
|
7
|
+
declare const idattr: unique symbol;
|
|
7
8
|
declare module './generated/ast' {
|
|
8
9
|
interface Element {
|
|
9
|
-
|
|
10
|
+
[idattr]?: c4.Fqn;
|
|
11
|
+
}
|
|
12
|
+
interface ElementView {
|
|
13
|
+
[idattr]?: c4.ViewID;
|
|
10
14
|
}
|
|
11
15
|
}
|
|
12
16
|
export interface ParsedAstSpecification {
|
|
@@ -75,19 +79,14 @@ export interface LikeC4DocumentProps {
|
|
|
75
79
|
c4Views?: ParsedAstElementView[];
|
|
76
80
|
c4fqns?: MultiMap<c4.Fqn, DocFqnIndexEntry>;
|
|
77
81
|
}
|
|
78
|
-
export interface LikeC4LangiumDocument extends LangiumDocument<
|
|
82
|
+
export interface LikeC4LangiumDocument extends LangiumDocument<LikeC4Grammar>, LikeC4DocumentProps {
|
|
79
83
|
}
|
|
80
84
|
export type ParsedLikeC4LangiumDocument = Omit<LikeC4LangiumDocument, keyof LikeC4DocumentProps> & Required<LikeC4DocumentProps>;
|
|
81
|
-
export declare function cleanParsedModel(doc: LikeC4LangiumDocument):
|
|
82
|
-
elements: ParsedAstElement[];
|
|
83
|
-
relations: ParsedAstRelation[];
|
|
84
|
-
views: ParsedAstElementView[];
|
|
85
|
-
specification: ParsedAstSpecification;
|
|
86
|
-
};
|
|
85
|
+
export declare function cleanParsedModel(doc: LikeC4LangiumDocument): ParsedLikeC4LangiumDocument;
|
|
87
86
|
export declare function isLikeC4LangiumDocument(doc: LangiumDocument): doc is LikeC4LangiumDocument;
|
|
88
87
|
export declare function isParsedLikeC4LangiumDocument(doc: LangiumDocument): doc is ParsedLikeC4LangiumDocument;
|
|
89
88
|
export declare const isValidLikeC4LangiumDocument: (doc: LangiumDocument) => doc is ParsedLikeC4LangiumDocument;
|
|
90
|
-
export declare function streamModel(doc: LikeC4LangiumDocument): Generator<ast.
|
|
89
|
+
export declare function streamModel(doc: LikeC4LangiumDocument): Generator<ast.Relation | ast.Element, void, unknown>;
|
|
91
90
|
export declare function resolveRelationPoints(node: ast.Relation): {
|
|
92
91
|
source: ast.Element;
|
|
93
92
|
target: ast.Element;
|
package/dist/ast.js
CHANGED
|
@@ -11,11 +11,11 @@ import { DocumentState } from "langium";
|
|
|
11
11
|
import { elementRef } from "./elementRef.js";
|
|
12
12
|
import * as ast from "./generated/ast.js";
|
|
13
13
|
import { LikeC4LanguageMetaData } from "./generated/module.js";
|
|
14
|
+
import { isNil } from "remeda";
|
|
14
15
|
export { ast };
|
|
15
16
|
const idattr = Symbol.for("idattr");
|
|
16
17
|
export const ElementViewOps = {
|
|
17
18
|
writeId(node, id) {
|
|
18
|
-
;
|
|
19
19
|
node[idattr] = id;
|
|
20
20
|
return node;
|
|
21
21
|
},
|
|
@@ -25,13 +25,10 @@ export const ElementViewOps = {
|
|
|
25
25
|
};
|
|
26
26
|
export const ElementOps = {
|
|
27
27
|
writeId(node, id) {
|
|
28
|
-
if (id
|
|
28
|
+
if (isNil(id)) {
|
|
29
29
|
delete node[idattr];
|
|
30
|
-
delete node.fqn;
|
|
31
30
|
} else {
|
|
32
|
-
;
|
|
33
31
|
node[idattr] = id;
|
|
34
|
-
node.fqn = id;
|
|
35
32
|
}
|
|
36
33
|
return node;
|
|
37
34
|
},
|
|
@@ -40,19 +37,17 @@ export const ElementOps = {
|
|
|
40
37
|
}
|
|
41
38
|
};
|
|
42
39
|
export function cleanParsedModel(doc) {
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
elements,
|
|
52
|
-
relations,
|
|
53
|
-
views,
|
|
54
|
-
specification
|
|
40
|
+
const props = {
|
|
41
|
+
c4Specification: {
|
|
42
|
+
kinds: {},
|
|
43
|
+
relationships: {}
|
|
44
|
+
},
|
|
45
|
+
c4Elements: [],
|
|
46
|
+
c4Relations: [],
|
|
47
|
+
c4Views: []
|
|
55
48
|
};
|
|
49
|
+
Object.assign(doc, props);
|
|
50
|
+
return doc;
|
|
56
51
|
}
|
|
57
52
|
export function isLikeC4LangiumDocument(doc) {
|
|
58
53
|
return doc.textDocument.languageId === LikeC4LanguageMetaData.languageId;
|
|
@@ -67,7 +62,7 @@ export const isValidLikeC4LangiumDocument = (doc) => {
|
|
|
67
62
|
return state === DocumentState.Validated && parseResult.lexerErrors.length === 0 && (!diagnostics || diagnostics.every((d) => d.severity !== 1));
|
|
68
63
|
};
|
|
69
64
|
export function* streamModel(doc) {
|
|
70
|
-
const elements = doc.parseResult.value.
|
|
65
|
+
const elements = doc.parseResult.value.models.flatMap((m) => m.elements);
|
|
71
66
|
const traverseStack = [...elements];
|
|
72
67
|
const relations = [];
|
|
73
68
|
let el;
|
|
@@ -102,7 +97,7 @@ export function resolveRelationPoints(node) {
|
|
|
102
97
|
if (!target) {
|
|
103
98
|
throw new RelationRefError("Invalid reference to target");
|
|
104
99
|
}
|
|
105
|
-
if (
|
|
100
|
+
if (ast.isExplicitRelation(node)) {
|
|
106
101
|
const source = elementRef(node.source);
|
|
107
102
|
if (!source) {
|
|
108
103
|
throw new RelationRefError("Invalid reference to source");
|
|
@@ -112,9 +107,6 @@ export function resolveRelationPoints(node) {
|
|
|
112
107
|
target
|
|
113
108
|
};
|
|
114
109
|
}
|
|
115
|
-
if (!ast.isElementBody(node.$container)) {
|
|
116
|
-
throw new RelationRefError("Invalid relation parent, expected Element");
|
|
117
|
-
}
|
|
118
110
|
return {
|
|
119
111
|
source: node.$container.$container,
|
|
120
112
|
target
|
package/dist/elementRef.d.ts
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
import { type c4 } from '@likec4/core';
|
|
2
|
-
import { ast } from './ast';
|
|
3
|
-
export declare function isElementRefHead(node: ast.ElementRef | ast.StrictElementRef): boolean;
|
|
2
|
+
import type { ast } from './ast';
|
|
4
3
|
/**
|
|
5
4
|
* Returns referenced AST Element
|
|
6
5
|
*
|
|
7
6
|
*/
|
|
8
|
-
export declare function elementRef(node: ast.ElementRef | ast.
|
|
7
|
+
export declare function elementRef(node: ast.ElementRef | ast.FqnElementRef): ast.Element | undefined;
|
|
9
8
|
/**
|
|
10
|
-
* Returns FQN of
|
|
11
|
-
* a.b.c.d - for c node returns a.b
|
|
9
|
+
* Returns FQN of FqnElementRef
|
|
10
|
+
* a.b.c.d - for c node returns a.b.c
|
|
12
11
|
*/
|
|
13
|
-
export declare function
|
|
14
|
-
/**
|
|
15
|
-
* Returns parent FQN
|
|
16
|
-
* a.b.c.d - for c node returns a.b
|
|
17
|
-
*/
|
|
18
|
-
export declare function parentFqnElementRef(node: ast.StrictElementRef): c4.Fqn;
|
|
12
|
+
export declare function getFqnElementRef(node: ast.FqnElementRef): c4.Fqn;
|
|
19
13
|
//# sourceMappingURL=elementRef.d.ts.map
|
package/dist/elementRef.js
CHANGED
|
@@ -1,39 +1,12 @@
|
|
|
1
|
-
import { invariant, nonexhaustive } from "@likec4/core";
|
|
2
|
-
import { ast } from "./ast.js";
|
|
3
|
-
export function isElementRefHead(node) {
|
|
4
|
-
if (ast.isElementRef(node)) {
|
|
5
|
-
return !ast.isElementRef(node.$container);
|
|
6
|
-
}
|
|
7
|
-
if (ast.isStrictElementRef(node)) {
|
|
8
|
-
return !ast.isStrictElementRef(node.$container);
|
|
9
|
-
}
|
|
10
|
-
nonexhaustive(node);
|
|
11
|
-
}
|
|
12
1
|
export function elementRef(node) {
|
|
13
|
-
invariant(isElementRefHead(node), "Expected head ElementRef");
|
|
14
|
-
while (node.next) {
|
|
15
|
-
node = node.next;
|
|
16
|
-
}
|
|
17
2
|
return node.el.ref;
|
|
18
3
|
}
|
|
19
|
-
export function
|
|
20
|
-
invariant(isElementRefHead(node), "Expected head StrictElementRef");
|
|
4
|
+
export function getFqnElementRef(node) {
|
|
21
5
|
const name = [node.el.$refText];
|
|
22
|
-
let
|
|
23
|
-
while (
|
|
24
|
-
name.
|
|
25
|
-
|
|
6
|
+
let parent = node.parent;
|
|
7
|
+
while (parent) {
|
|
8
|
+
name.unshift(parent.el.$refText);
|
|
9
|
+
parent = parent.parent;
|
|
26
10
|
}
|
|
27
11
|
return name.join(".");
|
|
28
12
|
}
|
|
29
|
-
export function parentFqnElementRef(node) {
|
|
30
|
-
invariant(!isElementRefHead(node), "Expected next StrictElementRef");
|
|
31
|
-
const path = [];
|
|
32
|
-
let parent = node.$container;
|
|
33
|
-
while (ast.isStrictElementRef(parent)) {
|
|
34
|
-
path.unshift(parent.el.$refText);
|
|
35
|
-
parent = parent.$container;
|
|
36
|
-
}
|
|
37
|
-
invariant(path.length > 0, "Expected non-empty parent path");
|
|
38
|
-
return path.join(".");
|
|
39
|
-
}
|
package/dist/generated/ast.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
|
-
* This file was generated by langium-cli 2.0.
|
|
2
|
+
* This file was generated by langium-cli 2.1.0.
|
|
3
3
|
* DO NOT EDIT MANUALLY!
|
|
4
4
|
******************************************************************************/
|
|
5
5
|
import type { AstNode, Reference, ReferenceInfo, TypeMetaData } from 'langium';
|
|
@@ -10,7 +10,8 @@ export declare const LikeC4Terminals: {
|
|
|
10
10
|
WS: RegExp;
|
|
11
11
|
URI_WITH_SCHEMA: RegExp;
|
|
12
12
|
URI_RELATIVE: RegExp;
|
|
13
|
-
|
|
13
|
+
RArrow: RegExp;
|
|
14
|
+
DotWildcard: RegExp;
|
|
14
15
|
Dot: RegExp;
|
|
15
16
|
NotEqual: RegExp;
|
|
16
17
|
Eq: RegExp;
|
|
@@ -19,7 +20,7 @@ export declare const LikeC4Terminals: {
|
|
|
19
20
|
Colon: RegExp;
|
|
20
21
|
SemiColon: RegExp;
|
|
21
22
|
Comma: RegExp;
|
|
22
|
-
|
|
23
|
+
String: RegExp;
|
|
23
24
|
TagID: RegExp;
|
|
24
25
|
ID: RegExp;
|
|
25
26
|
};
|
|
@@ -28,7 +29,7 @@ export declare function isArrowType(item: unknown): item is ArrowType;
|
|
|
28
29
|
export type ElementExpression = ElementKindExpression | ElementRefExpression | ElementTagExpression | WildcardExpression;
|
|
29
30
|
export declare const ElementExpression = "ElementExpression";
|
|
30
31
|
export declare function isElementExpression(item: unknown): item is ElementExpression;
|
|
31
|
-
export type ElementProperty = ElementStringProperty | StyleProperties;
|
|
32
|
+
export type ElementProperty = ElementStringProperty | LinkProperty | StyleProperties;
|
|
32
33
|
export declare const ElementProperty = "ElementProperty";
|
|
33
34
|
export declare function isElementProperty(item: unknown): item is ElementProperty;
|
|
34
35
|
export type ElementShape = 'browser' | 'cylinder' | 'mobile' | 'person' | 'queue' | 'rectangle' | 'storage';
|
|
@@ -40,8 +41,9 @@ export type LineOptions = 'dashed' | 'dotted' | 'solid';
|
|
|
40
41
|
export declare function isLineOptions(item: unknown): item is LineOptions;
|
|
41
42
|
export type Name = 'element' | 'model' | ArrowType | ElementShape | LineOptions | ThemeColor | string;
|
|
42
43
|
export declare function isName(item: unknown): item is Name;
|
|
43
|
-
export type
|
|
44
|
-
export declare
|
|
44
|
+
export type Relation = ExplicitRelation | ImplicitRelation;
|
|
45
|
+
export declare const Relation = "Relation";
|
|
46
|
+
export declare function isRelation(item: unknown): item is Relation;
|
|
45
47
|
export type ThemeColor = 'amber' | 'blue' | 'gray' | 'green' | 'indigo' | 'muted' | 'primary' | 'red' | 'secondary' | 'sky' | 'slate';
|
|
46
48
|
export declare function isThemeColor(item: unknown): item is ThemeColor;
|
|
47
49
|
export type Uri = string;
|
|
@@ -84,7 +86,7 @@ export interface ElementBody extends AstNode {
|
|
|
84
86
|
readonly $container: Element;
|
|
85
87
|
readonly $type: 'ElementBody';
|
|
86
88
|
elements: Array<Element | Relation>;
|
|
87
|
-
props: Array<ElementProperty
|
|
89
|
+
props: Array<ElementProperty>;
|
|
88
90
|
tags?: Tags;
|
|
89
91
|
}
|
|
90
92
|
export declare const ElementBody = "ElementBody";
|
|
@@ -105,10 +107,10 @@ export interface ElementKindExpression extends AstNode {
|
|
|
105
107
|
export declare const ElementKindExpression = "ElementKindExpression";
|
|
106
108
|
export declare function isElementKindExpression(item: unknown): item is ElementKindExpression;
|
|
107
109
|
export interface ElementRef extends AstNode {
|
|
108
|
-
readonly $container: ElementRef | ElementRefExpression | ElementView |
|
|
110
|
+
readonly $container: ElementRef | ElementRefExpression | ElementView | ExplicitRelation | ImplicitRelation;
|
|
109
111
|
readonly $type: 'ElementRef';
|
|
110
112
|
el: Reference<Element>;
|
|
111
|
-
|
|
113
|
+
parent?: ElementRef;
|
|
112
114
|
}
|
|
113
115
|
export declare const ElementRef = "ElementRef";
|
|
114
116
|
export declare function isElementRef(item: unknown): item is ElementRef;
|
|
@@ -162,21 +164,41 @@ export interface ElementViewRef extends AstNode {
|
|
|
162
164
|
}
|
|
163
165
|
export declare const ElementViewRef = "ElementViewRef";
|
|
164
166
|
export declare function isElementViewRef(item: unknown): item is ElementViewRef;
|
|
167
|
+
export interface ExplicitRelation extends AstNode {
|
|
168
|
+
readonly $container: ElementBody | ExtendElementBody | Model;
|
|
169
|
+
readonly $type: 'ExplicitRelation';
|
|
170
|
+
kind?: Reference<RelationshipKind>;
|
|
171
|
+
props: Array<RelationStringProperty>;
|
|
172
|
+
source: ElementRef;
|
|
173
|
+
tags?: Tags;
|
|
174
|
+
target: ElementRef;
|
|
175
|
+
title?: string;
|
|
176
|
+
}
|
|
177
|
+
export declare const ExplicitRelation = "ExplicitRelation";
|
|
178
|
+
export declare function isExplicitRelation(item: unknown): item is ExplicitRelation;
|
|
165
179
|
export interface ExtendElement extends AstNode {
|
|
166
180
|
readonly $container: Model;
|
|
167
181
|
readonly $type: 'ExtendElement';
|
|
168
182
|
body: ExtendElementBody;
|
|
169
|
-
element:
|
|
183
|
+
element: FqnElementRef;
|
|
170
184
|
}
|
|
171
185
|
export declare const ExtendElement = "ExtendElement";
|
|
172
186
|
export declare function isExtendElement(item: unknown): item is ExtendElement;
|
|
173
187
|
export interface ExtendElementBody extends AstNode {
|
|
174
188
|
readonly $container: ExtendElement;
|
|
175
189
|
readonly $type: 'ExtendElementBody';
|
|
176
|
-
elements: Array<Element |
|
|
190
|
+
elements: Array<Element | ExplicitRelation>;
|
|
177
191
|
}
|
|
178
192
|
export declare const ExtendElementBody = "ExtendElementBody";
|
|
179
193
|
export declare function isExtendElementBody(item: unknown): item is ExtendElementBody;
|
|
194
|
+
export interface FqnElementRef extends AstNode {
|
|
195
|
+
readonly $container: ExtendElement | FqnElementRef;
|
|
196
|
+
readonly $type: 'FqnElementRef';
|
|
197
|
+
el: Reference<Element>;
|
|
198
|
+
parent?: FqnElementRef;
|
|
199
|
+
}
|
|
200
|
+
export declare const FqnElementRef = "FqnElementRef";
|
|
201
|
+
export declare function isFqnElementRef(item: unknown): item is FqnElementRef;
|
|
180
202
|
export interface IconProperty extends AstNode {
|
|
181
203
|
readonly $container: StyleProperties | ViewRuleStyle;
|
|
182
204
|
readonly $type: 'IconProperty';
|
|
@@ -185,10 +207,20 @@ export interface IconProperty extends AstNode {
|
|
|
185
207
|
}
|
|
186
208
|
export declare const IconProperty = "IconProperty";
|
|
187
209
|
export declare function isIconProperty(item: unknown): item is IconProperty;
|
|
210
|
+
export interface ImplicitRelation extends AstNode {
|
|
211
|
+
readonly $container: ElementBody;
|
|
212
|
+
readonly $type: 'ImplicitRelation';
|
|
213
|
+
kind?: Reference<RelationshipKind>;
|
|
214
|
+
props: Array<RelationStringProperty>;
|
|
215
|
+
tags?: Tags;
|
|
216
|
+
target: ElementRef;
|
|
217
|
+
title?: string;
|
|
218
|
+
}
|
|
219
|
+
export declare const ImplicitRelation = "ImplicitRelation";
|
|
220
|
+
export declare function isImplicitRelation(item: unknown): item is ImplicitRelation;
|
|
188
221
|
export interface IncomingExpression extends AstNode {
|
|
189
222
|
readonly $container: InOutExpression | ViewRuleExpression;
|
|
190
223
|
readonly $type: 'IncomingExpression';
|
|
191
|
-
arr: RArrow;
|
|
192
224
|
target: ElementExpression;
|
|
193
225
|
}
|
|
194
226
|
export declare const IncomingExpression = "IncomingExpression";
|
|
@@ -196,19 +228,18 @@ export declare function isIncomingExpression(item: unknown): item is IncomingExp
|
|
|
196
228
|
export interface InOutExpression extends AstNode {
|
|
197
229
|
readonly $container: ViewRuleExpression;
|
|
198
230
|
readonly $type: 'InOutExpression';
|
|
199
|
-
arr: RArrow;
|
|
200
231
|
inout: IncomingExpression;
|
|
201
232
|
}
|
|
202
233
|
export declare const InOutExpression = "InOutExpression";
|
|
203
234
|
export declare function isInOutExpression(item: unknown): item is InOutExpression;
|
|
204
|
-
export interface
|
|
205
|
-
readonly $type: '
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
views
|
|
209
|
-
}
|
|
210
|
-
export declare const
|
|
211
|
-
export declare function
|
|
235
|
+
export interface LikeC4Grammar extends AstNode {
|
|
236
|
+
readonly $type: 'LikeC4Grammar';
|
|
237
|
+
models: Array<Model>;
|
|
238
|
+
specifications: Array<SpecificationRule>;
|
|
239
|
+
views: Array<ModelViews>;
|
|
240
|
+
}
|
|
241
|
+
export declare const LikeC4Grammar = "LikeC4Grammar";
|
|
242
|
+
export declare function isLikeC4Grammar(item: unknown): item is LikeC4Grammar;
|
|
212
243
|
export interface LineProperty extends AstNode {
|
|
213
244
|
readonly $container: SpecificationRelationshipKind;
|
|
214
245
|
readonly $type: 'LineProperty';
|
|
@@ -226,15 +257,15 @@ export interface LinkProperty extends AstNode {
|
|
|
226
257
|
export declare const LinkProperty = "LinkProperty";
|
|
227
258
|
export declare function isLinkProperty(item: unknown): item is LinkProperty;
|
|
228
259
|
export interface Model extends AstNode {
|
|
229
|
-
readonly $container:
|
|
260
|
+
readonly $container: LikeC4Grammar;
|
|
230
261
|
readonly $type: 'Model';
|
|
231
|
-
elements: Array<Element |
|
|
262
|
+
elements: Array<Element | ExplicitRelation | ExtendElement>;
|
|
232
263
|
name: 'model';
|
|
233
264
|
}
|
|
234
265
|
export declare const Model = "Model";
|
|
235
266
|
export declare function isModel(item: unknown): item is Model;
|
|
236
267
|
export interface ModelViews extends AstNode {
|
|
237
|
-
readonly $container:
|
|
268
|
+
readonly $container: LikeC4Grammar;
|
|
238
269
|
readonly $type: 'ModelViews';
|
|
239
270
|
name: 'views';
|
|
240
271
|
views: Array<View>;
|
|
@@ -244,35 +275,13 @@ export declare function isModelViews(item: unknown): item is ModelViews;
|
|
|
244
275
|
export interface OutgoingExpression extends AstNode {
|
|
245
276
|
readonly $container: ViewRuleExpression;
|
|
246
277
|
readonly $type: 'OutgoingExpression';
|
|
247
|
-
arr: RArrow;
|
|
248
278
|
source: ElementExpression;
|
|
249
279
|
}
|
|
250
280
|
export declare const OutgoingExpression = "OutgoingExpression";
|
|
251
281
|
export declare function isOutgoingExpression(item: unknown): item is OutgoingExpression;
|
|
252
|
-
export interface Relation extends AstNode {
|
|
253
|
-
readonly $container: ElementBody | ExtendElementBody | Model;
|
|
254
|
-
readonly $type: 'Relation';
|
|
255
|
-
arr?: RArrow;
|
|
256
|
-
body?: RelationBody;
|
|
257
|
-
kind?: Reference<RelationshipKind>;
|
|
258
|
-
source?: ElementRef;
|
|
259
|
-
target: ElementRef;
|
|
260
|
-
title?: string;
|
|
261
|
-
}
|
|
262
|
-
export declare const Relation = "Relation";
|
|
263
|
-
export declare function isRelation(item: unknown): item is Relation;
|
|
264
|
-
export interface RelationBody extends AstNode {
|
|
265
|
-
readonly $container: Relation;
|
|
266
|
-
readonly $type: 'RelationBody';
|
|
267
|
-
props: Array<RelationStringProperty>;
|
|
268
|
-
tags?: Tags;
|
|
269
|
-
}
|
|
270
|
-
export declare const RelationBody = "RelationBody";
|
|
271
|
-
export declare function isRelationBody(item: unknown): item is RelationBody;
|
|
272
282
|
export interface RelationExpression extends AstNode {
|
|
273
283
|
readonly $container: ViewRuleExpression;
|
|
274
284
|
readonly $type: 'RelationExpression';
|
|
275
|
-
arr: RArrow;
|
|
276
285
|
source: ElementExpression;
|
|
277
286
|
target: ElementExpression;
|
|
278
287
|
}
|
|
@@ -286,7 +295,7 @@ export interface RelationshipKind extends AstNode {
|
|
|
286
295
|
export declare const RelationshipKind = "RelationshipKind";
|
|
287
296
|
export declare function isRelationshipKind(item: unknown): item is RelationshipKind;
|
|
288
297
|
export interface RelationStringProperty extends AstNode {
|
|
289
|
-
readonly $container:
|
|
298
|
+
readonly $container: ExplicitRelation | ImplicitRelation;
|
|
290
299
|
readonly $type: 'RelationStringProperty';
|
|
291
300
|
key: 'title';
|
|
292
301
|
value: string;
|
|
@@ -318,7 +327,7 @@ export interface SpecificationRelationshipKind extends AstNode {
|
|
|
318
327
|
export declare const SpecificationRelationshipKind = "SpecificationRelationshipKind";
|
|
319
328
|
export declare function isSpecificationRelationshipKind(item: unknown): item is SpecificationRelationshipKind;
|
|
320
329
|
export interface SpecificationRule extends AstNode {
|
|
321
|
-
readonly $container:
|
|
330
|
+
readonly $container: LikeC4Grammar;
|
|
322
331
|
readonly $type: 'SpecificationRule';
|
|
323
332
|
elements: Array<SpecificationElementKind>;
|
|
324
333
|
name: 'specification';
|
|
@@ -335,14 +344,6 @@ export interface SpecificationTag extends AstNode {
|
|
|
335
344
|
}
|
|
336
345
|
export declare const SpecificationTag = "SpecificationTag";
|
|
337
346
|
export declare function isSpecificationTag(item: unknown): item is SpecificationTag;
|
|
338
|
-
export interface StrictElementRef extends AstNode {
|
|
339
|
-
readonly $container: ExtendElement | StrictElementRef;
|
|
340
|
-
readonly $type: 'StrictElementRef';
|
|
341
|
-
el: Reference<Element>;
|
|
342
|
-
next?: StrictElementRef;
|
|
343
|
-
}
|
|
344
|
-
export declare const StrictElementRef = "StrictElementRef";
|
|
345
|
-
export declare function isStrictElementRef(item: unknown): item is StrictElementRef;
|
|
346
347
|
export interface StyleProperties extends AstNode {
|
|
347
348
|
readonly $container: ElementBody | SpecificationElementKind | SpecificationTag;
|
|
348
349
|
readonly $type: 'StyleProperties';
|
|
@@ -359,7 +360,7 @@ export interface Tag extends AstNode {
|
|
|
359
360
|
export declare const Tag = "Tag";
|
|
360
361
|
export declare function isTag(item: unknown): item is Tag;
|
|
361
362
|
export interface Tags extends AstNode {
|
|
362
|
-
readonly $container: ElementBody | ElementViewBody |
|
|
363
|
+
readonly $container: ElementBody | ElementViewBody | ExplicitRelation | ImplicitRelation;
|
|
363
364
|
readonly $type: 'Tags';
|
|
364
365
|
value: Array<Reference<Tag>>;
|
|
365
366
|
}
|
|
@@ -419,20 +420,22 @@ export type LikeC4AstType = {
|
|
|
419
420
|
ElementView: ElementView;
|
|
420
421
|
ElementViewBody: ElementViewBody;
|
|
421
422
|
ElementViewRef: ElementViewRef;
|
|
423
|
+
ExplicitRelation: ExplicitRelation;
|
|
422
424
|
Expression: Expression;
|
|
423
425
|
ExtendElement: ExtendElement;
|
|
424
426
|
ExtendElementBody: ExtendElementBody;
|
|
427
|
+
FqnElementRef: FqnElementRef;
|
|
425
428
|
IconProperty: IconProperty;
|
|
429
|
+
ImplicitRelation: ImplicitRelation;
|
|
426
430
|
InOutExpression: InOutExpression;
|
|
427
431
|
IncomingExpression: IncomingExpression;
|
|
428
|
-
|
|
432
|
+
LikeC4Grammar: LikeC4Grammar;
|
|
429
433
|
LineProperty: LineProperty;
|
|
430
434
|
LinkProperty: LinkProperty;
|
|
431
435
|
Model: Model;
|
|
432
436
|
ModelViews: ModelViews;
|
|
433
437
|
OutgoingExpression: OutgoingExpression;
|
|
434
438
|
Relation: Relation;
|
|
435
|
-
RelationBody: RelationBody;
|
|
436
439
|
RelationExpression: RelationExpression;
|
|
437
440
|
RelationStringProperty: RelationStringProperty;
|
|
438
441
|
RelationshipKind: RelationshipKind;
|
|
@@ -441,7 +444,6 @@ export type LikeC4AstType = {
|
|
|
441
444
|
SpecificationRelationshipKind: SpecificationRelationshipKind;
|
|
442
445
|
SpecificationRule: SpecificationRule;
|
|
443
446
|
SpecificationTag: SpecificationTag;
|
|
444
|
-
StrictElementRef: StrictElementRef;
|
|
445
447
|
StyleProperties: StyleProperties;
|
|
446
448
|
Tag: Tag;
|
|
447
449
|
Tags: Tags;
|