@likec4/language-server 1.16.0 → 1.17.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/browser.cjs +1 -1
- package/dist/browser.d.cts +2 -2
- package/dist/browser.d.mts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.mjs +2 -2
- package/dist/index.cjs +35 -5
- package/dist/index.d.cts +17 -4
- package/dist/index.d.mts +17 -4
- package/dist/index.d.ts +17 -4
- package/dist/index.mjs +34 -5
- package/dist/model-graph/index.cjs +1 -1
- package/dist/model-graph/index.mjs +1 -1
- package/dist/shared/{language-server.D_13fWJQ.mjs → language-server.BIbAD1T-.mjs} +43 -16
- package/dist/shared/{language-server.CnkCWVtf.d.cts → language-server.BQRvVmE0.d.cts} +3 -38
- package/dist/shared/{language-server.7iILaJYc.d.ts → language-server.BysPcTxr.d.ts} +3 -38
- package/dist/shared/{language-server.Bd3NZ8uH.cjs → language-server.D2QdbOJO.cjs} +54 -14
- package/dist/shared/{language-server.C5gxpVUH.mjs → language-server.DGrBGmsd.mjs} +55 -15
- package/dist/shared/{language-server.Dym6GL4P.cjs → language-server.DKV_FdPN.cjs} +43 -16
- package/dist/shared/{language-server.DIaiY0-C.d.mts → language-server._wkyPgso.d.mts} +3 -38
- package/package.json +16 -16
- package/src/LikeC4FileSystem.ts +36 -0
- package/src/Rpc.ts +2 -2
- package/src/formatting/LikeC4Formatter.ts +9 -4
- package/src/generated/ast.ts +2 -2
- package/src/generated/grammar.ts +2 -2
- package/src/generated/module.ts +3 -2
- package/src/index.ts +3 -3
- package/src/like-c4.langium +1 -1
- package/src/lsp/SemanticTokenProvider.ts +26 -8
- package/src/model/fqn-computation.ts +6 -2
- package/src/model-graph/compute-view/__test__/fixture.ts +6 -0
- package/src/model-graph/compute-view/compute.ts +9 -2
- package/src/model-graph/dynamic-view/compute.ts +55 -16
- package/src/model-graph/utils/applyCustomElementProperties.ts +1 -3
- package/dist/shared/language-server.CmBZHwSl.d.cts +0 -1338
- package/dist/shared/language-server.DViE1Zxi.d.mts +0 -1338
- package/dist/shared/language-server.DwyQ1FtY.d.ts +0 -1338
|
@@ -1048,7 +1048,13 @@ class ComputeCtx {
|
|
|
1048
1048
|
...autoLayoutRule?.nodeSep && { nodeSep: autoLayoutRule.nodeSep },
|
|
1049
1049
|
...autoLayoutRule?.rankSep && { rankSep: autoLayoutRule.rankSep }
|
|
1050
1050
|
},
|
|
1051
|
-
nodes: remeda.map(nodes,
|
|
1051
|
+
nodes: remeda.map(nodes, (n) => {
|
|
1052
|
+
delete n.notation;
|
|
1053
|
+
if (n.icon === "none") {
|
|
1054
|
+
delete n.icon;
|
|
1055
|
+
}
|
|
1056
|
+
return n;
|
|
1057
|
+
}),
|
|
1052
1058
|
edges: applyCustomRelationProperties(rules, nodes, sortedEdges),
|
|
1053
1059
|
...elementNotations.length > 0 && {
|
|
1054
1060
|
notation: {
|
|
@@ -1514,7 +1520,12 @@ class DynamicViewComputeCtx {
|
|
|
1514
1520
|
title,
|
|
1515
1521
|
relations,
|
|
1516
1522
|
tags,
|
|
1517
|
-
navigateTo: derivedNavigateTo
|
|
1523
|
+
navigateTo: derivedNavigateTo,
|
|
1524
|
+
head,
|
|
1525
|
+
tail,
|
|
1526
|
+
color,
|
|
1527
|
+
line,
|
|
1528
|
+
notation
|
|
1518
1529
|
} = this.findRelations(source, target);
|
|
1519
1530
|
const navigateTo = remeda.isTruthy(stepNavigateTo) && stepNavigateTo !== this.view.id ? stepNavigateTo : derivedNavigateTo;
|
|
1520
1531
|
this.steps.push({
|
|
@@ -1526,7 +1537,12 @@ class DynamicViewComputeCtx {
|
|
|
1526
1537
|
relations: relations ?? [],
|
|
1527
1538
|
isBackward: isBackward ?? false,
|
|
1528
1539
|
...navigateTo ? { navigateTo } : {},
|
|
1529
|
-
...tags ? { tags } : {}
|
|
1540
|
+
...tags ? { tags } : {},
|
|
1541
|
+
...head ? { head } : {},
|
|
1542
|
+
...tail ? { tail } : {},
|
|
1543
|
+
...color ? { color } : {},
|
|
1544
|
+
...line ? { line } : {},
|
|
1545
|
+
...notation ? { notation } : {}
|
|
1530
1546
|
});
|
|
1531
1547
|
}
|
|
1532
1548
|
compute() {
|
|
@@ -1618,7 +1634,13 @@ class DynamicViewComputeCtx {
|
|
|
1618
1634
|
...autoLayoutRule?.nodeSep && { nodeSep: autoLayoutRule.nodeSep },
|
|
1619
1635
|
...autoLayoutRule?.rankSep && { rankSep: autoLayoutRule.rankSep }
|
|
1620
1636
|
},
|
|
1621
|
-
nodes: remeda.map(nodes,
|
|
1637
|
+
nodes: remeda.map(nodes, (n) => {
|
|
1638
|
+
delete n.notation;
|
|
1639
|
+
if (n.icon === "none") {
|
|
1640
|
+
delete n.icon;
|
|
1641
|
+
}
|
|
1642
|
+
return n;
|
|
1643
|
+
}),
|
|
1622
1644
|
edges,
|
|
1623
1645
|
...elementNotations.length > 0 && {
|
|
1624
1646
|
notation: {
|
|
@@ -1634,7 +1656,12 @@ class DynamicViewComputeCtx {
|
|
|
1634
1656
|
title: null,
|
|
1635
1657
|
tags: null,
|
|
1636
1658
|
relations: null,
|
|
1637
|
-
navigateTo: null
|
|
1659
|
+
navigateTo: null,
|
|
1660
|
+
tail: null,
|
|
1661
|
+
head: null,
|
|
1662
|
+
color: null,
|
|
1663
|
+
line: null,
|
|
1664
|
+
notation: null
|
|
1638
1665
|
};
|
|
1639
1666
|
}
|
|
1640
1667
|
const alltags = remeda.pipe(
|
|
@@ -1646,13 +1673,6 @@ class DynamicViewComputeCtx {
|
|
|
1646
1673
|
const tags = remeda.hasAtLeast(alltags, 1) ? alltags : null;
|
|
1647
1674
|
const relations = remeda.hasAtLeast(relationships, 1) ? remeda.map(relationships, (r) => r.id) : null;
|
|
1648
1675
|
const relation = remeda.only(relationships) || relationships.find((r) => r.source === source.id && r.target === target.id);
|
|
1649
|
-
const title = remeda.isTruthy(relation?.title) ? relation.title : remeda.pipe(
|
|
1650
|
-
relationships,
|
|
1651
|
-
remeda.map((r) => r.title),
|
|
1652
|
-
remeda.filter(remeda.isTruthy),
|
|
1653
|
-
remeda.unique(),
|
|
1654
|
-
remeda.only()
|
|
1655
|
-
);
|
|
1656
1676
|
const navigateTo = !!relation?.navigateTo && relation.navigateTo !== this.view.id ? relation.navigateTo : remeda.pipe(
|
|
1657
1677
|
relationships,
|
|
1658
1678
|
remeda.map((r) => r.navigateTo),
|
|
@@ -1661,11 +1681,31 @@ class DynamicViewComputeCtx {
|
|
|
1661
1681
|
remeda.unique(),
|
|
1662
1682
|
remeda.only()
|
|
1663
1683
|
);
|
|
1684
|
+
const commonProperties = relationships.reduce((acc, r) => {
|
|
1685
|
+
remeda.isTruthy(r.title) && acc.title.push(r.title);
|
|
1686
|
+
remeda.isTruthy(r.tail) && acc.tail.push(r.tail);
|
|
1687
|
+
remeda.isTruthy(r.head) && acc.head.push(r.head);
|
|
1688
|
+
remeda.isTruthy(r.color) && acc.color.push(r.color);
|
|
1689
|
+
remeda.isTruthy(r.line) && acc.line.push(r.line);
|
|
1690
|
+
return acc;
|
|
1691
|
+
}, {
|
|
1692
|
+
title: [],
|
|
1693
|
+
tail: [],
|
|
1694
|
+
head: [],
|
|
1695
|
+
color: [],
|
|
1696
|
+
line: [],
|
|
1697
|
+
notation: []
|
|
1698
|
+
});
|
|
1664
1699
|
return {
|
|
1665
|
-
title: title ?? null,
|
|
1666
1700
|
tags,
|
|
1667
1701
|
relations,
|
|
1668
|
-
navigateTo: navigateTo ?? null
|
|
1702
|
+
navigateTo: navigateTo ?? null,
|
|
1703
|
+
title: remeda.pipe(commonProperties.title, remeda.unique(), remeda.only()) ?? null,
|
|
1704
|
+
tail: remeda.pipe(commonProperties.tail, remeda.unique(), remeda.only()) ?? null,
|
|
1705
|
+
head: remeda.pipe(commonProperties.head, remeda.unique(), remeda.only()) ?? null,
|
|
1706
|
+
color: remeda.pipe(commonProperties.color, remeda.unique(), remeda.only()) ?? null,
|
|
1707
|
+
line: remeda.pipe(commonProperties.line, remeda.unique(), remeda.only()) ?? null,
|
|
1708
|
+
notation: remeda.pipe(commonProperties.notation, remeda.unique(), remeda.only()) ?? null
|
|
1669
1709
|
};
|
|
1670
1710
|
}
|
|
1671
1711
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isViewRuleGlobalPredicateRef, isViewRuleGlobalStyle, Expr, whereOperatorAsPredicate, parentFqn, nonexhaustive, ComputedNode, isViewRuleGroup, isViewRulePredicate, isViewRuleStyle, nonNullable, ElementKind, compareByFqnHierarchically, DefaultThemeColor, DefaultElementShape, compareRelations, invariant, compareNatural, hasAtLeast, isAncestor, isScopedElementView, isViewRuleAutoLayout, commonAncestor, commonHead, StepEdgeId, isDynamicViewParallelSteps, isDynamicViewIncludeRule, DefaultRelationshipColor, DefaultLineStyle, DefaultArrowType, ancestorsFqn, isSameHierarchy } from '@likec4/core';
|
|
2
|
-
import { isNullish, pipe, map, pick, mapToObj, isTruthy, omitBy, isEmpty, filter, isNot, anyPass, forEach, isDefined, groupBy, prop, mapValues, piped, unique, entries, flatMap, sortBy, sort, tap, difference, allPass, concat,
|
|
2
|
+
import { isNullish, pipe, map, pick, mapToObj, isTruthy, omitBy, isEmpty, filter, isNot, anyPass, forEach, isDefined, groupBy, prop, mapValues, piped, unique, entries, flatMap, sortBy, sort, tap, difference, allPass, concat, hasAtLeast as hasAtLeast$1, only, reduce, last, reverse, isNonNull, first, isString, isArray } from 'remeda';
|
|
3
3
|
import dagre from '@dagrejs/dagre';
|
|
4
4
|
import { logger } from '@likec4/log';
|
|
5
5
|
import objectHash from 'object-hash';
|
|
@@ -1041,7 +1041,13 @@ class ComputeCtx {
|
|
|
1041
1041
|
...autoLayoutRule?.nodeSep && { nodeSep: autoLayoutRule.nodeSep },
|
|
1042
1042
|
...autoLayoutRule?.rankSep && { rankSep: autoLayoutRule.rankSep }
|
|
1043
1043
|
},
|
|
1044
|
-
nodes: map(nodes,
|
|
1044
|
+
nodes: map(nodes, (n) => {
|
|
1045
|
+
delete n.notation;
|
|
1046
|
+
if (n.icon === "none") {
|
|
1047
|
+
delete n.icon;
|
|
1048
|
+
}
|
|
1049
|
+
return n;
|
|
1050
|
+
}),
|
|
1045
1051
|
edges: applyCustomRelationProperties(rules, nodes, sortedEdges),
|
|
1046
1052
|
...elementNotations.length > 0 && {
|
|
1047
1053
|
notation: {
|
|
@@ -1507,7 +1513,12 @@ class DynamicViewComputeCtx {
|
|
|
1507
1513
|
title,
|
|
1508
1514
|
relations,
|
|
1509
1515
|
tags,
|
|
1510
|
-
navigateTo: derivedNavigateTo
|
|
1516
|
+
navigateTo: derivedNavigateTo,
|
|
1517
|
+
head,
|
|
1518
|
+
tail,
|
|
1519
|
+
color,
|
|
1520
|
+
line,
|
|
1521
|
+
notation
|
|
1511
1522
|
} = this.findRelations(source, target);
|
|
1512
1523
|
const navigateTo = isTruthy(stepNavigateTo) && stepNavigateTo !== this.view.id ? stepNavigateTo : derivedNavigateTo;
|
|
1513
1524
|
this.steps.push({
|
|
@@ -1519,7 +1530,12 @@ class DynamicViewComputeCtx {
|
|
|
1519
1530
|
relations: relations ?? [],
|
|
1520
1531
|
isBackward: isBackward ?? false,
|
|
1521
1532
|
...navigateTo ? { navigateTo } : {},
|
|
1522
|
-
...tags ? { tags } : {}
|
|
1533
|
+
...tags ? { tags } : {},
|
|
1534
|
+
...head ? { head } : {},
|
|
1535
|
+
...tail ? { tail } : {},
|
|
1536
|
+
...color ? { color } : {},
|
|
1537
|
+
...line ? { line } : {},
|
|
1538
|
+
...notation ? { notation } : {}
|
|
1523
1539
|
});
|
|
1524
1540
|
}
|
|
1525
1541
|
compute() {
|
|
@@ -1611,7 +1627,13 @@ class DynamicViewComputeCtx {
|
|
|
1611
1627
|
...autoLayoutRule?.nodeSep && { nodeSep: autoLayoutRule.nodeSep },
|
|
1612
1628
|
...autoLayoutRule?.rankSep && { rankSep: autoLayoutRule.rankSep }
|
|
1613
1629
|
},
|
|
1614
|
-
nodes: map(nodes,
|
|
1630
|
+
nodes: map(nodes, (n) => {
|
|
1631
|
+
delete n.notation;
|
|
1632
|
+
if (n.icon === "none") {
|
|
1633
|
+
delete n.icon;
|
|
1634
|
+
}
|
|
1635
|
+
return n;
|
|
1636
|
+
}),
|
|
1615
1637
|
edges,
|
|
1616
1638
|
...elementNotations.length > 0 && {
|
|
1617
1639
|
notation: {
|
|
@@ -1627,7 +1649,12 @@ class DynamicViewComputeCtx {
|
|
|
1627
1649
|
title: null,
|
|
1628
1650
|
tags: null,
|
|
1629
1651
|
relations: null,
|
|
1630
|
-
navigateTo: null
|
|
1652
|
+
navigateTo: null,
|
|
1653
|
+
tail: null,
|
|
1654
|
+
head: null,
|
|
1655
|
+
color: null,
|
|
1656
|
+
line: null,
|
|
1657
|
+
notation: null
|
|
1631
1658
|
};
|
|
1632
1659
|
}
|
|
1633
1660
|
const alltags = pipe(
|
|
@@ -1639,13 +1666,6 @@ class DynamicViewComputeCtx {
|
|
|
1639
1666
|
const tags = hasAtLeast$1(alltags, 1) ? alltags : null;
|
|
1640
1667
|
const relations = hasAtLeast$1(relationships, 1) ? map(relationships, (r) => r.id) : null;
|
|
1641
1668
|
const relation = only(relationships) || relationships.find((r) => r.source === source.id && r.target === target.id);
|
|
1642
|
-
const title = isTruthy(relation?.title) ? relation.title : pipe(
|
|
1643
|
-
relationships,
|
|
1644
|
-
map((r) => r.title),
|
|
1645
|
-
filter(isTruthy),
|
|
1646
|
-
unique(),
|
|
1647
|
-
only()
|
|
1648
|
-
);
|
|
1649
1669
|
const navigateTo = !!relation?.navigateTo && relation.navigateTo !== this.view.id ? relation.navigateTo : pipe(
|
|
1650
1670
|
relationships,
|
|
1651
1671
|
map((r) => r.navigateTo),
|
|
@@ -1654,11 +1674,31 @@ class DynamicViewComputeCtx {
|
|
|
1654
1674
|
unique(),
|
|
1655
1675
|
only()
|
|
1656
1676
|
);
|
|
1677
|
+
const commonProperties = relationships.reduce((acc, r) => {
|
|
1678
|
+
isTruthy(r.title) && acc.title.push(r.title);
|
|
1679
|
+
isTruthy(r.tail) && acc.tail.push(r.tail);
|
|
1680
|
+
isTruthy(r.head) && acc.head.push(r.head);
|
|
1681
|
+
isTruthy(r.color) && acc.color.push(r.color);
|
|
1682
|
+
isTruthy(r.line) && acc.line.push(r.line);
|
|
1683
|
+
return acc;
|
|
1684
|
+
}, {
|
|
1685
|
+
title: [],
|
|
1686
|
+
tail: [],
|
|
1687
|
+
head: [],
|
|
1688
|
+
color: [],
|
|
1689
|
+
line: [],
|
|
1690
|
+
notation: []
|
|
1691
|
+
});
|
|
1657
1692
|
return {
|
|
1658
|
-
title: title ?? null,
|
|
1659
1693
|
tags,
|
|
1660
1694
|
relations,
|
|
1661
|
-
navigateTo: navigateTo ?? null
|
|
1695
|
+
navigateTo: navigateTo ?? null,
|
|
1696
|
+
title: pipe(commonProperties.title, unique(), only()) ?? null,
|
|
1697
|
+
tail: pipe(commonProperties.tail, unique(), only()) ?? null,
|
|
1698
|
+
head: pipe(commonProperties.head, unique(), only()) ?? null,
|
|
1699
|
+
color: pipe(commonProperties.color, unique(), only()) ?? null,
|
|
1700
|
+
line: pipe(commonProperties.line, unique(), only()) ?? null,
|
|
1701
|
+
notation: pipe(commonProperties.notation, unique(), only()) ?? null
|
|
1662
1702
|
};
|
|
1663
1703
|
}
|
|
1664
1704
|
}
|