@likec4/language-server 1.27.3 → 1.28.1
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/dist/LikeC4LanguageServices.js +6 -7
- package/dist/ast.d.ts +16 -9
- package/dist/ast.js +58 -79
- package/dist/bundled.mjs +2161 -2141
- package/dist/config/schema.d.ts +3 -3
- package/dist/config/schema.js +12 -5
- package/dist/documentation/documentation-provider.js +3 -1
- package/dist/formatting/LikeC4Formatter.d.ts +0 -2
- package/dist/formatting/LikeC4Formatter.js +24 -53
- package/dist/generated/ast.d.ts +128 -233
- package/dist/generated/ast.js +136 -308
- package/dist/generated/grammar.js +1 -1
- package/dist/lsp/CompletionProvider.d.ts +3 -0
- package/dist/lsp/CompletionProvider.js +128 -113
- package/dist/lsp/DocumentLinkProvider.js +6 -3
- package/dist/lsp/HoverProvider.js +3 -1
- package/dist/lsp/SemanticTokenProvider.js +33 -43
- package/dist/model/builder/MergedSpecification.d.ts +5 -3
- package/dist/model/builder/MergedSpecification.js +21 -7
- package/dist/model/builder/buildModel.d.ts +6 -1
- package/dist/model/builder/buildModel.js +20 -15
- package/dist/model/deployments-index.js +4 -2
- package/dist/model/fqn-index.d.ts +4 -2
- package/dist/model/fqn-index.js +28 -5
- package/dist/model/model-builder.d.ts +2 -2
- package/dist/model/model-builder.js +54 -16
- package/dist/model/model-locator.js +7 -4
- package/dist/model/model-parser.d.ts +215 -52
- package/dist/model/model-parser.js +6 -2
- package/dist/model/parser/Base.d.ts +11 -2
- package/dist/model/parser/Base.js +138 -3
- package/dist/model/parser/DeploymentModelParser.d.ts +19 -2
- package/dist/model/parser/DeploymentModelParser.js +19 -29
- package/dist/model/parser/DeploymentViewParser.d.ts +18 -2
- package/dist/model/parser/DeploymentViewParser.js +6 -24
- package/dist/model/parser/FqnRefParser.d.ts +18 -3
- package/dist/model/parser/FqnRefParser.js +264 -40
- package/dist/model/parser/GlobalsParser.d.ts +35 -18
- package/dist/model/parser/ImportsParser.d.ts +32 -0
- package/dist/model/parser/ImportsParser.js +26 -0
- package/dist/model/parser/ModelParser.d.ts +26 -2
- package/dist/model/parser/ModelParser.js +21 -41
- package/dist/model/parser/PredicatesParser.d.ts +35 -12
- package/dist/model/parser/PredicatesParser.js +20 -271
- package/dist/model/parser/SpecificationParser.d.ts +8 -0
- package/dist/model/parser/SpecificationParser.js +5 -9
- package/dist/model/parser/ViewsParser.d.ts +36 -19
- package/dist/model/parser/ViewsParser.js +16 -12
- package/dist/model-change/changeElementStyle.d.ts +2 -2
- package/dist/model-change/changeElementStyle.js +9 -6
- package/dist/references/name-provider.js +8 -2
- package/dist/references/scope-computation.d.ts +1 -1
- package/dist/references/scope-computation.js +33 -3
- package/dist/references/scope-provider.d.ts +7 -8
- package/dist/references/scope-provider.js +59 -41
- package/dist/shared/NodeKindProvider.js +4 -2
- package/dist/test/testServices.d.ts +2 -0
- package/dist/test/testServices.js +4 -1
- package/dist/utils/elementRef.d.ts +1 -1
- package/dist/utils/elementRef.js +6 -1
- package/dist/utils/fqnRef.d.ts +3 -0
- package/dist/utils/fqnRef.js +15 -4
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +9 -0
- package/dist/utils/projectId.d.ts +2 -1
- package/dist/utils/projectId.js +11 -1
- package/dist/validation/_shared.js +2 -2
- package/dist/validation/deployment-checks.js +24 -10
- package/dist/validation/element-ref.d.ts +4 -0
- package/dist/validation/element-ref.js +12 -0
- package/dist/validation/element.d.ts +1 -1
- package/dist/validation/element.js +1 -1
- package/dist/validation/imports.d.ts +5 -0
- package/dist/validation/imports.js +30 -0
- package/dist/validation/index.d.ts +1 -1
- package/dist/validation/index.js +47 -45
- package/dist/validation/relation.d.ts +2 -2
- package/dist/validation/relation.js +24 -27
- package/dist/validation/specification.d.ts +9 -9
- package/dist/validation/specification.js +9 -9
- package/dist/validation/view-predicates/{element-with.d.ts → fqn-expr-with.d.ts} +1 -1
- package/dist/validation/view-predicates/fqn-expr-with.js +42 -0
- package/dist/validation/view-predicates/fqn-ref-expr.d.ts +4 -0
- package/dist/validation/view-predicates/fqn-ref-expr.js +53 -0
- package/dist/validation/view-predicates/incoming.d.ts +1 -1
- package/dist/validation/view-predicates/incoming.js +2 -2
- package/dist/validation/view-predicates/index.d.ts +6 -6
- package/dist/validation/view-predicates/index.js +6 -6
- package/dist/validation/view-predicates/outgoing.d.ts +1 -1
- package/dist/validation/view-predicates/outgoing.js +8 -4
- package/dist/validation/view-predicates/{expanded-element.d.ts → relation-expr.d.ts} +1 -1
- package/dist/validation/view-predicates/relation-expr.js +39 -0
- package/dist/validation/view-predicates/relation-with.d.ts +1 -1
- package/dist/validation/view-predicates/relation-with.js +8 -5
- package/dist/views/likec4-views.d.ts +1 -0
- package/dist/views/likec4-views.js +23 -4
- package/dist/workspace/AstNodeDescriptionProvider.d.ts +1 -1
- package/dist/workspace/AstNodeDescriptionProvider.js +2 -3
- package/dist/workspace/IndexManager.d.ts +1 -1
- package/dist/workspace/IndexManager.js +5 -4
- package/dist/workspace/LangiumDocuments.d.ts +1 -1
- package/dist/workspace/LangiumDocuments.js +3 -5
- package/dist/workspace/ProjectsManager.d.ts +25 -7
- package/dist/workspace/ProjectsManager.js +76 -32
- package/dist/workspace/WorkspaceManager.d.ts +4 -5
- package/dist/workspace/WorkspaceManager.js +53 -20
- package/package.json +17 -13
- package/dist/validation/dynamic-view-rule.d.ts +0 -4
- package/dist/validation/dynamic-view-rule.js +0 -17
- package/dist/validation/view-predicates/element-with.js +0 -31
- package/dist/validation/view-predicates/expanded-element.js +0 -12
- package/dist/validation/view-predicates/expression-v2.d.ts +0 -5
- package/dist/validation/view-predicates/expression-v2.js +0 -83
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { nonexhaustive } from "@likec4/core";
|
|
2
|
-
import { AstUtils } from "langium";
|
|
3
|
-
import { ast } from "../../ast.js";
|
|
4
|
-
import { tryOrLog } from "../_shared.js";
|
|
5
|
-
export const elementPredicateWithChecks = (_services) => {
|
|
6
|
-
return tryOrLog((el, accept) => {
|
|
7
|
-
const container = AstUtils.getContainerOfType(el, ast.isViewRulePredicate);
|
|
8
|
-
if (ast.isExcludePredicate(container)) {
|
|
9
|
-
accept("error", 'Invalid usage inside "exclude"', {
|
|
10
|
-
node: el
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
const subject = ast.isElementPredicateWhere(el.subject) ? el.subject.subject : el.subject;
|
|
14
|
-
switch (true) {
|
|
15
|
-
case ast.isElementRef(subject):
|
|
16
|
-
case ast.isElementDescedantsExpression(subject):
|
|
17
|
-
case ast.isExpandElementExpression(subject):
|
|
18
|
-
case ast.isWildcardExpression(subject):
|
|
19
|
-
return;
|
|
20
|
-
case ast.isElementKindExpression(subject):
|
|
21
|
-
case ast.isElementTagExpression(subject):
|
|
22
|
-
accept("error", "Invalid target (expect reference to specific element)", {
|
|
23
|
-
node: el,
|
|
24
|
-
property: "subject"
|
|
25
|
-
});
|
|
26
|
-
return;
|
|
27
|
-
default:
|
|
28
|
-
nonexhaustive(subject);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { AstUtils } from "langium";
|
|
2
|
-
import { ast } from "../../ast.js";
|
|
3
|
-
import { tryOrLog } from "../_shared.js";
|
|
4
|
-
export const expandElementExprChecks = (_services) => {
|
|
5
|
-
return tryOrLog((el, accept) => {
|
|
6
|
-
if (AstUtils.hasContainerOfType(el, ast.isRelationExpression)) {
|
|
7
|
-
accept("warning", `Redundant usage, expand predicate resolves parent element only when used in relations`, {
|
|
8
|
-
node: el
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { type ValidationCheck } from 'langium';
|
|
2
|
-
import { ast } from '../../ast';
|
|
3
|
-
import type { LikeC4Services } from '../../module';
|
|
4
|
-
export declare const relationExprChecks: (services: LikeC4Services) => ValidationCheck<ast.RelationExpr>;
|
|
5
|
-
export declare const fqnRefExprChecks: (services: LikeC4Services) => ValidationCheck<ast.FqnRefExpr>;
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { FqnExpr, FqnRef } from "@likec4/core";
|
|
2
|
-
import { AstUtils } from "langium";
|
|
3
|
-
import { isNonNullish, isNullish } from "remeda";
|
|
4
|
-
import { ast } from "../../ast.js";
|
|
5
|
-
import { tryOrLog } from "../_shared.js";
|
|
6
|
-
export const relationExprChecks = (services) => {
|
|
7
|
-
const ModelParser = services.likec4.ModelParser;
|
|
8
|
-
return tryOrLog((node, accept) => {
|
|
9
|
-
if (node.$container.$type !== "DeploymentViewRulePredicateExpression") {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
const predicate = AstUtils.getContainerOfType(node, ast.isDeploymentViewRulePredicate);
|
|
13
|
-
if (!predicate || predicate.isInclude !== true) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
const doc = AstUtils.getDocument(node);
|
|
17
|
-
const parser = ModelParser.forDocument(doc);
|
|
18
|
-
const ModelRefOnlyExclude = "Model reference is allowed in exclude predicate only";
|
|
19
|
-
if (ast.isDirectedRelationExpr(node)) {
|
|
20
|
-
if (FqnExpr.isModelRef(parser.parseFqnExpr(node.source.from))) {
|
|
21
|
-
accept("error", ModelRefOnlyExclude, {
|
|
22
|
-
node: node.source,
|
|
23
|
-
property: "from"
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
if (FqnExpr.isModelRef(parser.parseFqnExpr(node.target))) {
|
|
27
|
-
accept("error", ModelRefOnlyExclude, {
|
|
28
|
-
node,
|
|
29
|
-
property: "target"
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
let expr;
|
|
35
|
-
if (ast.isIncomingRelationExpr(node)) {
|
|
36
|
-
expr = node.to;
|
|
37
|
-
} else if (ast.isOutgoingRelationExpr(node)) {
|
|
38
|
-
expr = node.from;
|
|
39
|
-
} else {
|
|
40
|
-
expr = node.inout.to;
|
|
41
|
-
}
|
|
42
|
-
if (FqnExpr.isModelRef(parser.parseFqnExpr(expr))) {
|
|
43
|
-
accept("error", ModelRefOnlyExclude, {
|
|
44
|
-
node
|
|
45
|
-
});
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
export const fqnRefExprChecks = (services) => {
|
|
51
|
-
const ModelParser = services.likec4.ModelParser;
|
|
52
|
-
return tryOrLog((node, accept) => {
|
|
53
|
-
const referenceTo = node.ref.value.ref;
|
|
54
|
-
if (isNullish(referenceTo)) {
|
|
55
|
-
accept("error", "Invalid empty reference", {
|
|
56
|
-
node
|
|
57
|
-
});
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
const doc = AstUtils.getDocument(node);
|
|
61
|
-
const expr = ModelParser.forDocument(doc).parseFqnRefExpr(node);
|
|
62
|
-
if (node.$container.$type === "DeploymentViewRulePredicateExpression") {
|
|
63
|
-
if (FqnExpr.isModelRef(expr)) {
|
|
64
|
-
accept("error", "Deployment view predicate must reference deployment model", {
|
|
65
|
-
node
|
|
66
|
-
});
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
if (FqnExpr.isDeploymentRef(expr) && FqnRef.isInsideInstanceRef(expr.ref)) {
|
|
70
|
-
accept("error", "Must reference deployment nodes or instances, but not internals", {
|
|
71
|
-
node
|
|
72
|
-
});
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if (!ast.isDeploymentNode(referenceTo) && isNonNullish(node.selector)) {
|
|
77
|
-
accept("warning", `Selector '${node.selector}' applies to deployment nodes only, ignored here`, {
|
|
78
|
-
node,
|
|
79
|
-
property: "selector"
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
};
|