@likec4/language-server 1.46.4 → 1.48.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/LICENSE +1 -1
- package/browser/package.json +2 -2
- package/browser-worker/package.json +2 -2
- package/bundled/package.json +4 -0
- package/dist/LikeC4LanguageServices.d.mts +4 -0
- package/dist/LikeC4LanguageServices.mjs +3 -0
- package/dist/_chunks/ConfigurableLayouter.mjs +1956 -0
- package/dist/_chunks/LikeC4LanguageServices.d.mts +1978 -0
- package/dist/_chunks/LikeC4LanguageServices.mjs +725 -0
- package/dist/_chunks/ast.d.mts +1444 -0
- package/dist/_chunks/ast.mjs +2375 -0
- package/dist/_chunks/ast2.mjs +176 -0
- package/dist/_chunks/common-exports.mjs +0 -0
- package/dist/_chunks/filesystem.mjs +58 -0
- package/dist/_chunks/grammar.mjs +8 -0
- package/dist/_chunks/icons.mjs +5211 -0
- package/dist/_chunks/libs/@hono/node-server.mjs +436 -0
- package/dist/_chunks/libs/@msgpack/msgpack.mjs +805 -0
- package/dist/_chunks/libs/eventemitter3.mjs +243 -0
- package/dist/_chunks/libs/fast-equals.mjs +446 -0
- package/dist/_chunks/libs/hono.mjs +1829 -0
- package/dist/_chunks/libs/p-queue.mjs +449 -0
- package/dist/_chunks/libs/parse-ms.mjs +36 -0
- package/dist/_chunks/libs/picomatch.mjs +1673 -0
- package/dist/_chunks/libs/pretty-ms.mjs +80 -0
- package/dist/_chunks/libs/remeda.mjs +482 -0
- package/dist/_chunks/libs/strip-indent.mjs +15 -0
- package/dist/_chunks/libs/ufo.mjs +166 -0
- package/dist/_chunks/likec4lib.mjs +9 -0
- package/dist/_chunks/mcp.mjs +33 -0
- package/dist/_chunks/module.mjs +28 -0
- package/dist/_chunks/module2.mjs +6576 -0
- package/dist/_chunks/protocol.d.mts +311 -0
- package/dist/_chunks/protocol.mjs +78 -0
- package/dist/_chunks/rolldown-runtime.mjs +42 -0
- package/dist/ast.d.mts +4 -0
- package/dist/ast.mjs +4 -0
- package/dist/browser-worker.d.mts +1 -0
- package/dist/browser-worker.mjs +6 -0
- package/dist/browser.d.mts +11 -0
- package/dist/browser.mjs +27 -0
- package/dist/bundled.d.mts +28 -0
- package/dist/bundled.mjs +51 -4681
- package/dist/common-exports.d.mts +4 -0
- package/dist/common-exports.mjs +5 -0
- package/dist/filesystem/index.d.mts +4 -0
- package/dist/filesystem/index.mjs +3 -0
- package/dist/generated/ast.d.mts +2 -0
- package/dist/generated/ast.mjs +3 -0
- package/dist/generated/grammar.d.mts +6 -0
- package/dist/generated/grammar.mjs +3 -0
- package/dist/generated/module.d.mts +14 -0
- package/dist/generated/module.mjs +3 -0
- package/dist/generated-lib/icons.d.mts +4 -0
- package/dist/generated-lib/icons.mjs +3 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.mjs +48 -0
- package/dist/likec4lib.d.mts +9 -0
- package/dist/likec4lib.mjs +4 -0
- package/dist/mcp/index.d.mts +4 -0
- package/dist/mcp/index.mjs +3 -0
- package/dist/module.d.mts +4 -0
- package/dist/module.mjs +3 -0
- package/dist/protocol.d.mts +2 -0
- package/dist/protocol.mjs +3 -0
- package/likec4lib/package.json +2 -2
- package/package.json +106 -62
- package/protocol/package.json +2 -2
- package/dist/LikeC4LanguageServices.d.ts +0 -109
- package/dist/LikeC4LanguageServices.js +0 -154
- package/dist/Rpc.d.ts +0 -9
- package/dist/Rpc.js +0 -270
- package/dist/ast.d.ts +0 -226
- package/dist/ast.js +0 -264
- package/dist/browser-worker.d.ts +0 -1
- package/dist/browser-worker.js +0 -4
- package/dist/browser.d.ts +0 -11
- package/dist/browser.js +0 -35
- package/dist/bundled.d.ts +0 -8
- package/dist/bundled.js +0 -44
- package/dist/documentation/documentation-provider.d.ts +0 -8
- package/dist/documentation/documentation-provider.js +0 -51
- package/dist/documentation/index.d.ts +0 -1
- package/dist/documentation/index.js +0 -1
- package/dist/empty.d.ts +0 -2
- package/dist/empty.js +0 -2
- package/dist/filesystem/ChokidarWatcher.d.ts +0 -16
- package/dist/filesystem/ChokidarWatcher.js +0 -108
- package/dist/filesystem/FileSystemWatcher.d.ts +0 -19
- package/dist/filesystem/FileSystemWatcher.js +0 -14
- package/dist/filesystem/LikeC4FileSystem.d.ts +0 -3
- package/dist/filesystem/LikeC4FileSystem.js +0 -130
- package/dist/filesystem/index.d.ts +0 -55
- package/dist/filesystem/index.js +0 -29
- package/dist/formatting/LikeC4Formatter.d.ts +0 -59
- package/dist/formatting/LikeC4Formatter.js +0 -637
- package/dist/formatting/utils.d.ts +0 -6
- package/dist/formatting/utils.js +0 -18
- package/dist/generated/ast.d.ts +0 -1411
- package/dist/generated/ast.js +0 -2207
- package/dist/generated/grammar.d.ts +0 -6
- package/dist/generated/grammar.js +0 -7
- package/dist/generated/module.d.ts +0 -14
- package/dist/generated/module.js +0 -27
- package/dist/generated-lib/icons.d.ts +0 -1
- package/dist/generated-lib/icons.js +0 -18
- package/dist/index.d.ts +0 -38
- package/dist/index.js +0 -55
- package/dist/likec4lib.d.ts +0 -6
- package/dist/likec4lib.js +0 -7
- package/dist/logger.d.ts +0 -17
- package/dist/logger.js +0 -81
- package/dist/lsp/CodeActionProvider.d.ts +0 -14
- package/dist/lsp/CodeActionProvider.js +0 -33
- package/dist/lsp/CodeLensProvider.d.ts +0 -9
- package/dist/lsp/CodeLensProvider.js +0 -44
- package/dist/lsp/CompletionProvider.d.ts +0 -11
- package/dist/lsp/CompletionProvider.js +0 -200
- package/dist/lsp/DocumentHighlightProvider.d.ts +0 -9
- package/dist/lsp/DocumentHighlightProvider.js +0 -10
- package/dist/lsp/DocumentLinkProvider.d.ts +0 -11
- package/dist/lsp/DocumentLinkProvider.js +0 -58
- package/dist/lsp/DocumentSymbolProvider.d.ts +0 -33
- package/dist/lsp/DocumentSymbolProvider.js +0 -317
- package/dist/lsp/HoverProvider.d.ts +0 -10
- package/dist/lsp/HoverProvider.js +0 -106
- package/dist/lsp/RenameProvider.d.ts +0 -5
- package/dist/lsp/RenameProvider.js +0 -6
- package/dist/lsp/SemanticTokenProvider.d.ts +0 -12
- package/dist/lsp/SemanticTokenProvider.js +0 -264
- package/dist/lsp/index.d.ts +0 -8
- package/dist/lsp/index.js +0 -9
- package/dist/mcp/MCPServerFactory.d.ts +0 -8
- package/dist/mcp/MCPServerFactory.js +0 -73
- package/dist/mcp/NoopLikeC4MCPServer.d.ts +0 -9
- package/dist/mcp/NoopLikeC4MCPServer.js +0 -17
- package/dist/mcp/interfaces.d.ts +0 -13
- package/dist/mcp/interfaces.js +0 -5
- package/dist/mcp/server/StdioLikeC4MCPServer.d.ts +0 -16
- package/dist/mcp/server/StdioLikeC4MCPServer.js +0 -51
- package/dist/mcp/server/StreamableLikeC4MCPServer.d.ts +0 -16
- package/dist/mcp/server/StreamableLikeC4MCPServer.js +0 -145
- package/dist/mcp/server/WithMCPServer.d.ts +0 -4
- package/dist/mcp/server/WithMCPServer.js +0 -54
- package/dist/mcp/tools/_common.d.ts +0 -88
- package/dist/mcp/tools/_common.js +0 -49
- package/dist/mcp/tools/find-relationships.d.ts +0 -12
- package/dist/mcp/tools/find-relationships.js +0 -150
- package/dist/mcp/tools/list-projects.d.ts +0 -6
- package/dist/mcp/tools/list-projects.js +0 -62
- package/dist/mcp/tools/open-view.d.ts +0 -10
- package/dist/mcp/tools/open-view.js +0 -52
- package/dist/mcp/tools/read-deployment.d.ts +0 -10
- package/dist/mcp/tools/read-deployment.js +0 -150
- package/dist/mcp/tools/read-element.d.ts +0 -10
- package/dist/mcp/tools/read-element.js +0 -218
- package/dist/mcp/tools/read-project-summary.d.ts +0 -8
- package/dist/mcp/tools/read-project-summary.js +0 -176
- package/dist/mcp/tools/read-view.d.ts +0 -10
- package/dist/mcp/tools/read-view.js +0 -203
- package/dist/mcp/tools/search-element.d.ts +0 -8
- package/dist/mcp/tools/search-element.js +0 -177
- package/dist/mcp/utils.d.ts +0 -18
- package/dist/mcp/utils.js +0 -48
- package/dist/model/builder/MergedExtends.d.ts +0 -13
- package/dist/model/builder/MergedExtends.js +0 -74
- package/dist/model/builder/MergedSpecification.d.ts +0 -32
- package/dist/model/builder/MergedSpecification.js +0 -175
- package/dist/model/builder/buildModel.d.ts +0 -16
- package/dist/model/builder/buildModel.js +0 -245
- package/dist/model/deployments-index.d.ts +0 -10
- package/dist/model/deployments-index.js +0 -102
- package/dist/model/fqn-index.d.ts +0 -61
- package/dist/model/fqn-index.js +0 -253
- package/dist/model/index.d.ts +0 -6
- package/dist/model/index.js +0 -6
- package/dist/model/model-builder.d.ts +0 -52
- package/dist/model/model-builder.js +0 -224
- package/dist/model/model-locator.d.ts +0 -39
- package/dist/model/model-locator.js +0 -240
- package/dist/model/model-parser-where.d.ts +0 -4
- package/dist/model/model-parser-where.js +0 -81
- package/dist/model/model-parser.d.ts +0 -645
- package/dist/model/model-parser.js +0 -133
- package/dist/model/parser/Base.d.ts +0 -69
- package/dist/model/parser/Base.js +0 -372
- package/dist/model/parser/DeploymentModelParser.d.ts +0 -71
- package/dist/model/parser/DeploymentModelParser.js +0 -176
- package/dist/model/parser/DeploymentViewParser.d.ts +0 -75
- package/dist/model/parser/DeploymentViewParser.js +0 -86
- package/dist/model/parser/FqnRefParser.d.ts +0 -66
- package/dist/model/parser/FqnRefParser.js +0 -382
- package/dist/model/parser/GlobalsParser.d.ts +0 -109
- package/dist/model/parser/GlobalsParser.js +0 -84
- package/dist/model/parser/ImportsParser.d.ts +0 -46
- package/dist/model/parser/ImportsParser.js +0 -24
- package/dist/model/parser/ModelParser.d.ts +0 -71
- package/dist/model/parser/ModelParser.js +0 -209
- package/dist/model/parser/PredicatesParser.d.ts +0 -75
- package/dist/model/parser/PredicatesParser.js +0 -45
- package/dist/model/parser/SpecificationParser.d.ts +0 -53
- package/dist/model/parser/SpecificationParser.js +0 -113
- package/dist/model/parser/ValueConverter.d.ts +0 -4
- package/dist/model/parser/ValueConverter.js +0 -12
- package/dist/model/parser/ViewsParser.d.ts +0 -112
- package/dist/model/parser/ViewsParser.js +0 -492
- package/dist/model-change/ModelChanges.d.ts +0 -18
- package/dist/model-change/ModelChanges.js +0 -129
- package/dist/model-change/changeElementStyle.d.ts +0 -16
- package/dist/model-change/changeElementStyle.js +0 -134
- package/dist/model-change/changeViewLayout.d.ts +0 -12
- package/dist/model-change/changeViewLayout.js +0 -28
- package/dist/model-change/removeManualLayoutV1.d.ts +0 -7
- package/dist/model-change/removeManualLayoutV1.js +0 -27
- package/dist/module.d.ts +0 -92
- package/dist/module.js +0 -143
- package/dist/protocol.d.ts +0 -284
- package/dist/protocol.js +0 -123
- package/dist/references/index.d.ts +0 -3
- package/dist/references/index.js +0 -3
- package/dist/references/name-provider.d.ts +0 -9
- package/dist/references/name-provider.js +0 -37
- package/dist/references/scope-computation.d.ts +0 -20
- package/dist/references/scope-computation.js +0 -288
- package/dist/references/scope-provider.d.ts +0 -40
- package/dist/references/scope-provider.js +0 -239
- package/dist/shared/NodeKindProvider.d.ts +0 -15
- package/dist/shared/NodeKindProvider.js +0 -57
- package/dist/shared/WorkspaceSymbolProvider.d.ts +0 -3
- package/dist/shared/WorkspaceSymbolProvider.js +0 -3
- package/dist/shared/index.d.ts +0 -2
- package/dist/shared/index.js +0 -2
- package/dist/test/index.d.ts +0 -1
- package/dist/test/index.js +0 -1
- package/dist/test/testServices.d.ts +0 -64
- package/dist/test/testServices.js +0 -210
- package/dist/utils/disposable.d.ts +0 -8
- package/dist/utils/disposable.js +0 -26
- package/dist/utils/elementRef.d.ts +0 -11
- package/dist/utils/elementRef.js +0 -27
- package/dist/utils/fqnRef.d.ts +0 -11
- package/dist/utils/fqnRef.js +0 -63
- package/dist/utils/index.d.ts +0 -11
- package/dist/utils/index.js +0 -35
- package/dist/utils/printDocs.d.ts +0 -2
- package/dist/utils/printDocs.js +0 -1
- package/dist/utils/projectId.d.ts +0 -4
- package/dist/utils/projectId.js +0 -16
- package/dist/utils/stringHash.d.ts +0 -1
- package/dist/utils/stringHash.js +0 -5
- package/dist/validation/DocumentValidator.d.ts +0 -11
- package/dist/validation/DocumentValidator.js +0 -17
- package/dist/validation/_shared.d.ts +0 -3
- package/dist/validation/_shared.js +0 -26
- package/dist/validation/deployment-checks.d.ts +0 -7
- package/dist/validation/deployment-checks.js +0 -140
- package/dist/validation/dynamic-view.d.ts +0 -6
- package/dist/validation/dynamic-view.js +0 -67
- package/dist/validation/element-ref.d.ts +0 -4
- package/dist/validation/element-ref.js +0 -12
- package/dist/validation/element.d.ts +0 -4
- package/dist/validation/element.js +0 -49
- package/dist/validation/imports.d.ts +0 -4
- package/dist/validation/imports.js +0 -46
- package/dist/validation/index.d.ts +0 -15
- package/dist/validation/index.js +0 -167
- package/dist/validation/property-checks.d.ts +0 -7
- package/dist/validation/property-checks.js +0 -108
- package/dist/validation/relation.d.ts +0 -6
- package/dist/validation/relation.js +0 -141
- package/dist/validation/specification.d.ts +0 -12
- package/dist/validation/specification.js +0 -190
- package/dist/validation/view-checks.d.ts +0 -4
- package/dist/validation/view-checks.js +0 -46
- package/dist/validation/view-predicates/fqn-expr-with.d.ts +0 -4
- package/dist/validation/view-predicates/fqn-expr-with.js +0 -43
- package/dist/validation/view-predicates/fqn-ref-expr.d.ts +0 -4
- package/dist/validation/view-predicates/fqn-ref-expr.js +0 -51
- package/dist/validation/view-predicates/incoming.d.ts +0 -4
- package/dist/validation/view-predicates/incoming.js +0 -16
- package/dist/validation/view-predicates/index.d.ts +0 -6
- package/dist/validation/view-predicates/index.js +0 -6
- package/dist/validation/view-predicates/outgoing.d.ts +0 -4
- package/dist/validation/view-predicates/outgoing.js +0 -20
- package/dist/validation/view-predicates/relation-expr.d.ts +0 -4
- package/dist/validation/view-predicates/relation-expr.js +0 -46
- package/dist/validation/view-predicates/relation-with.d.ts +0 -4
- package/dist/validation/view-predicates/relation-with.js +0 -16
- package/dist/validation/view.d.ts +0 -4
- package/dist/validation/view.js +0 -42
- package/dist/view-utils/assignNavigateTo.d.ts +0 -2
- package/dist/view-utils/assignNavigateTo.js +0 -27
- package/dist/view-utils/index.d.ts +0 -2
- package/dist/view-utils/index.js +0 -2
- package/dist/view-utils/manual-layout.d.ts +0 -13
- package/dist/view-utils/manual-layout.js +0 -149
- package/dist/views/ConfigurableLayouter.d.ts +0 -7
- package/dist/views/ConfigurableLayouter.js +0 -51
- package/dist/views/LikeC4ManualLayouts.d.ts +0 -42
- package/dist/views/LikeC4ManualLayouts.js +0 -209
- package/dist/views/LikeC4Views.d.ts +0 -89
- package/dist/views/LikeC4Views.js +0 -216
- package/dist/views/index.d.ts +0 -4
- package/dist/views/index.js +0 -11
- package/dist/workspace/AstNodeDescriptionProvider.d.ts +0 -7
- package/dist/workspace/AstNodeDescriptionProvider.js +0 -18
- package/dist/workspace/IndexManager.d.ts +0 -10
- package/dist/workspace/IndexManager.js +0 -26
- package/dist/workspace/LangiumDocuments.d.ts +0 -25
- package/dist/workspace/LangiumDocuments.js +0 -98
- package/dist/workspace/ProjectsManager.d.ts +0 -130
- package/dist/workspace/ProjectsManager.js +0 -605
- package/dist/workspace/WorkspaceManager.d.ts +0 -31
- package/dist/workspace/WorkspaceManager.js +0 -132
- package/dist/workspace/index.d.ts +0 -5
- package/dist/workspace/index.js +0 -5
|
@@ -1,382 +0,0 @@
|
|
|
1
|
-
import { invariant, nonexhaustive, nonNullable } from '@likec4/core';
|
|
2
|
-
import { loggable } from '@likec4/log';
|
|
3
|
-
import { AstUtils } from 'langium';
|
|
4
|
-
import { isBoolean, isDefined, isNonNullish, isTruthy } from 'remeda';
|
|
5
|
-
import { ast, parseAstOpacityProperty, parseAstSizeValue, parseMarkdownAsString, toColor } from '../../ast';
|
|
6
|
-
import { serverLogger } from '../../logger';
|
|
7
|
-
import { projectIdFrom } from '../../utils';
|
|
8
|
-
import { importsRef, instanceRef } from '../../utils/fqnRef';
|
|
9
|
-
import { createBinaryOperator, parseWhereClause } from '../model-parser-where';
|
|
10
|
-
import { removeIndent } from './Base';
|
|
11
|
-
const logger = serverLogger.getChild('ExpressionV2Parser');
|
|
12
|
-
const location = (astNode) => {
|
|
13
|
-
const cst = astNode.$cstNode;
|
|
14
|
-
const position = cst ? `:${cst.range.start.line + 1}:${cst.range.start.character + 1}` : '';
|
|
15
|
-
return `${AstUtils.getDocument(astNode).uri.fsPath}${position}`;
|
|
16
|
-
};
|
|
17
|
-
export function ExpressionV2Parser(B) {
|
|
18
|
-
return class ExpressionV2Parser extends B {
|
|
19
|
-
parseFqnRef(astNode) {
|
|
20
|
-
const refValue = nonNullable(astNode.value?.ref, () => `FqnRef "${astNode.$cstNode?.text}" is empty at ${location(astNode)}`);
|
|
21
|
-
if (ast.isImported(refValue)) {
|
|
22
|
-
const fqnRef = {
|
|
23
|
-
project: projectIdFrom(refValue),
|
|
24
|
-
model: this.resolveFqn(nonNullable(refValue.imported.ref, `FqnRef is empty of imported: ${refValue.$cstNode?.text}`)),
|
|
25
|
-
};
|
|
26
|
-
this.doc.c4Imports.set(fqnRef.project, fqnRef.model);
|
|
27
|
-
return fqnRef;
|
|
28
|
-
}
|
|
29
|
-
if (ast.isElement(refValue)) {
|
|
30
|
-
const imported = importsRef(astNode);
|
|
31
|
-
if (imported) {
|
|
32
|
-
const fqnRef = {
|
|
33
|
-
project: projectIdFrom(imported),
|
|
34
|
-
model: this.resolveFqn(refValue),
|
|
35
|
-
};
|
|
36
|
-
this.doc.c4Imports.set(fqnRef.project, fqnRef.model);
|
|
37
|
-
return fqnRef;
|
|
38
|
-
}
|
|
39
|
-
const deployedInstanceAst = instanceRef(astNode);
|
|
40
|
-
if (!deployedInstanceAst) {
|
|
41
|
-
return {
|
|
42
|
-
model: this.resolveFqn(refValue),
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
const deployment = this.resolveFqn(deployedInstanceAst);
|
|
46
|
-
const element = this.resolveFqn(refValue);
|
|
47
|
-
return {
|
|
48
|
-
deployment,
|
|
49
|
-
element,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
if (ast.isDeploymentElement(refValue)) {
|
|
53
|
-
return {
|
|
54
|
-
deployment: this.resolveFqn(refValue),
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
nonexhaustive(refValue);
|
|
58
|
-
}
|
|
59
|
-
parseExpressionV2(astNode) {
|
|
60
|
-
if (ast.isFqnExprOrWith(astNode)) {
|
|
61
|
-
return this.parseFqnExprOrWith(astNode);
|
|
62
|
-
}
|
|
63
|
-
if (ast.isRelationExprOrWith(astNode)) {
|
|
64
|
-
return this.parseRelationExprOrWith(astNode);
|
|
65
|
-
}
|
|
66
|
-
nonexhaustive(astNode);
|
|
67
|
-
}
|
|
68
|
-
parseFqnExprOrWith(astNode) {
|
|
69
|
-
if (ast.isFqnExprWith(astNode)) {
|
|
70
|
-
return this.parseFqnExprWith(astNode);
|
|
71
|
-
}
|
|
72
|
-
if (ast.isFqnExprOrWhere(astNode)) {
|
|
73
|
-
return this.parseFqnExprOrWhere(astNode);
|
|
74
|
-
}
|
|
75
|
-
nonexhaustive(astNode);
|
|
76
|
-
}
|
|
77
|
-
parseFqnExprWith(astNode) {
|
|
78
|
-
const expr = this.parseFqnExprOrWhere(astNode.subject);
|
|
79
|
-
const props = astNode.custom?.props ?? [];
|
|
80
|
-
return props.reduce((acc, prop) => {
|
|
81
|
-
if (!this.isValid(prop)) {
|
|
82
|
-
return acc;
|
|
83
|
-
}
|
|
84
|
-
if (ast.isNavigateToProperty(prop)) {
|
|
85
|
-
const viewId = prop.value.view.$refText;
|
|
86
|
-
if (isTruthy(viewId)) {
|
|
87
|
-
acc.custom.navigateTo = viewId;
|
|
88
|
-
}
|
|
89
|
-
return acc;
|
|
90
|
-
}
|
|
91
|
-
if (ast.isElementStringProperty(prop)) {
|
|
92
|
-
if (isDefined(prop.value) && prop.key !== 'summary') {
|
|
93
|
-
if (prop.key === 'description') {
|
|
94
|
-
const parsed = this.parseMarkdownOrString(prop.value);
|
|
95
|
-
if (parsed) {
|
|
96
|
-
acc.custom['description'] = parsed;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
acc.custom[prop.key] = removeIndent(parseMarkdownAsString(prop.value)) || '';
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return acc;
|
|
104
|
-
}
|
|
105
|
-
if (ast.isIconProperty(prop)) {
|
|
106
|
-
const value = this.parseIconProperty(prop);
|
|
107
|
-
if (isDefined(value)) {
|
|
108
|
-
acc.custom[prop.key] = value;
|
|
109
|
-
}
|
|
110
|
-
return acc;
|
|
111
|
-
}
|
|
112
|
-
if (ast.isColorProperty(prop)) {
|
|
113
|
-
const value = toColor(prop);
|
|
114
|
-
if (isDefined(value)) {
|
|
115
|
-
acc.custom[prop.key] = value;
|
|
116
|
-
}
|
|
117
|
-
return acc;
|
|
118
|
-
}
|
|
119
|
-
if (ast.isShapeProperty(prop)) {
|
|
120
|
-
if (isDefined(prop.value)) {
|
|
121
|
-
acc.custom[prop.key] = prop.value;
|
|
122
|
-
}
|
|
123
|
-
return acc;
|
|
124
|
-
}
|
|
125
|
-
if (ast.isBorderProperty(prop)) {
|
|
126
|
-
if (isDefined(prop.value)) {
|
|
127
|
-
acc.custom[prop.key] = prop.value;
|
|
128
|
-
}
|
|
129
|
-
return acc;
|
|
130
|
-
}
|
|
131
|
-
if (ast.isOpacityProperty(prop)) {
|
|
132
|
-
if (isDefined(prop.value)) {
|
|
133
|
-
acc.custom[prop.key] = parseAstOpacityProperty(prop);
|
|
134
|
-
}
|
|
135
|
-
return acc;
|
|
136
|
-
}
|
|
137
|
-
if (ast.isNotationProperty(prop)) {
|
|
138
|
-
const value = isTruthy(prop.value) ? removeIndent(parseMarkdownAsString(prop.value)) : undefined;
|
|
139
|
-
if (value) {
|
|
140
|
-
acc.custom[prop.key] = value;
|
|
141
|
-
}
|
|
142
|
-
return acc;
|
|
143
|
-
}
|
|
144
|
-
if (ast.isMultipleProperty(prop)) {
|
|
145
|
-
if (isBoolean(prop.value)) {
|
|
146
|
-
acc.custom[prop.key] = prop.value;
|
|
147
|
-
}
|
|
148
|
-
return acc;
|
|
149
|
-
}
|
|
150
|
-
if (ast.isShapeSizeProperty(prop)) {
|
|
151
|
-
if (isTruthy(prop.value)) {
|
|
152
|
-
acc.custom[prop.key] = parseAstSizeValue(prop);
|
|
153
|
-
}
|
|
154
|
-
return acc;
|
|
155
|
-
}
|
|
156
|
-
if (ast.isTextSizeProperty(prop)) {
|
|
157
|
-
if (isTruthy(prop.value)) {
|
|
158
|
-
acc.custom[prop.key] = parseAstSizeValue(prop);
|
|
159
|
-
}
|
|
160
|
-
return acc;
|
|
161
|
-
}
|
|
162
|
-
if (ast.isPaddingSizeProperty(prop)) {
|
|
163
|
-
if (isTruthy(prop.value)) {
|
|
164
|
-
acc.custom[prop.key] = parseAstSizeValue(prop);
|
|
165
|
-
}
|
|
166
|
-
return acc;
|
|
167
|
-
}
|
|
168
|
-
nonexhaustive(prop);
|
|
169
|
-
}, {
|
|
170
|
-
custom: {
|
|
171
|
-
expr,
|
|
172
|
-
},
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
parseFqnExprOrWhere(astNode) {
|
|
176
|
-
if (ast.isFqnExprWhere(astNode)) {
|
|
177
|
-
return this.parseFqnExprWhere(astNode);
|
|
178
|
-
}
|
|
179
|
-
if (ast.isFqnExpr(astNode)) {
|
|
180
|
-
return this.parseFqnExpr(astNode);
|
|
181
|
-
}
|
|
182
|
-
nonexhaustive(astNode);
|
|
183
|
-
}
|
|
184
|
-
parseFqnExprWhere(astNode) {
|
|
185
|
-
invariant(!ast.isFqnExprWhere(astNode.subject), 'FqnExprWhere is not allowed as subject of FqnExprWhere');
|
|
186
|
-
return {
|
|
187
|
-
where: {
|
|
188
|
-
expr: this.parseFqnExpr(astNode.subject),
|
|
189
|
-
condition: astNode.where ? parseWhereClause(astNode.where) : {
|
|
190
|
-
kind: { neq: '--always-true--' },
|
|
191
|
-
},
|
|
192
|
-
},
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
parseFqnExpr(astNode) {
|
|
196
|
-
if (ast.isWildcardExpression(astNode)) {
|
|
197
|
-
return {
|
|
198
|
-
wildcard: true,
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
if (ast.isElementKindExpression(astNode)) {
|
|
202
|
-
invariant(astNode.kind?.ref, 'ElementKindExpr kind is not resolved: ' + astNode.$cstNode?.text);
|
|
203
|
-
return {
|
|
204
|
-
elementKind: astNode.kind.ref.name,
|
|
205
|
-
isEqual: astNode.isEqual,
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
if (ast.isElementTagExpression(astNode)) {
|
|
209
|
-
invariant(astNode.tag.tag.ref, 'ElementTagExpr tag is not resolved: ' + astNode.$cstNode?.text);
|
|
210
|
-
let elementTag = astNode.tag.tag.$refText;
|
|
211
|
-
return {
|
|
212
|
-
elementTag: elementTag,
|
|
213
|
-
isEqual: astNode.isEqual,
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
if (ast.isFqnRefExpr(astNode)) {
|
|
217
|
-
return this.parseFqnRefExpr(astNode);
|
|
218
|
-
}
|
|
219
|
-
nonexhaustive(astNode);
|
|
220
|
-
}
|
|
221
|
-
parseFqnRefExpr(astNode) {
|
|
222
|
-
const ref = this.parseFqnRef(astNode.ref);
|
|
223
|
-
switch (true) {
|
|
224
|
-
case astNode.selector === '._':
|
|
225
|
-
return {
|
|
226
|
-
ref,
|
|
227
|
-
selector: 'expanded',
|
|
228
|
-
};
|
|
229
|
-
case astNode.selector === '.**':
|
|
230
|
-
return {
|
|
231
|
-
ref,
|
|
232
|
-
selector: 'descendants',
|
|
233
|
-
};
|
|
234
|
-
case astNode.selector === '.*':
|
|
235
|
-
return {
|
|
236
|
-
ref,
|
|
237
|
-
selector: 'children',
|
|
238
|
-
};
|
|
239
|
-
default:
|
|
240
|
-
return { ref };
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
parseFqnExpressions(astNode) {
|
|
244
|
-
const exprs = [];
|
|
245
|
-
let iter = astNode;
|
|
246
|
-
while (iter) {
|
|
247
|
-
try {
|
|
248
|
-
if (isNonNullish(iter.value) && this.isValid(iter.value)) {
|
|
249
|
-
exprs.push(this.parseFqnExpr(iter.value));
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
catch (e) {
|
|
253
|
-
logger.warn(loggable(e));
|
|
254
|
-
}
|
|
255
|
-
iter = iter.prev;
|
|
256
|
-
}
|
|
257
|
-
return exprs.reverse();
|
|
258
|
-
}
|
|
259
|
-
parseRelationExprOrWith(astNode) {
|
|
260
|
-
if (ast.isRelationExprWith(astNode)) {
|
|
261
|
-
return this.parseRelationExprWith(astNode);
|
|
262
|
-
}
|
|
263
|
-
if (ast.isRelationExprOrWhere(astNode)) {
|
|
264
|
-
return this.parseRelationExprOrWhere(astNode);
|
|
265
|
-
}
|
|
266
|
-
nonexhaustive(astNode);
|
|
267
|
-
}
|
|
268
|
-
parseRelationExprWith(astNode) {
|
|
269
|
-
const expr = this.parseRelationExprOrWhere(astNode.subject);
|
|
270
|
-
const customProps = this.parseCustomRelationProperties(astNode.custom);
|
|
271
|
-
return {
|
|
272
|
-
customRelation: {
|
|
273
|
-
...customProps,
|
|
274
|
-
expr,
|
|
275
|
-
},
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
parseCustomRelationProperties(custom) {
|
|
279
|
-
const props = custom?.props ?? [];
|
|
280
|
-
return props.reduce((acc, prop) => {
|
|
281
|
-
if (ast.isRelationStringProperty(prop) || ast.isNotationProperty(prop) || ast.isNotesProperty(prop)) {
|
|
282
|
-
const value = isTruthy(prop.value) ? removeIndent(parseMarkdownAsString(prop.value)) : undefined;
|
|
283
|
-
if (value) {
|
|
284
|
-
acc[prop.key] = value;
|
|
285
|
-
}
|
|
286
|
-
return acc;
|
|
287
|
-
}
|
|
288
|
-
if (ast.isArrowProperty(prop)) {
|
|
289
|
-
if (isTruthy(prop.value)) {
|
|
290
|
-
acc[prop.key] = prop.value;
|
|
291
|
-
}
|
|
292
|
-
return acc;
|
|
293
|
-
}
|
|
294
|
-
if (ast.isColorProperty(prop)) {
|
|
295
|
-
const value = toColor(prop);
|
|
296
|
-
if (isTruthy(value)) {
|
|
297
|
-
acc[prop.key] = value;
|
|
298
|
-
}
|
|
299
|
-
return acc;
|
|
300
|
-
}
|
|
301
|
-
if (ast.isLineProperty(prop)) {
|
|
302
|
-
if (isTruthy(prop.value)) {
|
|
303
|
-
acc[prop.key] = prop.value;
|
|
304
|
-
}
|
|
305
|
-
return acc;
|
|
306
|
-
}
|
|
307
|
-
if (ast.isRelationNavigateToProperty(prop)) {
|
|
308
|
-
const viewId = prop.value.view.ref?.name;
|
|
309
|
-
if (isTruthy(viewId)) {
|
|
310
|
-
acc[prop.key] = viewId;
|
|
311
|
-
}
|
|
312
|
-
return acc;
|
|
313
|
-
}
|
|
314
|
-
nonexhaustive(prop);
|
|
315
|
-
}, {});
|
|
316
|
-
}
|
|
317
|
-
parseRelationExprOrWhere(astNode) {
|
|
318
|
-
if (ast.isRelationExprWhere(astNode)) {
|
|
319
|
-
return this.parseRelationExprWhere(astNode);
|
|
320
|
-
}
|
|
321
|
-
if (ast.isRelationExpr(astNode)) {
|
|
322
|
-
return this.parseRelationExpr(astNode);
|
|
323
|
-
}
|
|
324
|
-
nonexhaustive(astNode);
|
|
325
|
-
}
|
|
326
|
-
parseRelationExprWhere(astNode) {
|
|
327
|
-
invariant(!ast.isRelationExprWhere(astNode.subject), 'RelationExprWhere is not allowed as subject of RelationExprWhere');
|
|
328
|
-
const relationOrWhereExpr = this.parseRelationExpr(astNode.subject);
|
|
329
|
-
const expr = relationOrWhereExpr.where?.expr ?? relationOrWhereExpr;
|
|
330
|
-
const kindCondition = relationOrWhereExpr.where?.condition;
|
|
331
|
-
const whereCondition = astNode.where ? parseWhereClause(astNode.where) : null;
|
|
332
|
-
let condition;
|
|
333
|
-
if (whereCondition && kindCondition) {
|
|
334
|
-
condition = createBinaryOperator('and', kindCondition, whereCondition);
|
|
335
|
-
}
|
|
336
|
-
else {
|
|
337
|
-
condition = whereCondition
|
|
338
|
-
?? kindCondition
|
|
339
|
-
?? { kind: { neq: '--always-true--' } };
|
|
340
|
-
}
|
|
341
|
-
return {
|
|
342
|
-
where: {
|
|
343
|
-
expr: expr,
|
|
344
|
-
condition: condition,
|
|
345
|
-
},
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
parseRelationExpr(astNode) {
|
|
349
|
-
switch (astNode.$type) {
|
|
350
|
-
case 'DirectedRelationExpr':
|
|
351
|
-
return this.wrapInWhere({
|
|
352
|
-
source: this.parseFqnExpr(astNode.source.from),
|
|
353
|
-
target: this.parseFqnExpr(astNode.target),
|
|
354
|
-
isBidirectional: astNode.source.isBidirectional,
|
|
355
|
-
}, this.parseInlineKindCondition(astNode.source));
|
|
356
|
-
case 'InOutRelationExpr':
|
|
357
|
-
return {
|
|
358
|
-
inout: this.parseFqnExpr(astNode.inout.to),
|
|
359
|
-
};
|
|
360
|
-
case 'OutgoingRelationExpr':
|
|
361
|
-
return this.wrapInWhere({ outgoing: this.parseFqnExpr(astNode.from) }, this.parseInlineKindCondition(astNode));
|
|
362
|
-
case 'IncomingRelationExpr':
|
|
363
|
-
return {
|
|
364
|
-
incoming: this.parseFqnExpr(astNode.to),
|
|
365
|
-
};
|
|
366
|
-
default:
|
|
367
|
-
nonexhaustive(astNode);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
parseInlineKindCondition(astNode) {
|
|
371
|
-
const kind = astNode.kind ?? astNode.dotKind?.kind;
|
|
372
|
-
if (kind) {
|
|
373
|
-
invariant(kind.ref, 'Kind is not resolved: ' + astNode.$cstNode?.text);
|
|
374
|
-
return { kind: { eq: kind.ref?.name } };
|
|
375
|
-
}
|
|
376
|
-
return null;
|
|
377
|
-
}
|
|
378
|
-
wrapInWhere(expr, condition) {
|
|
379
|
-
return condition ? { where: { expr, condition } } : expr;
|
|
380
|
-
}
|
|
381
|
-
};
|
|
382
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import type * as c4 from '@likec4/core';
|
|
2
|
-
import { type ParsedAstGlobals, ast } from '../../ast';
|
|
3
|
-
import type { WithViewsParser } from './ViewsParser';
|
|
4
|
-
export declare function GlobalsParser<TBase extends WithViewsParser>(B: TBase): {
|
|
5
|
-
new (...args: any[]): {
|
|
6
|
-
parseGlobals(): void;
|
|
7
|
-
parseAndStoreGlobalPredicateGroupOrDynamic(astRule: ast.GlobalPredicateGroup | ast.GlobalDynamicPredicateGroup, id: c4.GlobalPredicateId, c4Globals: ParsedAstGlobals): void;
|
|
8
|
-
parseGlobalPredicateGroup(astRule: ast.GlobalPredicateGroup): c4.ElementViewPredicate[];
|
|
9
|
-
parseGlobalDynamicPredicateGroup(astRule: ast.GlobalDynamicPredicateGroup): c4.DynamicViewIncludeRule[];
|
|
10
|
-
parseGlobalStyleOrGroup(astRule: ast.GlobalStyle | ast.GlobalStyleGroup): c4.ElementViewRuleStyle[];
|
|
11
|
-
parseViews(): void;
|
|
12
|
-
parseElementView(astNode: ast.ElementView, additionalStyles: (c4.ViewRuleGlobalStyle | c4.ElementViewRuleStyle<c4.aux.Any>)[]): import("../../ast").ParsedAstElementView;
|
|
13
|
-
parseElementViewRule(astRule: ast.ViewRule): c4.ElementViewRule;
|
|
14
|
-
parseViewRulePredicate(astNode: ast.ViewRulePredicate): c4.ElementViewPredicate;
|
|
15
|
-
parseViewRuleGlobalPredicateRef(astRule: ast.ViewRuleGlobalPredicateRef | ast.DynamicViewGlobalPredicateRef): c4.ViewRuleGlobalPredicateRef;
|
|
16
|
-
parseViewRuleStyleOrGlobalRef(astRule: ast.ViewRuleStyleOrGlobalRef): c4.ViewRuleGlobalStyle | c4.ElementViewRuleStyle<c4.aux.Any>;
|
|
17
|
-
parseViewRuleGroup(astNode: ast.ViewRuleGroup): c4.ElementViewRuleGroup;
|
|
18
|
-
parseViewRuleRank(astRule: ast.ViewRuleRank): c4.ElementViewRuleRank;
|
|
19
|
-
parseViewRuleStyle(astRule: ast.ViewRuleStyle | ast.GlobalStyle): c4.ElementViewRuleStyle;
|
|
20
|
-
parseViewRuleGlobalStyle(astRule: ast.ViewRuleGlobalStyle): c4.ViewRuleGlobalStyle;
|
|
21
|
-
parseDynamicElementView(astNode: ast.DynamicView, additionalStyles: (c4.ViewRuleGlobalStyle | c4.ElementViewRuleStyle<c4.aux.Any>)[]): import("../../ast").ParsedAstDynamicView;
|
|
22
|
-
parseDynamicViewRule(astRule: ast.DynamicViewRule): c4.DynamicViewRule;
|
|
23
|
-
parseDynamicViewIncludePredicate(astRule: ast.DynamicViewIncludePredicate): c4.DynamicViewIncludeRule;
|
|
24
|
-
parseDynamicParallelSteps(node: ast.DynamicViewParallelSteps): c4.DynamicStepsParallel;
|
|
25
|
-
parseDynamicStep(node: ast.DynamicViewStep): c4.DynamicStep | c4.DynamicStepsSeries;
|
|
26
|
-
recursiveParseDynamicStepChain(node: ast.DynamicStepChain, callstack?: Array<[source: c4.Fqn, target: c4.Fqn]>): c4.DynamicStep[];
|
|
27
|
-
parseDynamicStepSingle(node: ast.DynamicStepSingle): c4.DynamicStep;
|
|
28
|
-
parseAbstractDynamicStep(astnode: ast.AbstractDynamicStep): import("type-fest").Writable<import("type-fest").Except<c4.DynamicStep, "source", {
|
|
29
|
-
requireExactProps: true;
|
|
30
|
-
}>>;
|
|
31
|
-
parsePredicate(astNode: ast.ExpressionV2): c4.ModelExpression;
|
|
32
|
-
parseElementPredicate(astNode: ast.FqnExprOrWith): c4.ModelFqnExpr.Any;
|
|
33
|
-
parseElementPredicateOrWhere(astNode: ast.FqnExprOrWhere): c4.ModelFqnExpr.OrWhere;
|
|
34
|
-
parseElementExpression(astNode: ast.FqnExpr): c4.ModelFqnExpr;
|
|
35
|
-
parseElementPredicateWhere(astNode: ast.FqnExprWhere): c4.ModelFqnExpr.Where;
|
|
36
|
-
parseElementPredicateWith(astNode: ast.FqnExprWith): c4.ModelFqnExpr.Custom;
|
|
37
|
-
parseRelationPredicate(astNode: ast.RelationExprOrWith): c4.ModelRelationExpr.Any;
|
|
38
|
-
parseRelationPredicateOrWhere(astNode: ast.RelationExprOrWhere): c4.ModelRelationExpr.OrWhere;
|
|
39
|
-
parseRelationPredicateWhere(astNode: ast.RelationExprWhere): c4.ModelRelationExpr.Where;
|
|
40
|
-
parseRelationPredicateWith(astNode: ast.RelationExprWith): c4.ModelRelationExpr.Custom;
|
|
41
|
-
parseRelationExpression(astNode: ast.RelationExpr): c4.ModelRelationExpr;
|
|
42
|
-
parseFqnRef(astNode: ast.FqnRef): c4.FqnRef;
|
|
43
|
-
parseExpressionV2(astNode: ast.ExpressionV2): c4.Expression;
|
|
44
|
-
parseFqnExprOrWith(astNode: ast.FqnExprOrWith): c4.FqnExpr.Any;
|
|
45
|
-
parseFqnExprWith(astNode: ast.FqnExprWith): c4.FqnExpr.Custom;
|
|
46
|
-
parseFqnExprOrWhere(astNode: ast.FqnExprOrWhere): c4.FqnExpr.OrWhere;
|
|
47
|
-
parseFqnExprWhere(astNode: ast.FqnExprWhere): c4.FqnExpr.Where;
|
|
48
|
-
parseFqnExpr(astNode: ast.FqnExpr): c4.FqnExpr;
|
|
49
|
-
parseFqnRefExpr(astNode: ast.FqnRefExpr): c4.FqnExpr.NonWildcard;
|
|
50
|
-
parseFqnExpressions(astNode: ast.FqnExpressions): c4.FqnExpr[];
|
|
51
|
-
parseRelationExprOrWith(astNode: ast.RelationExprOrWith): c4.RelationExpr.Any;
|
|
52
|
-
parseRelationExprWith(astNode: ast.RelationExprWith): c4.RelationExpr.Custom;
|
|
53
|
-
parseCustomRelationProperties(custom: ast.CustomRelationProperties | undefined): import("type-fest").Except<c4.RelationExpr.Custom["customRelation"], "expr">;
|
|
54
|
-
parseRelationExprOrWhere(astNode: ast.RelationExprOrWhere): c4.RelationExpr.OrWhere;
|
|
55
|
-
parseRelationExprWhere(astNode: ast.RelationExprWhere): c4.RelationExpr.Where;
|
|
56
|
-
parseRelationExpr(astNode: ast.RelationExpr): c4.RelationExpr.OrWhere;
|
|
57
|
-
parseInlineKindCondition(astNode: ast.OutgoingRelationExpr): c4.WhereOperator | null;
|
|
58
|
-
wrapInWhere(expr: c4.RelationExpr, condition: c4.WhereOperator | null): c4.RelationExpr.OrWhere;
|
|
59
|
-
isValid: import("../../validation").IsValidFn;
|
|
60
|
-
readonly services: import("../..").LikeC4Services;
|
|
61
|
-
readonly doc: import("../../ast").ParsedLikeC4LangiumDocument;
|
|
62
|
-
get project(): import("../../workspace").Project;
|
|
63
|
-
resolveFqn(node: ast.FqnReferenceable): c4.Fqn;
|
|
64
|
-
getAstNodePath(node: import("langium").AstNode): string;
|
|
65
|
-
getMetadata(metadataAstNode: ast.MetadataProperty | undefined): {
|
|
66
|
-
[key: string]: string | string[];
|
|
67
|
-
} | undefined;
|
|
68
|
-
parseMarkdownOrString(markdownOrString: ast.MarkdownOrString | undefined): c4.MarkdownOrString | undefined;
|
|
69
|
-
convertTags<E extends {
|
|
70
|
-
tags?: ast.Tags;
|
|
71
|
-
}>(withTags?: E | undefined): c4.NonEmptyArray<c4.Tag<string>> | null;
|
|
72
|
-
parseTags<E extends {
|
|
73
|
-
tags?: ast.Tags;
|
|
74
|
-
}>(withTags?: E): c4.NonEmptyArray<c4.Tag> | null;
|
|
75
|
-
convertLinks(source?: ast.LinkProperty["$container"]): c4.Link[] | undefined;
|
|
76
|
-
parseLinks(source?: ast.LinkProperty["$container"]): c4.Link[] | undefined;
|
|
77
|
-
parseIconProperty(prop: ast.IconProperty | undefined): c4.IconUrl | undefined;
|
|
78
|
-
parseImageAlias(value: string): string | undefined;
|
|
79
|
-
parseColorLiteral(astNode: ast.ColorLiteral): c4.ColorLiteral | undefined;
|
|
80
|
-
parseElementStyle(elementProps: Array<ast.ElementProperty> | ast.ElementStyleProperty | undefined): import("../../ast").ParsedElementStyle;
|
|
81
|
-
parseStyleProps(styleProps: Array<ast.StyleProperty> | undefined): import("../../ast").ParsedElementStyle;
|
|
82
|
-
parseBaseProps(props: {
|
|
83
|
-
title?: ast.MarkdownOrString | undefined;
|
|
84
|
-
summary?: ast.MarkdownOrString | undefined;
|
|
85
|
-
description?: ast.MarkdownOrString | undefined;
|
|
86
|
-
technology?: ast.MarkdownOrString | undefined;
|
|
87
|
-
}, override?: {
|
|
88
|
-
title?: string | undefined;
|
|
89
|
-
summary?: string | undefined;
|
|
90
|
-
description?: string | undefined;
|
|
91
|
-
technology?: string | undefined;
|
|
92
|
-
}): {
|
|
93
|
-
title?: string;
|
|
94
|
-
summary?: c4.MarkdownOrString;
|
|
95
|
-
description?: c4.MarkdownOrString;
|
|
96
|
-
technology?: string;
|
|
97
|
-
};
|
|
98
|
-
parseDeploymentView(astNode: ast.DeploymentView): import("../../ast").ParsedAstDeploymentView;
|
|
99
|
-
parseDeploymentViewRule(astRule: ast.DeploymentViewRule): c4.DeploymentViewRule;
|
|
100
|
-
parseDeploymentViewRulePredicate(astRule: ast.DeploymentViewRulePredicate): c4.DeploymentViewPredicate;
|
|
101
|
-
parseDeploymentViewRuleStyle(astRule: ast.DeploymentViewRuleStyle): c4.DeploymentViewRuleStyle;
|
|
102
|
-
parseDeployment(): void;
|
|
103
|
-
parseDeploymentNode(astNode: ast.DeploymentNode): import("../../ast").ParsedAstDeployment.Node;
|
|
104
|
-
parseDeployedInstance(astNode: ast.DeployedInstance): import("../../ast").ParsedAstDeployment.Instance;
|
|
105
|
-
parseExtendDeployment(astNode: ast.ExtendDeployment): import("../../ast").ParsedAstExtend | null;
|
|
106
|
-
_resolveDeploymentRelationSource(node: ast.DeploymentRelation): c4.FqnRef;
|
|
107
|
-
parseDeploymentRelation(astNode: ast.DeploymentRelation): import("../../ast").ParsedAstDeploymentRelation;
|
|
108
|
-
};
|
|
109
|
-
} & TBase;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { nonexhaustive } from '@likec4/core';
|
|
2
|
-
import { loggable } from '@likec4/log';
|
|
3
|
-
import { hasAtLeast, isTruthy } from 'remeda';
|
|
4
|
-
import { ast } from '../../ast';
|
|
5
|
-
import { serverLogger } from '../../logger';
|
|
6
|
-
const logger = serverLogger.getChild('GlobalsParser');
|
|
7
|
-
export function GlobalsParser(B) {
|
|
8
|
-
return class GlobalsParser extends B {
|
|
9
|
-
parseGlobals() {
|
|
10
|
-
const { parseResult, c4Globals } = this.doc;
|
|
11
|
-
const isValid = this.isValid;
|
|
12
|
-
const globals = parseResult.value.globals.filter(isValid);
|
|
13
|
-
const elRelPredicates = globals.flatMap(r => r.predicates.filter(isValid));
|
|
14
|
-
for (const predicate of elRelPredicates) {
|
|
15
|
-
try {
|
|
16
|
-
const globalPredicateId = predicate.name;
|
|
17
|
-
if (!isTruthy(globalPredicateId)) {
|
|
18
|
-
continue;
|
|
19
|
-
}
|
|
20
|
-
if (globalPredicateId in c4Globals.predicates) {
|
|
21
|
-
logger.warn(`Global predicate named "${globalPredicateId}" is already defined`);
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
this.parseAndStoreGlobalPredicateGroupOrDynamic(predicate, globalPredicateId, c4Globals);
|
|
25
|
-
}
|
|
26
|
-
catch (e) {
|
|
27
|
-
logger.warn(loggable(e));
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
const styles = globals.flatMap(r => r.styles.filter(isValid));
|
|
31
|
-
for (const style of styles) {
|
|
32
|
-
try {
|
|
33
|
-
const globalStyleId = style.id.name;
|
|
34
|
-
if (!isTruthy(globalStyleId)) {
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
if (globalStyleId in c4Globals.styles) {
|
|
38
|
-
logger.warn(`Global style named "${globalStyleId}" is already defined`);
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
const styles = this.parseGlobalStyleOrGroup(style);
|
|
42
|
-
if (hasAtLeast(styles, 1)) {
|
|
43
|
-
c4Globals.styles[globalStyleId] = styles;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
catch (e) {
|
|
47
|
-
logger.warn(loggable(e));
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
parseAndStoreGlobalPredicateGroupOrDynamic(astRule, id, c4Globals) {
|
|
52
|
-
if (ast.isGlobalPredicateGroup(astRule)) {
|
|
53
|
-
const predicates = this.parseGlobalPredicateGroup(astRule);
|
|
54
|
-
if (hasAtLeast(predicates, 1)) {
|
|
55
|
-
c4Globals.predicates[id] = predicates;
|
|
56
|
-
}
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
if (ast.isGlobalDynamicPredicateGroup(astRule)) {
|
|
60
|
-
const predicates = this.parseGlobalDynamicPredicateGroup(astRule);
|
|
61
|
-
if (hasAtLeast(predicates, 1)) {
|
|
62
|
-
c4Globals.dynamicPredicates[id] = predicates;
|
|
63
|
-
}
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
nonexhaustive(astRule);
|
|
67
|
-
}
|
|
68
|
-
parseGlobalPredicateGroup(astRule) {
|
|
69
|
-
return astRule.predicates.map(p => this.parseViewRulePredicate(p));
|
|
70
|
-
}
|
|
71
|
-
parseGlobalDynamicPredicateGroup(astRule) {
|
|
72
|
-
return astRule.predicates.map(p => this.parseDynamicViewIncludePredicate(p));
|
|
73
|
-
}
|
|
74
|
-
parseGlobalStyleOrGroup(astRule) {
|
|
75
|
-
if (ast.isGlobalStyle(astRule)) {
|
|
76
|
-
return [this.parseViewRuleStyle(astRule)];
|
|
77
|
-
}
|
|
78
|
-
if (ast.isGlobalStyleGroup(astRule)) {
|
|
79
|
-
return astRule.styles.map(s => this.parseViewRuleStyle(s));
|
|
80
|
-
}
|
|
81
|
-
nonexhaustive(astRule);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { ast } from '../../ast';
|
|
2
|
-
import type { Base } from './Base';
|
|
3
|
-
export declare function ImportsParser<TBase extends Base>(B: TBase): {
|
|
4
|
-
new (...args: any[]): {
|
|
5
|
-
parseImports(): void;
|
|
6
|
-
isValid: import("../../validation").IsValidFn;
|
|
7
|
-
readonly services: import("../..").LikeC4Services;
|
|
8
|
-
readonly doc: import("../../ast").ParsedLikeC4LangiumDocument;
|
|
9
|
-
get project(): import("../../workspace").Project;
|
|
10
|
-
resolveFqn(node: ast.FqnReferenceable): import("@likec4/core").Fqn;
|
|
11
|
-
getAstNodePath(node: import("langium").AstNode): string;
|
|
12
|
-
getMetadata(metadataAstNode: ast.MetadataProperty | undefined): {
|
|
13
|
-
[key: string]: string | string[];
|
|
14
|
-
} | undefined;
|
|
15
|
-
parseMarkdownOrString(markdownOrString: ast.MarkdownOrString | undefined): import("@likec4/core").MarkdownOrString | undefined;
|
|
16
|
-
convertTags<E extends {
|
|
17
|
-
tags?: ast.Tags;
|
|
18
|
-
}>(withTags?: E | undefined): import("@likec4/core").NonEmptyArray<import("@likec4/core").Tag<string>> | null;
|
|
19
|
-
parseTags<E extends {
|
|
20
|
-
tags?: ast.Tags;
|
|
21
|
-
}>(withTags?: E): import("@likec4/core").NonEmptyArray<import("@likec4/core").Tag> | null;
|
|
22
|
-
convertLinks(source?: ast.LinkProperty["$container"]): import("@likec4/core").Link[] | undefined;
|
|
23
|
-
parseLinks(source?: ast.LinkProperty["$container"]): import("@likec4/core").Link[] | undefined;
|
|
24
|
-
parseIconProperty(prop: ast.IconProperty | undefined): import("@likec4/core").IconUrl | undefined;
|
|
25
|
-
parseImageAlias(value: string): string | undefined;
|
|
26
|
-
parseColorLiteral(astNode: ast.ColorLiteral): import("@likec4/core").ColorLiteral | undefined;
|
|
27
|
-
parseElementStyle(elementProps: Array<ast.ElementProperty> | ast.ElementStyleProperty | undefined): import("../../ast").ParsedElementStyle;
|
|
28
|
-
parseStyleProps(styleProps: Array<ast.StyleProperty> | undefined): import("../../ast").ParsedElementStyle;
|
|
29
|
-
parseBaseProps(props: {
|
|
30
|
-
title?: ast.MarkdownOrString | undefined;
|
|
31
|
-
summary?: ast.MarkdownOrString | undefined;
|
|
32
|
-
description?: ast.MarkdownOrString | undefined;
|
|
33
|
-
technology?: ast.MarkdownOrString | undefined;
|
|
34
|
-
}, override?: {
|
|
35
|
-
title?: string | undefined;
|
|
36
|
-
summary?: string | undefined;
|
|
37
|
-
description?: string | undefined;
|
|
38
|
-
technology?: string | undefined;
|
|
39
|
-
}): {
|
|
40
|
-
title?: string;
|
|
41
|
-
summary?: import("@likec4/core").MarkdownOrString;
|
|
42
|
-
description?: import("@likec4/core").MarkdownOrString;
|
|
43
|
-
technology?: string;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
} & TBase;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { nonNullable } from '@likec4/core';
|
|
2
|
-
import { loggable } from '@likec4/log';
|
|
3
|
-
import { serverLogger } from '../../logger';
|
|
4
|
-
const logger = serverLogger.getChild('ImportsParser');
|
|
5
|
-
export function ImportsParser(B) {
|
|
6
|
-
return class ImportsParser extends B {
|
|
7
|
-
parseImports() {
|
|
8
|
-
const imports = this.doc.parseResult.value.imports ?? [];
|
|
9
|
-
for (const importsFromPoject of imports) {
|
|
10
|
-
const project = importsFromPoject.project;
|
|
11
|
-
let imported = importsFromPoject.imports;
|
|
12
|
-
while (imported) {
|
|
13
|
-
try {
|
|
14
|
-
this.doc.c4Imports.set(project, this.resolveFqn(nonNullable(imported.imported.ref, `ElementRef is empty of imported: ${imported.imported.$refText}`)));
|
|
15
|
-
}
|
|
16
|
-
catch (e) {
|
|
17
|
-
logger.warn(loggable(e));
|
|
18
|
-
}
|
|
19
|
-
imported = imported.prev;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
}
|