@likec4/language-server 1.9.0 → 1.10.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/contrib/likec4.tmLanguage.json +1 -1
- package/dist/browser.cjs +1 -1
- package/dist/browser.d.cts +3 -4
- package/dist/browser.d.mts +3 -4
- package/dist/browser.d.ts +3 -4
- package/dist/browser.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/model-graph/index.cjs +1 -1
- package/dist/model-graph/index.mjs +1 -1
- package/dist/node.cjs +1 -1
- package/dist/node.d.cts +3 -4
- package/dist/node.d.mts +3 -4
- package/dist/node.d.ts +3 -4
- package/dist/node.mjs +1 -1
- package/dist/shared/{language-server.Q-wtPShM.mjs → language-server.BFBeyvV8.mjs} +486 -108
- package/dist/shared/{language-server.86lmJ8ZN.d.cts → language-server.BGy3FJPJ.d.cts} +43 -14
- package/dist/shared/{language-server.B1TZgyoH.cjs → language-server.Bfc-5M8A.cjs} +482 -104
- package/dist/shared/{language-server.CCB4ESN5.mjs → language-server.CbqwHp7Q.mjs} +184 -120
- package/dist/shared/{language-server.RjhrBZS0.d.ts → language-server.CnVuAxDh.d.ts} +43 -14
- package/dist/shared/{language-server.CFTY6j4e.d.mts → language-server.DEK39RmI.d.mts} +43 -14
- package/dist/shared/{language-server.D0bOlrCi.cjs → language-server.DJhoJBWh.cjs} +180 -116
- package/package.json +13 -11
- package/src/ast.ts +8 -6
- package/src/formatting/LikeC4Formatter.ts +390 -0
- package/src/formatting/utils.ts +26 -0
- package/src/generated/ast.ts +203 -11
- package/src/generated/grammar.ts +2 -2
- package/src/generated/module.ts +1 -1
- package/src/like-c4.langium +34 -7
- package/src/lsp/CompletionProvider.ts +1 -1
- package/src/lsp/DocumentLinkProvider.ts +27 -15
- package/src/lsp/SemanticTokenProvider.ts +1 -1
- package/src/lsp/index.ts +1 -1
- package/src/model/fqn-index.ts +0 -1
- package/src/model/model-builder.ts +43 -32
- package/src/model/model-parser.ts +43 -21
- package/src/model-graph/compute-view/compute.ts +111 -80
- package/src/model-graph/compute-view/predicates.ts +3 -5
- package/src/model-graph/dynamic-view/compute.ts +96 -60
- package/src/model-graph/utils/buildElementNotations.ts +1 -1
- package/src/model-graph/utils/uniqueTags.test.ts +42 -0
- package/src/model-graph/utils/uniqueTags.ts +19 -0
- package/src/module.ts +6 -9
- package/src/test/testServices.ts +27 -7
- package/src/validation/index.ts +2 -1
- package/src/validation/property-checks.ts +13 -1
- package/src/validation/specification.ts +3 -3
- package/src/view-utils/resolve-relative-paths.ts +14 -17
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Expr, whereOperatorAsPredicate, parentFqn, nonexhaustive, isViewRuleStyle, compareByFqnHierarchically, DefaultThemeColor, DefaultElementShape, compareRelations, invariant, nonNullable, isAncestor, isViewRulePredicate, ancestorsFqn, isViewRuleAutoLayout, isScopedElementView, commonAncestor,
|
|
2
|
-
import { pipe, map, pick, mapToObj, isTruthy, isNullish, omitBy, isEmpty, filter, anyPass, isDefined, groupBy, prop, mapValues, piped, unique, entries, flatMap, sortBy, sort, difference, allPass, omit, hasAtLeast,
|
|
1
|
+
import { Expr, whereOperatorAsPredicate, parentFqn, nonexhaustive, isViewRuleStyle, compareByFqnHierarchically, DefaultThemeColor, DefaultElementShape, compareRelations, invariant, nonNullable, compareNatural, hasAtLeast, isAncestor, isViewRulePredicate, ancestorsFqn, isViewRuleAutoLayout, isScopedElementView, commonAncestor, StepEdgeId, isDynamicViewParallelSteps, isDynamicViewIncludeRule, DefaultRelationshipColor, DefaultLineStyle, DefaultArrowType, isSameHierarchy } from '@likec4/core';
|
|
2
|
+
import { pipe, map, pick, mapToObj, isTruthy, isNullish, omitBy, isEmpty, filter, anyPass, isDefined, groupBy, prop, mapValues, piped, unique, entries, flatMap, sortBy, sort, difference, allPass, omit, hasAtLeast as hasAtLeast$1, only, reduce, isNonNull, isString, isArray } from 'remeda';
|
|
3
3
|
import graphlib, { Graph } from '@dagrejs/graphlib';
|
|
4
4
|
import objectHash from 'object-hash';
|
|
5
5
|
|
|
@@ -288,8 +288,8 @@ function buildElementNotations(nodes) {
|
|
|
288
288
|
}))
|
|
289
289
|
),
|
|
290
290
|
sortBy(
|
|
291
|
-
prop("title"),
|
|
292
291
|
prop("shape"),
|
|
292
|
+
prop("title"),
|
|
293
293
|
[
|
|
294
294
|
(n) => n.kinds.length,
|
|
295
295
|
"desc"
|
|
@@ -366,6 +366,16 @@ function sortNodes({
|
|
|
366
366
|
return sorted;
|
|
367
367
|
}
|
|
368
368
|
|
|
369
|
+
function uniqueTags(elements) {
|
|
370
|
+
const tags = pipe(
|
|
371
|
+
elements,
|
|
372
|
+
flatMap((e) => e.tags ?? []),
|
|
373
|
+
unique(),
|
|
374
|
+
sort(compareNatural)
|
|
375
|
+
);
|
|
376
|
+
return hasAtLeast(tags, 1) ? tags : null;
|
|
377
|
+
}
|
|
378
|
+
|
|
369
379
|
const NoFilter = () => true;
|
|
370
380
|
const Identity = (x) => x;
|
|
371
381
|
const filterBy = (pred) => pred === NoFilter ? Identity : filter(pred);
|
|
@@ -614,13 +624,11 @@ const filterEdges = (edges, where) => {
|
|
|
614
624
|
);
|
|
615
625
|
};
|
|
616
626
|
const filterRelations = (edges, where) => {
|
|
617
|
-
if (!where) {
|
|
618
|
-
return edges.flatMap((e) => e.relations);
|
|
619
|
-
}
|
|
620
627
|
return pipe(
|
|
621
628
|
edges,
|
|
622
629
|
flatMap((e) => e.relations),
|
|
623
|
-
filter(where)
|
|
630
|
+
where ? filter(where) : Identity,
|
|
631
|
+
unique()
|
|
624
632
|
);
|
|
625
633
|
};
|
|
626
634
|
function includeIncomingExpr(expr, where) {
|
|
@@ -867,8 +875,8 @@ class ComputeCtx {
|
|
|
867
875
|
}
|
|
868
876
|
computeEdges() {
|
|
869
877
|
return this.ctxEdges.map((e) => {
|
|
870
|
-
invariant(hasAtLeast(e.relations, 1), "Edge must have at least one relation");
|
|
871
|
-
const relations = e.relations
|
|
878
|
+
invariant(hasAtLeast$1(e.relations, 1), "Edge must have at least one relation");
|
|
879
|
+
const relations = sort(e.relations, compareRelations);
|
|
872
880
|
const source = e.source.id;
|
|
873
881
|
const target = e.target.id;
|
|
874
882
|
const edge = {
|
|
@@ -880,50 +888,68 @@ class ComputeCtx {
|
|
|
880
888
|
relations: relations.map((r) => r.id)
|
|
881
889
|
};
|
|
882
890
|
let relation;
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
891
|
+
relation = only(relations) ?? pipe(
|
|
892
|
+
relations,
|
|
893
|
+
filter((r) => r.source === source && r.target === target),
|
|
894
|
+
only()
|
|
895
|
+
);
|
|
888
896
|
if (!relation) {
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
897
|
+
const allprops = pipe(
|
|
898
|
+
relations,
|
|
899
|
+
reduce((acc, r) => {
|
|
900
|
+
if (isTruthy(r.title) && !acc.title.includes(r.title)) {
|
|
901
|
+
acc.title.push(r.title);
|
|
902
|
+
}
|
|
903
|
+
if (isTruthy(r.description) && !acc.description.includes(r.description)) {
|
|
904
|
+
acc.description.push(r.description);
|
|
905
|
+
}
|
|
906
|
+
if (isTruthy(r.technology) && !acc.technology.includes(r.technology)) {
|
|
907
|
+
acc.technology.push(r.technology);
|
|
908
|
+
}
|
|
909
|
+
if (isTruthy(r.kind) && !acc.kind.includes(r.kind)) {
|
|
910
|
+
acc.kind.push(r.kind);
|
|
911
|
+
}
|
|
912
|
+
if (isTruthy(r.color) && !acc.color.includes(r.color)) {
|
|
913
|
+
acc.color.push(r.color);
|
|
914
|
+
}
|
|
915
|
+
if (isTruthy(r.line) && !acc.line.includes(r.line)) {
|
|
916
|
+
acc.line.push(r.line);
|
|
917
|
+
}
|
|
918
|
+
if (isTruthy(r.head) && !acc.head.includes(r.head)) {
|
|
919
|
+
acc.head.push(r.head);
|
|
920
|
+
}
|
|
921
|
+
if (isTruthy(r.tail) && !acc.tail.includes(r.tail)) {
|
|
922
|
+
acc.tail.push(r.tail);
|
|
923
|
+
}
|
|
924
|
+
if (isTruthy(r.navigateTo) && !acc.navigateTo.includes(r.navigateTo)) {
|
|
925
|
+
acc.navigateTo.push(r.navigateTo);
|
|
926
|
+
}
|
|
927
|
+
return acc;
|
|
928
|
+
}, {
|
|
929
|
+
title: [],
|
|
930
|
+
description: [],
|
|
931
|
+
technology: [],
|
|
932
|
+
kind: [],
|
|
933
|
+
head: [],
|
|
934
|
+
tail: [],
|
|
935
|
+
color: [],
|
|
936
|
+
line: [],
|
|
937
|
+
navigateTo: []
|
|
938
|
+
})
|
|
939
|
+
);
|
|
940
|
+
relation = {
|
|
941
|
+
title: only(allprops.title) ?? "[...]",
|
|
942
|
+
description: only(allprops.description),
|
|
943
|
+
technology: only(allprops.technology),
|
|
944
|
+
kind: only(allprops.kind),
|
|
945
|
+
head: only(allprops.head),
|
|
946
|
+
tail: only(allprops.tail),
|
|
947
|
+
color: only(allprops.color),
|
|
948
|
+
line: only(allprops.line),
|
|
949
|
+
navigateTo: only(allprops.navigateTo)
|
|
950
|
+
};
|
|
925
951
|
}
|
|
926
|
-
const tags =
|
|
952
|
+
const tags = uniqueTags(relations);
|
|
927
953
|
return Object.assign(
|
|
928
954
|
edge,
|
|
929
955
|
this.getEdgeLabel(relation),
|
|
@@ -934,7 +960,8 @@ class ComputeCtx {
|
|
|
934
960
|
relation.line && { line: relation.line },
|
|
935
961
|
relation.head && { head: relation.head },
|
|
936
962
|
relation.tail && { tail: relation.tail },
|
|
937
|
-
|
|
963
|
+
relation.navigateTo && { navigateTo: relation.navigateTo },
|
|
964
|
+
tags && { tags }
|
|
938
965
|
);
|
|
939
966
|
});
|
|
940
967
|
}
|
|
@@ -956,7 +983,7 @@ class ComputeCtx {
|
|
|
956
983
|
}
|
|
957
984
|
addEdges(edges) {
|
|
958
985
|
for (const e of edges) {
|
|
959
|
-
if (!hasAtLeast(e.relations, 1)) {
|
|
986
|
+
if (!hasAtLeast$1(e.relations, 1)) {
|
|
960
987
|
continue;
|
|
961
988
|
}
|
|
962
989
|
const existing = this.ctxEdges.find(
|
|
@@ -995,28 +1022,39 @@ class ComputeCtx {
|
|
|
995
1022
|
this.implicits.delete(el);
|
|
996
1023
|
}
|
|
997
1024
|
}
|
|
998
|
-
excludeImplicit(...excludes) {
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
}
|
|
1025
|
+
// protected excludeImplicit(...excludes: Element[]) {
|
|
1026
|
+
// for (const el of excludes) {
|
|
1027
|
+
// this.implicits.delete(el)
|
|
1028
|
+
// }
|
|
1029
|
+
// }
|
|
1003
1030
|
excludeRelation(...relations) {
|
|
1031
|
+
if (relations.length === 0) {
|
|
1032
|
+
return;
|
|
1033
|
+
}
|
|
1004
1034
|
const excludedImplicits = /* @__PURE__ */ new Set();
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1035
|
+
const ctxEdges = pipe(
|
|
1036
|
+
this.ctxEdges,
|
|
1037
|
+
map((edge) => {
|
|
1038
|
+
const edgerelations = edge.relations.filter((r) => !relations.includes(r));
|
|
1039
|
+
if (edgerelations.length === 0) {
|
|
1009
1040
|
excludedImplicits.add(edge.source);
|
|
1010
1041
|
excludedImplicits.add(edge.target);
|
|
1011
|
-
|
|
1012
|
-
continue;
|
|
1042
|
+
return null;
|
|
1013
1043
|
}
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1044
|
+
if (edgerelations.length !== edge.relations.length) {
|
|
1045
|
+
return {
|
|
1046
|
+
...edge,
|
|
1047
|
+
relations: edgerelations
|
|
1048
|
+
};
|
|
1049
|
+
}
|
|
1050
|
+
return edge;
|
|
1051
|
+
}),
|
|
1052
|
+
filter(isNonNull)
|
|
1053
|
+
);
|
|
1017
1054
|
if (excludedImplicits.size === 0) {
|
|
1018
1055
|
return;
|
|
1019
1056
|
}
|
|
1057
|
+
this.ctxEdges = ctxEdges;
|
|
1020
1058
|
const remaining = this.includedElements;
|
|
1021
1059
|
if (remaining.size === 0) {
|
|
1022
1060
|
this.implicits.clear();
|
|
@@ -1160,7 +1198,7 @@ class ComputeCtx {
|
|
|
1160
1198
|
if (isTruthy(relation.technology)) {
|
|
1161
1199
|
labelParts.push(`[${relation.technology}]`);
|
|
1162
1200
|
}
|
|
1163
|
-
return labelParts.length > 0
|
|
1201
|
+
return labelParts.length > 0 ? { label: labelParts.join("\n") } : {};
|
|
1164
1202
|
}
|
|
1165
1203
|
}
|
|
1166
1204
|
|
|
@@ -1193,6 +1231,38 @@ class DynamicViewComputeCtx {
|
|
|
1193
1231
|
static compute(view, graph) {
|
|
1194
1232
|
return new DynamicViewComputeCtx(view, graph).compute();
|
|
1195
1233
|
}
|
|
1234
|
+
addStep({
|
|
1235
|
+
source: stepSource,
|
|
1236
|
+
target: stepTarget,
|
|
1237
|
+
title: stepTitle,
|
|
1238
|
+
isBackward,
|
|
1239
|
+
navigateTo: stepNavigateTo,
|
|
1240
|
+
...step
|
|
1241
|
+
}, index, parent) {
|
|
1242
|
+
const id = parent ? StepEdgeId(parent, index) : StepEdgeId(index);
|
|
1243
|
+
const source = this.graph.element(stepSource);
|
|
1244
|
+
const target = this.graph.element(stepTarget);
|
|
1245
|
+
this.explicits.add(source);
|
|
1246
|
+
this.explicits.add(target);
|
|
1247
|
+
const {
|
|
1248
|
+
title,
|
|
1249
|
+
relations,
|
|
1250
|
+
tags,
|
|
1251
|
+
navigateTo: derivedNavigateTo
|
|
1252
|
+
} = this.findRelations(source, target);
|
|
1253
|
+
const navigateTo = isTruthy(stepNavigateTo) && stepNavigateTo !== this.view.id ? stepNavigateTo : derivedNavigateTo;
|
|
1254
|
+
this.steps.push({
|
|
1255
|
+
id,
|
|
1256
|
+
...step,
|
|
1257
|
+
source,
|
|
1258
|
+
target,
|
|
1259
|
+
title: stepTitle ?? title,
|
|
1260
|
+
relations: relations ?? [],
|
|
1261
|
+
isBackward: isBackward ?? false,
|
|
1262
|
+
...navigateTo ? { navigateTo } : {},
|
|
1263
|
+
...tags ? { tags } : {}
|
|
1264
|
+
});
|
|
1265
|
+
}
|
|
1196
1266
|
compute() {
|
|
1197
1267
|
const {
|
|
1198
1268
|
docUri: _docUri,
|
|
@@ -1201,27 +1271,21 @@ class DynamicViewComputeCtx {
|
|
|
1201
1271
|
steps: viewSteps,
|
|
1202
1272
|
...view
|
|
1203
1273
|
} = this.view;
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
target,
|
|
1220
|
-
title: isTruthy(stepTitle) ? stepTitle : title,
|
|
1221
|
-
relations: relations ?? [],
|
|
1222
|
-
isBackward: isBackward ?? false,
|
|
1223
|
-
...tags ? { tags } : {}
|
|
1224
|
-
});
|
|
1274
|
+
let stepNum = 1;
|
|
1275
|
+
for (const step of viewSteps) {
|
|
1276
|
+
if (isDynamicViewParallelSteps(step)) {
|
|
1277
|
+
if (step.__parallel.length === 0) {
|
|
1278
|
+
continue;
|
|
1279
|
+
}
|
|
1280
|
+
if (step.__parallel.length === 1) {
|
|
1281
|
+
this.addStep(step.__parallel[0], stepNum);
|
|
1282
|
+
} else {
|
|
1283
|
+
step.__parallel.forEach((s, i) => this.addStep(s, i + 1, stepNum));
|
|
1284
|
+
}
|
|
1285
|
+
} else {
|
|
1286
|
+
this.addStep(step, stepNum);
|
|
1287
|
+
}
|
|
1288
|
+
stepNum++;
|
|
1225
1289
|
}
|
|
1226
1290
|
for (const rule of rules) {
|
|
1227
1291
|
if (isDynamicViewIncludeRule(rule)) {
|
|
@@ -1233,12 +1297,10 @@ class DynamicViewComputeCtx {
|
|
|
1233
1297
|
}
|
|
1234
1298
|
const elements = [...this.explicits];
|
|
1235
1299
|
const nodesMap = buildComputeNodes(elements);
|
|
1236
|
-
const edges = this.steps.map(({ source, target, relations, title, isBackward, ...step }
|
|
1300
|
+
const edges = this.steps.map(({ source, target, relations, title, isBackward, ...step }) => {
|
|
1237
1301
|
const sourceNode = nonNullable(nodesMap.get(source.id), `Source node ${source.id} not found`);
|
|
1238
1302
|
const targetNode = nonNullable(nodesMap.get(target.id), `Target node ${target.id} not found`);
|
|
1239
|
-
const stepNum = index + 1;
|
|
1240
1303
|
const edge = {
|
|
1241
|
-
id: StepEdgeId(stepNum),
|
|
1242
1304
|
parent: commonAncestor(source.id, target.id),
|
|
1243
1305
|
source: source.id,
|
|
1244
1306
|
target: target.id,
|
|
@@ -1295,41 +1357,43 @@ class DynamicViewComputeCtx {
|
|
|
1295
1357
|
}
|
|
1296
1358
|
findRelations(source, target) {
|
|
1297
1359
|
const relationships = unique(this.graph.edgesBetween(source, target).flatMap((e) => e.relations));
|
|
1298
|
-
const alltags = unique(relationships.flatMap((r) => r.tags ?? []));
|
|
1299
|
-
const tags = hasAtLeast(alltags, 1) ? alltags : null;
|
|
1300
|
-
const relations = hasAtLeast(relationships, 1) ? map(relationships, (r) => r.id) : null;
|
|
1301
1360
|
if (relationships.length === 0) {
|
|
1302
1361
|
return {
|
|
1303
1362
|
title: null,
|
|
1304
|
-
tags,
|
|
1305
|
-
relations
|
|
1306
|
-
|
|
1307
|
-
}
|
|
1308
|
-
let relation;
|
|
1309
|
-
if (relationships.length === 1) {
|
|
1310
|
-
relation = relationships[0];
|
|
1311
|
-
} else {
|
|
1312
|
-
relation = relationships.find((r) => r.source === source.id && r.target === target.id);
|
|
1313
|
-
}
|
|
1314
|
-
if (relation && isTruthy(relation.title)) {
|
|
1315
|
-
return {
|
|
1316
|
-
title: relation.title,
|
|
1317
|
-
tags,
|
|
1318
|
-
relations
|
|
1319
|
-
};
|
|
1320
|
-
}
|
|
1321
|
-
const labels = unique(relationships.flatMap((r) => isTruthy(r.title) ? r.title : []));
|
|
1322
|
-
if (labels.length === 1) {
|
|
1323
|
-
return {
|
|
1324
|
-
title: labels[0],
|
|
1325
|
-
tags,
|
|
1326
|
-
relations
|
|
1363
|
+
tags: null,
|
|
1364
|
+
relations: null,
|
|
1365
|
+
navigateTo: null
|
|
1327
1366
|
};
|
|
1328
1367
|
}
|
|
1368
|
+
const alltags = pipe(
|
|
1369
|
+
relationships,
|
|
1370
|
+
flatMap((r) => r.tags),
|
|
1371
|
+
filter(isTruthy),
|
|
1372
|
+
unique()
|
|
1373
|
+
);
|
|
1374
|
+
const tags = hasAtLeast$1(alltags, 1) ? alltags : null;
|
|
1375
|
+
const relations = hasAtLeast$1(relationships, 1) ? map(relationships, (r) => r.id) : null;
|
|
1376
|
+
const relation = only(relationships) || relationships.find((r) => r.source === source.id && r.target === target.id);
|
|
1377
|
+
const title = isTruthy(relation?.title) ? relation.title : pipe(
|
|
1378
|
+
relationships,
|
|
1379
|
+
map((r) => r.title),
|
|
1380
|
+
filter(isTruthy),
|
|
1381
|
+
unique(),
|
|
1382
|
+
only()
|
|
1383
|
+
);
|
|
1384
|
+
const navigateTo = !!relation?.navigateTo && relation.navigateTo !== this.view.id ? relation.navigateTo : pipe(
|
|
1385
|
+
relationships,
|
|
1386
|
+
map((r) => r.navigateTo),
|
|
1387
|
+
filter(isTruthy),
|
|
1388
|
+
filter((v) => v !== this.view.id),
|
|
1389
|
+
unique(),
|
|
1390
|
+
only()
|
|
1391
|
+
);
|
|
1329
1392
|
return {
|
|
1330
|
-
title: null,
|
|
1393
|
+
title: title ?? null,
|
|
1331
1394
|
tags,
|
|
1332
|
-
relations
|
|
1395
|
+
relations,
|
|
1396
|
+
navigateTo: navigateTo ?? null
|
|
1333
1397
|
};
|
|
1334
1398
|
}
|
|
1335
1399
|
}
|
|
@@ -3,13 +3,13 @@ import { Fqn, ViewID } from '@likec4/core';
|
|
|
3
3
|
import { AstNode, Reference, LangiumDocument, MultiMap, AstNodeDescription, DiagnosticInfo, ReferenceDescription, MaybePromise, DefaultScopeComputation, PrecomputedScopes, DefaultScopeProvider, ReferenceInfo, Scope, Disposable, DefaultWorkspaceManager, WorkspaceCache, Module, LangiumDocuments, Stream, Cancellation, URI as URI$1 } from 'langium';
|
|
4
4
|
import { SetRequired, ValueOf, ConditionalPick } from 'type-fest';
|
|
5
5
|
import { Diagnostic, DocumentSymbol, SymbolKind, Hover, Location, Range, TextEdit, CompletionItemKind } from 'vscode-languageserver-types';
|
|
6
|
-
import { CodeLensProvider, DefaultCompletionProvider, DefaultDocumentHighlightProvider, DocumentLinkProvider, DocumentSymbolProvider, NodeKindProvider as NodeKindProvider$1, AstNodeHoverProvider,
|
|
6
|
+
import { CodeLensProvider, DefaultCompletionProvider, DefaultDocumentHighlightProvider, DocumentLinkProvider, DocumentSymbolProvider, NodeKindProvider as NodeKindProvider$1, AstNodeHoverProvider, AbstractSemanticTokenProvider, SemanticTokenAcceptor, LangiumSharedServices, DefaultWorkspaceSymbolProvider, LangiumServices, PartialLangiumServices, DefaultSharedModuleContext } from 'langium/lsp';
|
|
7
7
|
import { CodeLensParams, CancellationToken, CodeLens, DocumentHighlight, DocumentLinkParams, DocumentLink, WorkspaceFolder } from 'vscode-languageserver';
|
|
8
8
|
import { ChangeViewRequestParams } from '../protocol.js';
|
|
9
9
|
import { URI } from 'vscode-uri';
|
|
10
10
|
|
|
11
11
|
/******************************************************************************
|
|
12
|
-
* This file was generated by langium-cli 3.
|
|
12
|
+
* This file was generated by langium-cli 3.2.0.
|
|
13
13
|
* DO NOT EDIT MANUALLY!
|
|
14
14
|
******************************************************************************/
|
|
15
15
|
|
|
@@ -48,12 +48,12 @@ type RelationPredicate = RelationPredicateOrWhere | RelationPredicateWith;
|
|
|
48
48
|
declare const RelationPredicate = "RelationPredicate";
|
|
49
49
|
type RelationPredicateOrWhere = RelationExpression | RelationPredicateWhere;
|
|
50
50
|
declare const RelationPredicateOrWhere = "RelationPredicateOrWhere";
|
|
51
|
-
type RelationProperty = LinkProperty | MetadataProperty | RelationStringProperty | RelationStyleProperty;
|
|
51
|
+
type RelationProperty = LinkProperty | MetadataProperty | RelationNavigateToProperty | RelationStringProperty | RelationStyleProperty;
|
|
52
52
|
declare const RelationProperty = "RelationProperty";
|
|
53
53
|
declare function isRelationProperty(item: unknown): item is RelationProperty;
|
|
54
54
|
type RelationshipStyleProperty = ArrowProperty | ColorProperty | LineProperty;
|
|
55
55
|
declare const RelationshipStyleProperty = "RelationshipStyleProperty";
|
|
56
|
-
type StringProperty = ElementStringProperty | MetadataAttribute | NotationProperty | RelationStringProperty | SpecificationElementStringProperty | SpecificationRelationshipStringProperty | ViewStringProperty;
|
|
56
|
+
type StringProperty = ElementStringProperty | MetadataAttribute | NotationProperty | NotesProperty | RelationStringProperty | SpecificationElementStringProperty | SpecificationRelationshipStringProperty | ViewStringProperty;
|
|
57
57
|
declare const StringProperty = "StringProperty";
|
|
58
58
|
type StyleProperty = BorderProperty | ColorProperty | IconProperty | OpacityProperty | ShapeProperty;
|
|
59
59
|
declare const StyleProperty = "StyleProperty";
|
|
@@ -120,7 +120,7 @@ declare const CustomElementProperties = "CustomElementProperties";
|
|
|
120
120
|
interface CustomRelationProperties extends AstNode {
|
|
121
121
|
readonly $container: DynamicViewStep | RelationPredicateWith;
|
|
122
122
|
readonly $type: 'CustomRelationProperties';
|
|
123
|
-
props: Array<NotationProperty | RelationStringProperty | RelationshipStyleProperty>;
|
|
123
|
+
props: Array<NotationProperty | NotesProperty | RelationNavigateToProperty | RelationStringProperty | RelationshipStyleProperty>;
|
|
124
124
|
}
|
|
125
125
|
declare const CustomRelationProperties = "CustomRelationProperties";
|
|
126
126
|
interface DirectedRelationExpression extends AstNode {
|
|
@@ -142,7 +142,7 @@ interface DynamicViewBody extends AstNode {
|
|
|
142
142
|
readonly $type: 'DynamicViewBody';
|
|
143
143
|
props: Array<ViewProperty>;
|
|
144
144
|
rules: Array<DynamicViewRule>;
|
|
145
|
-
steps: Array<DynamicViewStep>;
|
|
145
|
+
steps: Array<DynamicViewParallelSteps | DynamicViewStep>;
|
|
146
146
|
tags?: Tags;
|
|
147
147
|
}
|
|
148
148
|
declare const DynamicViewBody = "DynamicViewBody";
|
|
@@ -153,6 +153,13 @@ interface DynamicViewIncludePredicate extends AstNode {
|
|
|
153
153
|
predicates: DynamicViewPredicateIterator;
|
|
154
154
|
}
|
|
155
155
|
declare const DynamicViewIncludePredicate = "DynamicViewIncludePredicate";
|
|
156
|
+
interface DynamicViewParallelSteps extends AstNode {
|
|
157
|
+
readonly $container: DynamicViewBody;
|
|
158
|
+
readonly $type: 'DynamicViewParallelSteps';
|
|
159
|
+
steps: Array<DynamicViewStep>;
|
|
160
|
+
}
|
|
161
|
+
declare const DynamicViewParallelSteps = "DynamicViewParallelSteps";
|
|
162
|
+
declare function isDynamicViewParallelSteps(item: unknown): item is DynamicViewParallelSteps;
|
|
156
163
|
interface DynamicViewPredicateIterator extends AstNode {
|
|
157
164
|
readonly $container: DynamicViewIncludePredicate | DynamicViewPredicateIterator;
|
|
158
165
|
readonly $type: 'DynamicViewPredicateIterator';
|
|
@@ -161,8 +168,14 @@ interface DynamicViewPredicateIterator extends AstNode {
|
|
|
161
168
|
}
|
|
162
169
|
declare const DynamicViewPredicateIterator = "DynamicViewPredicateIterator";
|
|
163
170
|
declare function isDynamicViewPredicateIterator(item: unknown): item is DynamicViewPredicateIterator;
|
|
171
|
+
interface DynamicViewRef extends AstNode {
|
|
172
|
+
readonly $container: RelationNavigateToProperty;
|
|
173
|
+
readonly $type: 'DynamicViewRef';
|
|
174
|
+
view: Reference<DynamicView>;
|
|
175
|
+
}
|
|
176
|
+
declare const DynamicViewRef = "DynamicViewRef";
|
|
164
177
|
interface DynamicViewStep extends AstNode {
|
|
165
|
-
readonly $container: DynamicViewBody;
|
|
178
|
+
readonly $container: DynamicViewBody | DynamicViewParallelSteps;
|
|
166
179
|
readonly $type: 'DynamicViewStep';
|
|
167
180
|
custom?: CustomRelationProperties;
|
|
168
181
|
isBackward: boolean;
|
|
@@ -423,6 +436,13 @@ interface NotationProperty extends AstNode {
|
|
|
423
436
|
value: string;
|
|
424
437
|
}
|
|
425
438
|
declare const NotationProperty = "NotationProperty";
|
|
439
|
+
interface NotesProperty extends AstNode {
|
|
440
|
+
readonly $container: CustomRelationProperties;
|
|
441
|
+
readonly $type: 'NotesProperty';
|
|
442
|
+
key: 'notes';
|
|
443
|
+
value: string;
|
|
444
|
+
}
|
|
445
|
+
declare const NotesProperty = "NotesProperty";
|
|
426
446
|
interface OpacityProperty extends AstNode {
|
|
427
447
|
readonly $container: CustomElementProperties | ElementStyleProperty | ViewRuleStyle;
|
|
428
448
|
readonly $type: 'OpacityProperty';
|
|
@@ -466,6 +486,13 @@ interface RelationBody extends AstNode {
|
|
|
466
486
|
}
|
|
467
487
|
declare const RelationBody = "RelationBody";
|
|
468
488
|
declare function isRelationBody(item: unknown): item is RelationBody;
|
|
489
|
+
interface RelationNavigateToProperty extends AstNode {
|
|
490
|
+
readonly $container: CustomRelationProperties | RelationBody;
|
|
491
|
+
readonly $type: 'RelationNavigateToProperty';
|
|
492
|
+
key: 'navigateTo';
|
|
493
|
+
value: DynamicViewRef;
|
|
494
|
+
}
|
|
495
|
+
declare const RelationNavigateToProperty = "RelationNavigateToProperty";
|
|
469
496
|
interface RelationPredicateWhere extends AstNode {
|
|
470
497
|
readonly $container: Predicates | RelationPredicateWith;
|
|
471
498
|
readonly $type: 'RelationPredicateWhere';
|
|
@@ -673,7 +700,9 @@ type LikeC4AstType = {
|
|
|
673
700
|
DynamicView: DynamicView;
|
|
674
701
|
DynamicViewBody: DynamicViewBody;
|
|
675
702
|
DynamicViewIncludePredicate: DynamicViewIncludePredicate;
|
|
703
|
+
DynamicViewParallelSteps: DynamicViewParallelSteps;
|
|
676
704
|
DynamicViewPredicateIterator: DynamicViewPredicateIterator;
|
|
705
|
+
DynamicViewRef: DynamicViewRef;
|
|
677
706
|
DynamicViewRule: DynamicViewRule;
|
|
678
707
|
DynamicViewStep: DynamicViewStep;
|
|
679
708
|
Element: Element;
|
|
@@ -717,6 +746,7 @@ type LikeC4AstType = {
|
|
|
717
746
|
ModelViews: ModelViews;
|
|
718
747
|
NavigateToProperty: NavigateToProperty;
|
|
719
748
|
NotationProperty: NotationProperty;
|
|
749
|
+
NotesProperty: NotesProperty;
|
|
720
750
|
OpacityProperty: OpacityProperty;
|
|
721
751
|
OutgoingRelationExpression: OutgoingRelationExpression;
|
|
722
752
|
Predicate: Predicate;
|
|
@@ -724,6 +754,7 @@ type LikeC4AstType = {
|
|
|
724
754
|
Relation: Relation;
|
|
725
755
|
RelationBody: RelationBody;
|
|
726
756
|
RelationExpression: RelationExpression;
|
|
757
|
+
RelationNavigateToProperty: RelationNavigateToProperty;
|
|
727
758
|
RelationPredicate: RelationPredicate;
|
|
728
759
|
RelationPredicateOrWhere: RelationPredicateOrWhere;
|
|
729
760
|
RelationPredicateWhere: RelationPredicateWhere;
|
|
@@ -836,6 +867,7 @@ interface ParsedAstRelation {
|
|
|
836
867
|
head?: c4.RelationshipArrowType;
|
|
837
868
|
tail?: c4.RelationshipArrowType;
|
|
838
869
|
links?: c4.NonEmptyArray<ParsedLink>;
|
|
870
|
+
navigateTo?: c4.ViewID;
|
|
839
871
|
metadata?: {
|
|
840
872
|
[key: string]: string;
|
|
841
873
|
};
|
|
@@ -861,7 +893,7 @@ interface ParsedAstDynamicView {
|
|
|
861
893
|
description: string | null;
|
|
862
894
|
tags: c4.NonEmptyArray<c4.Tag> | null;
|
|
863
895
|
links: c4.NonEmptyArray<ParsedLink> | null;
|
|
864
|
-
steps: c4.
|
|
896
|
+
steps: c4.DynamicViewStepOrParallel[];
|
|
865
897
|
rules: Array<c4.DynamicViewRule>;
|
|
866
898
|
manualLayout?: c4.ViewManualLayout;
|
|
867
899
|
}
|
|
@@ -891,7 +923,7 @@ interface ParsedLikeC4LangiumDocument extends Omit<LangiumDocument<LikeC4Grammar
|
|
|
891
923
|
}
|
|
892
924
|
type Guard<N extends AstNode> = (n: AstNode) => n is N;
|
|
893
925
|
type Guarded<G> = G extends Guard<infer N> ? N : never;
|
|
894
|
-
declare const isValidatableAstNode: (n: AstNode) => n is Guarded<typeof isRelation | typeof isExtendElement | typeof isElement | typeof isLikeC4View | typeof isDynamicViewPredicateIterator | typeof isElementPredicateWith | typeof isRelationPredicateWith | typeof isElementExpression | typeof isRelationExpression | typeof isDynamicViewStep | typeof isViewProperty | typeof isStyleProperty | typeof isTags | typeof isViewRule | typeof isDynamicViewRule | typeof isElementViewBody | typeof isDynamicViewBody | typeof isRelationProperty | typeof isRelationBody | typeof isElementProperty | typeof isElementBody | typeof isExtendElementBody | typeof isSpecificationElementKind | typeof isSpecificationRelationshipKind | typeof isSpecificationTag | typeof isSpecificationColor | typeof isSpecificationRule | typeof isModelViews | typeof isModel>;
|
|
926
|
+
declare const isValidatableAstNode: (n: AstNode) => n is Guarded<typeof isRelation | typeof isExtendElement | typeof isElement | typeof isLikeC4View | typeof isDynamicViewPredicateIterator | typeof isElementPredicateWith | typeof isRelationPredicateWith | typeof isElementExpression | typeof isRelationExpression | typeof isDynamicViewParallelSteps | typeof isDynamicViewStep | typeof isViewProperty | typeof isStyleProperty | typeof isTags | typeof isViewRule | typeof isDynamicViewRule | typeof isElementViewBody | typeof isDynamicViewBody | typeof isRelationProperty | typeof isRelationBody | typeof isElementProperty | typeof isElementBody | typeof isExtendElementBody | typeof isSpecificationElementKind | typeof isSpecificationRelationshipKind | typeof isSpecificationTag | typeof isSpecificationColor | typeof isSpecificationRule | typeof isModelViews | typeof isModel>;
|
|
895
927
|
type ValidatableAstNode = Guarded<typeof isValidatableAstNode>;
|
|
896
928
|
declare function checksFromDiagnostics(doc: LikeC4LangiumDocument): {
|
|
897
929
|
isValid: (n: ValidatableAstNode) => boolean;
|
|
@@ -923,6 +955,7 @@ declare class LikeC4DocumentLinkProvider implements DocumentLinkProvider {
|
|
|
923
955
|
constructor(services: LikeC4Services);
|
|
924
956
|
getDocumentLinks(doc: LangiumDocument, _params: DocumentLinkParams): MaybePromise<DocumentLink[]>;
|
|
925
957
|
resolveLink(doc: LangiumDocument, link: string): string;
|
|
958
|
+
relativeLink(doc: LangiumDocument, link: string): string | null;
|
|
926
959
|
}
|
|
927
960
|
|
|
928
961
|
declare class LikeC4DocumentSymbolProvider implements DocumentSymbolProvider {
|
|
@@ -950,10 +983,6 @@ declare class LikeC4HoverProvider extends AstNodeHoverProvider {
|
|
|
950
983
|
protected getAstNodeHoverContent(node: AstNode): MaybePromise<Hover | undefined>;
|
|
951
984
|
}
|
|
952
985
|
|
|
953
|
-
declare class LikeC4RenameProvider extends DefaultRenameProvider {
|
|
954
|
-
constructor(services: LikeC4Services);
|
|
955
|
-
}
|
|
956
|
-
|
|
957
986
|
declare class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider {
|
|
958
987
|
protected highlightElement(node: AstNode, acceptor: SemanticTokenAcceptor): void | undefined | 'prune';
|
|
959
988
|
private highlightAstElement;
|
|
@@ -1061,7 +1090,6 @@ interface LikeC4AddedServices {
|
|
|
1061
1090
|
ModelChanges: LikeC4ModelChanges;
|
|
1062
1091
|
};
|
|
1063
1092
|
lsp: {
|
|
1064
|
-
RenameProvider: LikeC4RenameProvider;
|
|
1065
1093
|
CompletionProvider: LikeC4CompletionProvider;
|
|
1066
1094
|
DocumentHighlightProvider: LikeC4DocumentHighlightProvider;
|
|
1067
1095
|
DocumentSymbolProvider: LikeC4DocumentSymbolProvider;
|
|
@@ -1181,6 +1209,7 @@ declare class LikeC4ModelParser {
|
|
|
1181
1209
|
private parseRelationExpr;
|
|
1182
1210
|
private parseViewRule;
|
|
1183
1211
|
private parseViewManualLaout;
|
|
1212
|
+
private parseDynamicParallelSteps;
|
|
1184
1213
|
private parseDynamicStep;
|
|
1185
1214
|
private parseElementView;
|
|
1186
1215
|
private parseDynamicElementView;
|