@likec4/language-server 1.23.1 → 1.24.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/LikeC4FileSystem.d.ts +1 -0
- package/dist/LikeC4FileSystem.js +7 -0
- package/dist/Rpc.js +13 -11
- package/dist/ast.d.ts +13 -29
- package/dist/ast.js +3 -70
- package/dist/bundled.mjs +2441 -2610
- package/dist/generated/ast.d.ts +36 -8
- package/dist/generated/ast.js +44 -2
- package/dist/generated/grammar.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/likec4lib.d.ts +2 -0
- package/dist/likec4lib.js +3 -0
- package/dist/lsp/CodeLensProvider.js +10 -6
- package/dist/lsp/CompletionProvider.js +20 -2
- package/dist/lsp/DocumentLinkProvider.d.ts +3 -3
- package/dist/lsp/DocumentLinkProvider.js +5 -5
- package/dist/lsp/DocumentSymbolProvider.d.ts +1 -1
- package/dist/lsp/DocumentSymbolProvider.js +5 -2
- package/dist/lsp/HoverProvider.js +20 -7
- package/dist/lsp/SemanticTokenProvider.js +18 -1
- package/dist/model/builder/MergedExtends.d.ts +12 -0
- package/dist/model/builder/MergedExtends.js +67 -0
- package/dist/model/builder/MergedSpecification.d.ts +29 -0
- package/dist/model/builder/MergedSpecification.js +203 -0
- package/dist/model/builder/buildModel.d.ts +3 -0
- package/dist/model/builder/buildModel.js +194 -0
- package/dist/model/deployments-index.d.ts +5 -56
- package/dist/model/deployments-index.js +61 -137
- package/dist/model/fqn-index.d.ts +50 -19
- package/dist/model/fqn-index.js +176 -69
- package/dist/model/index.d.ts +0 -1
- package/dist/model/index.js +0 -1
- package/dist/model/model-builder.d.ts +10 -9
- package/dist/model/model-builder.js +102 -547
- package/dist/model/model-locator.d.ts +2 -1
- package/dist/model/model-locator.js +7 -9
- package/dist/model/model-parser.d.ts +156 -150
- package/dist/model/model-parser.js +68 -38
- package/dist/model/parser/Base.d.ts +3 -3
- package/dist/model/parser/Base.js +15 -9
- package/dist/model/parser/DeploymentModelParser.d.ts +4 -3
- package/dist/model/parser/DeploymentModelParser.js +54 -3
- package/dist/model/parser/DeploymentViewParser.d.ts +3 -2
- package/dist/model/parser/FqnRefParser.d.ts +2 -2
- package/dist/model/parser/GlobalsParser.d.ts +3 -2
- package/dist/model/parser/ModelParser.d.ts +4 -4
- package/dist/model/parser/ModelParser.js +45 -4
- package/dist/model/parser/PredicatesParser.d.ts +2 -2
- package/dist/model/parser/SpecificationParser.d.ts +2 -2
- package/dist/model/parser/ViewsParser.d.ts +3 -2
- package/dist/module.d.ts +2 -3
- package/dist/module.js +2 -3
- package/dist/references/scope-computation.d.ts +1 -1
- package/dist/references/scope-computation.js +14 -11
- package/dist/references/scope-provider.d.ts +16 -4
- package/dist/references/scope-provider.js +64 -30
- package/dist/test/testServices.d.ts +2 -1
- package/dist/test/testServices.js +23 -20
- package/dist/utils/elementRef.d.ts +1 -1
- package/dist/utils/elementRef.js +3 -3
- package/dist/validation/deployment-checks.d.ts +1 -0
- package/dist/validation/deployment-checks.js +12 -0
- package/dist/validation/index.d.ts +1 -1
- package/dist/validation/index.js +8 -1
- package/dist/views/configurable-layouter.js +3 -3
- package/dist/views/likec4-views.d.ts +1 -0
- package/dist/views/likec4-views.js +11 -11
- package/package.json +12 -13
- package/dist/bundled.d.ts +0 -8
- package/dist/bundled.js +0 -25
- package/dist/model/fqn-computation.d.ts +0 -3
- package/dist/model/fqn-computation.js +0 -72
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { AsFqn, LinkedList, nonexhaustive } from "@likec4/core";
|
|
2
|
-
import { AstUtils, CstUtils, GrammarUtils, MultiMap } from "langium";
|
|
3
|
-
import { isDefined, isEmpty } from "remeda";
|
|
4
|
-
import { ast, ElementOps } from "../ast.js";
|
|
5
|
-
import { logWarnError } from "../logger.js";
|
|
6
|
-
import { getFqnElementRef } from "../utils/elementRef.js";
|
|
7
|
-
const { findNodeForProperty } = GrammarUtils;
|
|
8
|
-
const { toDocumentSegment } = CstUtils;
|
|
9
|
-
const { getDocument } = AstUtils;
|
|
10
|
-
function toAstNodeDescription(locator, entry, doc) {
|
|
11
|
-
const $cstNode = findNodeForProperty(entry.$cstNode, "name");
|
|
12
|
-
return {
|
|
13
|
-
documentUri: doc.uri,
|
|
14
|
-
name: entry.name,
|
|
15
|
-
...entry.$cstNode && {
|
|
16
|
-
selectionSegment: toDocumentSegment(entry.$cstNode)
|
|
17
|
-
},
|
|
18
|
-
...$cstNode && {
|
|
19
|
-
nameSegment: toDocumentSegment($cstNode)
|
|
20
|
-
},
|
|
21
|
-
path: locator.getAstNodePath(entry),
|
|
22
|
-
type: ast.Element
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
export function computeDocumentFqn(document, services) {
|
|
26
|
-
const c4fqnIndex = document.c4fqnIndex = new MultiMap();
|
|
27
|
-
const elements = document.parseResult.value.models.flatMap((m) => m.elements);
|
|
28
|
-
if (elements.length === 0) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const locator = services.workspace.AstNodeLocator;
|
|
32
|
-
const traverseStack = LinkedList.from(elements.map((el) => [el, null]));
|
|
33
|
-
let pair;
|
|
34
|
-
while (pair = traverseStack.shift()) {
|
|
35
|
-
try {
|
|
36
|
-
const [el, parent] = pair;
|
|
37
|
-
if (ast.isRelation(el)) {
|
|
38
|
-
continue;
|
|
39
|
-
}
|
|
40
|
-
if (ast.isExtendElement(el)) {
|
|
41
|
-
if (isDefined(el.body) && !isEmpty(el.body.elements)) {
|
|
42
|
-
const fqn = getFqnElementRef(el.element);
|
|
43
|
-
for (const child of el.body.elements) {
|
|
44
|
-
if (!ast.isRelation(child)) {
|
|
45
|
-
traverseStack.push([child, fqn]);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
if (ast.isElement(el)) {
|
|
52
|
-
const fqn = AsFqn(el.name, parent);
|
|
53
|
-
c4fqnIndex.add(fqn, {
|
|
54
|
-
...toAstNodeDescription(locator, el, document),
|
|
55
|
-
fqn
|
|
56
|
-
});
|
|
57
|
-
ElementOps.writeId(el, fqn);
|
|
58
|
-
if (isDefined(el.body) && !isEmpty(el.body.elements)) {
|
|
59
|
-
for (const child of el.body.elements) {
|
|
60
|
-
if (!ast.isRelation(child)) {
|
|
61
|
-
traverseStack.push([child, fqn]);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
nonexhaustive(el);
|
|
68
|
-
} catch (e) {
|
|
69
|
-
logWarnError(e);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|