@likec4/language-server 1.10.1 → 1.11.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/dist/browser.cjs +5 -1
- package/dist/browser.d.cts +7 -5
- package/dist/browser.d.mts +7 -5
- package/dist/browser.d.ts +7 -5
- package/dist/browser.mjs +3 -2
- package/dist/index.cjs +15 -2
- package/dist/index.d.cts +14 -11
- package/dist/index.d.mts +14 -11
- package/dist/index.d.ts +14 -11
- package/dist/index.mjs +17 -1
- package/dist/likec4lib.cjs +949 -952
- package/dist/likec4lib.d.cts +1 -1
- package/dist/likec4lib.d.mts +1 -1
- package/dist/likec4lib.d.ts +1 -1
- package/dist/likec4lib.mjs +949 -952
- package/dist/protocol.cjs +1 -1
- package/dist/protocol.d.cts +3 -1
- package/dist/protocol.d.mts +3 -1
- package/dist/protocol.d.ts +3 -1
- package/dist/protocol.mjs +1 -1
- package/dist/shared/{language-server.Bfc-5M8A.cjs → language-server.C8lV6gDw.cjs} +116 -115
- package/dist/shared/{language-server.BFBeyvV8.mjs → language-server.CCOotWDz.mjs} +116 -116
- package/dist/shared/{language-server.CnVuAxDh.d.ts → language-server.Cyw-bCtc.d.ts} +143 -136
- package/dist/shared/{language-server.DEK39RmI.d.mts → language-server.DGjTE7xL.d.mts} +143 -136
- package/dist/shared/{language-server.BGy3FJPJ.d.cts → language-server.Ol32Kygo.d.cts} +143 -136
- package/package.json +30 -26
- package/src/Rpc.ts +10 -6
- package/src/ast.ts +1 -1
- package/src/browser.ts +5 -0
- package/src/generated-lib/icons.ts +949 -952
- package/src/index.ts +23 -2
- package/src/likec4lib.ts +1 -1
- package/src/logger.ts +16 -16
- package/src/model/model-builder.ts +12 -12
- package/src/model-graph/utils/applyCustomRelationProperties.ts +1 -1
- package/src/protocol.ts +5 -1
- package/src/shared/WorkspaceManager.ts +1 -1
- package/dist/node.cjs +0 -18
- package/dist/node.d.cts +0 -19
- package/dist/node.d.mts +0 -19
- package/dist/node.d.ts +0 -19
- package/dist/node.mjs +0 -16
- package/src/node.ts +0 -20
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AbstractAstReflection, loadGrammarFromJson, DocumentState, AstUtils, GrammarUtils, MultiMap, CstUtils, stream, StreamImpl, DONE_RESULT, interruptAndCheck, Disposable, DefaultScopeComputation, DefaultScopeProvider, EMPTY_STREAM, StreamScope, MapScope, EMPTY_SCOPE, URI, UriUtils, isAstNode, DefaultWorkspaceManager, WorkspaceCache, inject, EmptyFileSystem } from 'langium';
|
|
2
2
|
import { DefaultCompletionProvider, DefaultDocumentHighlightProvider, AstNodeHoverProvider, AbstractSemanticTokenProvider, DefaultWorkspaceSymbolProvider, Formatting, AbstractFormatter, createDefaultModule, createDefaultSharedModule } from 'langium/lsp';
|
|
3
3
|
import { rootLogger, LogLevels, logger as logger$1 } from '@likec4/log';
|
|
4
|
+
import { isError, isNullish, isDefined, clamp, isTruthy, pipe, map, filter, isEmpty, find, values, first, last, unique, hasAtLeast, mapToObj, groupBy, forEach, prop, mapValues, flatMap, reduce, sort, reverse, indexBy, isNumber, isNonNullish, findLast, entries, debounce } from 'remeda';
|
|
4
5
|
import { nonexhaustive, DefaultRelationshipColor, DefaultLineStyle, DefaultArrowType, AsFqn, parentFqn, nameFromFqn, isComputedElementView, isExtendsElementView, invariant, compareNatural, isElementView as isElementView$1, isScopedElementView, computeColorValues, sortByFqnHierarchically, compareRelations, isOrOperator, isNonEmptyArray, isAndOperator, isAncestor, hasAtLeast as hasAtLeast$1, isSameHierarchy } from '@likec4/core';
|
|
5
|
-
import { isNullish, isDefined, clamp, isTruthy, pipe, map, filter, isEmpty, find, values, first, last, unique, hasAtLeast, mapToObj, groupBy, forEach, prop, mapValues, flatMap, reduce, sort, reverse, indexBy, isNumber, isNonNullish, findLast, entries, debounce } from 'remeda';
|
|
6
6
|
import { DiagnosticSeverity, SymbolKind, SemanticTokenTypes, SemanticTokenModifiers, TextEdit, CompletionItemKind } from 'vscode-languageserver-types';
|
|
7
7
|
import indentString from 'indent-string';
|
|
8
8
|
import { decode, encode } from '@msgpack/msgpack';
|
|
@@ -18,95 +18,6 @@ import { hasProtocol, hasLeadingSlash, isRelative, withoutLeadingSlash, withoutB
|
|
|
18
18
|
import { Graph } from '@dagrejs/graphlib';
|
|
19
19
|
import { DocumentHighlight, DocumentHighlightKind } from 'vscode-languageserver';
|
|
20
20
|
|
|
21
|
-
const logger = rootLogger.withTag("lsp");
|
|
22
|
-
function logError(err) {
|
|
23
|
-
logger.error(err);
|
|
24
|
-
}
|
|
25
|
-
function logWarnError(err) {
|
|
26
|
-
if (err instanceof Error) {
|
|
27
|
-
logger.warn(err.stack ?? err.message);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
logger.warn(err);
|
|
31
|
-
}
|
|
32
|
-
function setLogLevel(level) {
|
|
33
|
-
logger.level = LogLevels[level];
|
|
34
|
-
}
|
|
35
|
-
function logErrorToTelemetry(connection) {
|
|
36
|
-
const reporter = {
|
|
37
|
-
log: ({ level, ...logObj }, ctx) => {
|
|
38
|
-
if (level !== LogLevels.error && level !== LogLevels.fatal) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const tag = logObj.tag || "";
|
|
42
|
-
const parts = logObj.args.map((arg) => {
|
|
43
|
-
if (arg && typeof arg.stack === "string") {
|
|
44
|
-
return arg.message + "\n" + arg.stack;
|
|
45
|
-
}
|
|
46
|
-
if (typeof arg === "string") {
|
|
47
|
-
return arg;
|
|
48
|
-
}
|
|
49
|
-
return String(arg);
|
|
50
|
-
});
|
|
51
|
-
if (tag) {
|
|
52
|
-
parts.unshift(`[${tag}]`);
|
|
53
|
-
}
|
|
54
|
-
const message = parts.join(" ");
|
|
55
|
-
connection.telemetry.logEvent({ eventName: "error", error: message });
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
rootLogger.addReporter(reporter);
|
|
59
|
-
logger.setReporters(rootLogger.options.reporters);
|
|
60
|
-
}
|
|
61
|
-
function logToLspConnection(connection) {
|
|
62
|
-
const reporter = {
|
|
63
|
-
log: ({ level, ...logObj }, ctx) => {
|
|
64
|
-
const tag = logObj.tag || "";
|
|
65
|
-
const parts = logObj.args.map((arg) => {
|
|
66
|
-
if (arg && typeof arg.stack === "string") {
|
|
67
|
-
return arg.message + "\n" + arg.stack;
|
|
68
|
-
}
|
|
69
|
-
if (typeof arg === "string") {
|
|
70
|
-
return arg;
|
|
71
|
-
}
|
|
72
|
-
return String(arg);
|
|
73
|
-
});
|
|
74
|
-
if (tag) {
|
|
75
|
-
parts.unshift(`[${tag}]`);
|
|
76
|
-
}
|
|
77
|
-
const message = parts.join(" ");
|
|
78
|
-
switch (true) {
|
|
79
|
-
case level >= LogLevels.trace: {
|
|
80
|
-
connection.tracer.log(message);
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
case level >= LogLevels.debug: {
|
|
84
|
-
connection.console.debug(message);
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
87
|
-
case level >= LogLevels.info: {
|
|
88
|
-
connection.console.info(message);
|
|
89
|
-
break;
|
|
90
|
-
}
|
|
91
|
-
case level >= LogLevels.log: {
|
|
92
|
-
connection.console.log(message);
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
case level >= LogLevels.warn: {
|
|
96
|
-
connection.console.warn(message);
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
case level >= LogLevels.fatal: {
|
|
100
|
-
connection.console.error(message);
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
rootLogger.addReporter(reporter);
|
|
107
|
-
logger.setReporters(rootLogger.options.reporters);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
21
|
const DynamicViewRule = "DynamicViewRule";
|
|
111
22
|
function isDynamicViewRule(item) {
|
|
112
23
|
return reflection.isInstance(item, DynamicViewRule);
|
|
@@ -1488,6 +1399,94 @@ const LikeC4GeneratedModule = {
|
|
|
1488
1399
|
}
|
|
1489
1400
|
};
|
|
1490
1401
|
|
|
1402
|
+
const logger = rootLogger.withTag("lsp");
|
|
1403
|
+
function logError(err) {
|
|
1404
|
+
logger.error(err);
|
|
1405
|
+
}
|
|
1406
|
+
function logWarnError(err) {
|
|
1407
|
+
if (err instanceof Error) {
|
|
1408
|
+
logger.warn(err.stack ?? err.message);
|
|
1409
|
+
return;
|
|
1410
|
+
}
|
|
1411
|
+
logger.warn(err);
|
|
1412
|
+
}
|
|
1413
|
+
function setLogLevel(level) {
|
|
1414
|
+
logger.level = LogLevels[level];
|
|
1415
|
+
}
|
|
1416
|
+
function logErrorToTelemetry(connection) {
|
|
1417
|
+
const reporter = {
|
|
1418
|
+
log: ({ level, ...logObj }, ctx) => {
|
|
1419
|
+
if (level !== LogLevels.error && level !== LogLevels.fatal) {
|
|
1420
|
+
return;
|
|
1421
|
+
}
|
|
1422
|
+
const tag = logObj.tag || "";
|
|
1423
|
+
const parts = logObj.args.map((arg) => {
|
|
1424
|
+
if (isError(arg)) {
|
|
1425
|
+
return arg.stack ?? arg.message;
|
|
1426
|
+
}
|
|
1427
|
+
if (typeof arg === "string") {
|
|
1428
|
+
return arg;
|
|
1429
|
+
}
|
|
1430
|
+
return "" + arg;
|
|
1431
|
+
});
|
|
1432
|
+
if (tag) {
|
|
1433
|
+
parts.unshift(`[${tag}]`);
|
|
1434
|
+
}
|
|
1435
|
+
const message = parts.join(" ");
|
|
1436
|
+
connection.telemetry.logEvent({ eventName: "error", error: message });
|
|
1437
|
+
}
|
|
1438
|
+
};
|
|
1439
|
+
rootLogger.addReporter(reporter);
|
|
1440
|
+
logger.setReporters(rootLogger.options.reporters);
|
|
1441
|
+
}
|
|
1442
|
+
function logToLspConnection(connection) {
|
|
1443
|
+
const reporter = {
|
|
1444
|
+
log: ({ level, ...logObj }, ctx) => {
|
|
1445
|
+
const tag = logObj.tag || "";
|
|
1446
|
+
const parts = logObj.args.map((arg) => {
|
|
1447
|
+
if (isError(arg)) {
|
|
1448
|
+
return arg.stack ?? arg.message;
|
|
1449
|
+
}
|
|
1450
|
+
if (typeof arg === "string") {
|
|
1451
|
+
return arg;
|
|
1452
|
+
}
|
|
1453
|
+
return "" + arg;
|
|
1454
|
+
});
|
|
1455
|
+
if (tag) {
|
|
1456
|
+
parts.unshift(`[${tag}]`);
|
|
1457
|
+
}
|
|
1458
|
+
const message = parts.join(" ");
|
|
1459
|
+
switch (true) {
|
|
1460
|
+
case level >= LogLevels.debug: {
|
|
1461
|
+
connection.console.debug(message);
|
|
1462
|
+
break;
|
|
1463
|
+
}
|
|
1464
|
+
// case level >= LogLevels.info: {
|
|
1465
|
+
// connection.console.info(message)
|
|
1466
|
+
// break
|
|
1467
|
+
// }
|
|
1468
|
+
case level >= LogLevels.log: {
|
|
1469
|
+
connection.console.info(message);
|
|
1470
|
+
break;
|
|
1471
|
+
}
|
|
1472
|
+
case level >= LogLevels.warn: {
|
|
1473
|
+
connection.console.warn(message);
|
|
1474
|
+
break;
|
|
1475
|
+
}
|
|
1476
|
+
case level >= LogLevels.fatal: {
|
|
1477
|
+
connection.console.error(message);
|
|
1478
|
+
break;
|
|
1479
|
+
}
|
|
1480
|
+
default: {
|
|
1481
|
+
connection.console.log(message);
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
};
|
|
1486
|
+
rootLogger.setReporters([reporter]);
|
|
1487
|
+
logger.setReporters(rootLogger.options.reporters);
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1491
1490
|
function elementRef(node) {
|
|
1492
1491
|
return node.el.ref;
|
|
1493
1492
|
}
|
|
@@ -1609,7 +1608,7 @@ function checksFromDiagnostics(doc) {
|
|
|
1609
1608
|
};
|
|
1610
1609
|
}
|
|
1611
1610
|
function* streamModel(doc, isValid) {
|
|
1612
|
-
const traverseStack = doc.parseResult.value.models.flatMap((m) =>
|
|
1611
|
+
const traverseStack = doc.parseResult.value.models.flatMap((m) => m.elements);
|
|
1613
1612
|
const relations = [];
|
|
1614
1613
|
let el;
|
|
1615
1614
|
while (el = traverseStack.shift()) {
|
|
@@ -2540,8 +2539,6 @@ class FqnIndex {
|
|
|
2540
2539
|
}
|
|
2541
2540
|
}
|
|
2542
2541
|
|
|
2543
|
-
const printDocs = (docs) => docs.map((d) => " - " + d.uri.toString(true)).join("\n");
|
|
2544
|
-
|
|
2545
2542
|
function assignNavigateTo(views) {
|
|
2546
2543
|
const allElementViews = /* @__PURE__ */ new Map();
|
|
2547
2544
|
for (const v of views) {
|
|
@@ -2935,8 +2932,7 @@ class LikeC4ModelBuilder {
|
|
|
2935
2932
|
async (docs, _cancelToken) => {
|
|
2936
2933
|
let parsed = [];
|
|
2937
2934
|
try {
|
|
2938
|
-
logger.debug(`[ModelBuilder] onValidated (${docs.length} docs)
|
|
2939
|
-
${printDocs(docs)}`);
|
|
2935
|
+
logger.debug(`[ModelBuilder] onValidated (${docs.length} docs)`);
|
|
2940
2936
|
for (const doc of parser.parse(docs)) {
|
|
2941
2937
|
parsed.push(doc.uri);
|
|
2942
2938
|
}
|
|
@@ -2966,8 +2962,7 @@ ${printDocs(docs)}`);
|
|
|
2966
2962
|
logger.debug("[ModelBuilder] No documents to build model from");
|
|
2967
2963
|
return null;
|
|
2968
2964
|
}
|
|
2969
|
-
logger.debug(`[ModelBuilder]
|
|
2970
|
-
${printDocs(docs)}`);
|
|
2965
|
+
logger.debug(`[ModelBuilder] onValidated (${docs.length} docs)`);
|
|
2971
2966
|
return buildModel(this.services, docs);
|
|
2972
2967
|
});
|
|
2973
2968
|
}
|
|
@@ -3024,14 +3019,14 @@ ${printDocs(docs)}`);
|
|
|
3024
3019
|
if (cache.has(CACHE_KEY_COMPUTED_MODEL)) {
|
|
3025
3020
|
return cache.get(CACHE_KEY_COMPUTED_MODEL);
|
|
3026
3021
|
}
|
|
3027
|
-
const model = await this.buildModel(cancelToken);
|
|
3028
|
-
if (!model) {
|
|
3029
|
-
return null;
|
|
3030
|
-
}
|
|
3031
3022
|
return await this.services.shared.workspace.WorkspaceLock.read(async () => {
|
|
3032
3023
|
if (cancelToken) {
|
|
3033
3024
|
await interruptAndCheck(cancelToken);
|
|
3034
3025
|
}
|
|
3026
|
+
const model = this.unsafeSyncBuildModel();
|
|
3027
|
+
if (!model) {
|
|
3028
|
+
return null;
|
|
3029
|
+
}
|
|
3035
3030
|
return this.unsafeSyncBuildComputedModel(model);
|
|
3036
3031
|
});
|
|
3037
3032
|
}
|
|
@@ -3041,17 +3036,17 @@ ${printDocs(docs)}`);
|
|
|
3041
3036
|
if (cache.has(cacheKey)) {
|
|
3042
3037
|
return cache.get(cacheKey);
|
|
3043
3038
|
}
|
|
3044
|
-
const model = await this.buildModel(cancelToken);
|
|
3045
|
-
const view = model?.views[viewId];
|
|
3046
|
-
if (!view) {
|
|
3047
|
-
logger.warn(`[ModelBuilder] Cannot find view ${viewId}`);
|
|
3048
|
-
return null;
|
|
3049
|
-
}
|
|
3050
3039
|
return await this.services.shared.workspace.WorkspaceLock.read(async () => {
|
|
3051
3040
|
if (cancelToken) {
|
|
3052
3041
|
await interruptAndCheck(cancelToken);
|
|
3053
3042
|
}
|
|
3054
3043
|
return cache.get(cacheKey, () => {
|
|
3044
|
+
const model = this.unsafeSyncBuildModel();
|
|
3045
|
+
const view = model?.views[viewId];
|
|
3046
|
+
if (!view) {
|
|
3047
|
+
logger.warn(`[ModelBuilder] Cannot find view ${viewId}`);
|
|
3048
|
+
return null;
|
|
3049
|
+
}
|
|
3055
3050
|
const index = new LikeC4ModelGraph(model);
|
|
3056
3051
|
const result = isElementView$1(view) ? computeView(view, index) : computeDynamicView(view, index);
|
|
3057
3052
|
if (!result.isSuccess) {
|
|
@@ -4737,14 +4732,16 @@ class Rpc {
|
|
|
4737
4732
|
const LangiumDocuments = this.services.shared.workspace.LangiumDocuments;
|
|
4738
4733
|
const DocumentBuilder = this.services.shared.workspace.DocumentBuilder;
|
|
4739
4734
|
const notifyModelParsed = debounce(
|
|
4740
|
-
() =>
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4735
|
+
() => {
|
|
4736
|
+
connection.sendNotification(onDidChangeModel, "").catch((e) => {
|
|
4737
|
+
logger.error(`[ServerRpc] error sending onDidChangeModel: ${e}`);
|
|
4738
|
+
return Promise.resolve();
|
|
4739
|
+
});
|
|
4740
|
+
},
|
|
4744
4741
|
{
|
|
4745
4742
|
timing: "both",
|
|
4746
|
-
waitMs:
|
|
4747
|
-
maxWaitMs:
|
|
4743
|
+
waitMs: 300,
|
|
4744
|
+
maxWaitMs: 600
|
|
4748
4745
|
}
|
|
4749
4746
|
);
|
|
4750
4747
|
let isFirstBuild = true;
|
|
@@ -4753,7 +4750,10 @@ class Rpc {
|
|
|
4753
4750
|
notifyModelParsed.cancel();
|
|
4754
4751
|
}),
|
|
4755
4752
|
modelBuilder.onModelParsed(() => notifyModelParsed.call()),
|
|
4756
|
-
connection.onRequest(fetchComputedModel, async (cancelToken) => {
|
|
4753
|
+
connection.onRequest(fetchComputedModel, async ({ cleanCaches }, cancelToken) => {
|
|
4754
|
+
if (cleanCaches) {
|
|
4755
|
+
this.services.WorkspaceCache.clear();
|
|
4756
|
+
}
|
|
4757
4757
|
const model = await modelBuilder.buildComputedModel(cancelToken);
|
|
4758
4758
|
return { model };
|
|
4759
4759
|
}),
|
|
@@ -4929,8 +4929,8 @@ class LikeC4WorkspaceManager extends DefaultWorkspaceManager {
|
|
|
4929
4929
|
* your language, which can be either loaded from provided files or constructed in memory.
|
|
4930
4930
|
*/
|
|
4931
4931
|
async loadAdditionalDocuments(folders, collector) {
|
|
4932
|
-
await super.loadAdditionalDocuments(folders, collector);
|
|
4933
4932
|
collector(this.documentFactory.fromString(LibIcons, URI$1.parse(Uri)));
|
|
4933
|
+
await super.loadAdditionalDocuments(folders, collector);
|
|
4934
4934
|
}
|
|
4935
4935
|
workspace() {
|
|
4936
4936
|
if (this.folders && hasAtLeast$1(this.folders, 1)) {
|
|
@@ -5735,4 +5735,4 @@ function _merge(target, source) {
|
|
|
5735
5735
|
return target;
|
|
5736
5736
|
}
|
|
5737
5737
|
|
|
5738
|
-
export { LikeC4Module as L,
|
|
5738
|
+
export { LikeC4Module as L, createCustomLanguageServices as a, createLanguageServices as c, logger as l, setLogLevel as s };
|
|
@@ -1,12 +1,41 @@
|
|
|
1
|
+
import { LangiumDocument, ReferenceDescription, MaybePromise, AstNode, Reference, MultiMap, AstNodeDescription, DiagnosticInfo, LangiumDocuments, Stream, Cancellation, Disposable, URI, DefaultScopeComputation, PrecomputedScopes, DefaultScopeProvider, ReferenceInfo, Scope, DefaultWorkspaceManager, WorkspaceCache, Module } from 'langium';
|
|
2
|
+
import { CodeLensProvider, DefaultCompletionProvider, DefaultDocumentHighlightProvider, DocumentLinkProvider, DocumentSymbolProvider, NodeKindProvider as NodeKindProvider$1, AstNodeHoverProvider, AbstractSemanticTokenProvider, SemanticTokenAcceptor, LangiumSharedServices, DefaultWorkspaceSymbolProvider, LangiumServices, PartialLangiumServices, DefaultSharedModuleContext } from 'langium/lsp';
|
|
3
|
+
import { CodeLensParams, CancellationToken, CodeLens, DocumentHighlight, DocumentLinkParams, DocumentLink, WorkspaceFolder } from 'vscode-languageserver';
|
|
4
|
+
import { Diagnostic, DocumentSymbol, SymbolKind, Hover, Location, Range, TextEdit, CompletionItemKind } from 'vscode-languageserver-types';
|
|
1
5
|
import * as c4 from '@likec4/core';
|
|
2
6
|
import { Fqn, ViewID } from '@likec4/core';
|
|
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
7
|
import { SetRequired, ValueOf, ConditionalPick } from 'type-fest';
|
|
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, AbstractSemanticTokenProvider, SemanticTokenAcceptor, LangiumSharedServices, DefaultWorkspaceSymbolProvider, LangiumServices, PartialLangiumServices, DefaultSharedModuleContext } from 'langium/lsp';
|
|
7
|
-
import { CodeLensParams, CancellationToken, CodeLens, DocumentHighlight, DocumentLinkParams, DocumentLink, WorkspaceFolder } from 'vscode-languageserver';
|
|
8
8
|
import { ChangeViewRequestParams } from '../protocol.js';
|
|
9
|
-
import { URI } from 'vscode-uri';
|
|
9
|
+
import { URI as URI$1 } from 'vscode-uri';
|
|
10
|
+
import * as _likec4_log from '@likec4/log';
|
|
11
|
+
import { LogLevels } from '@likec4/log';
|
|
12
|
+
|
|
13
|
+
declare class LikeC4CodeLensProvider implements CodeLensProvider {
|
|
14
|
+
private services;
|
|
15
|
+
constructor(services: LikeC4Services);
|
|
16
|
+
provideCodeLens(doc: LangiumDocument, _params: CodeLensParams, cancelToken?: CancellationToken): Promise<CodeLens[] | undefined>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare class LikeC4CompletionProvider extends DefaultCompletionProvider {
|
|
20
|
+
readonly completionOptions: {
|
|
21
|
+
triggerCharacters: string[];
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare class LikeC4DocumentHighlightProvider extends DefaultDocumentHighlightProvider {
|
|
26
|
+
/**
|
|
27
|
+
* Override this method to determine the highlight kind of the given reference.
|
|
28
|
+
*/
|
|
29
|
+
protected createDocumentHighlight(reference: ReferenceDescription): DocumentHighlight;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
declare class LikeC4DocumentLinkProvider implements DocumentLinkProvider {
|
|
33
|
+
private services;
|
|
34
|
+
constructor(services: LikeC4Services);
|
|
35
|
+
getDocumentLinks(doc: LangiumDocument, _params: DocumentLinkParams): MaybePromise<DocumentLink[]>;
|
|
36
|
+
resolveLink(doc: LangiumDocument, link: string): string;
|
|
37
|
+
relativeLink(doc: LangiumDocument, link: string): string | null;
|
|
38
|
+
}
|
|
10
39
|
|
|
11
40
|
/******************************************************************************
|
|
12
41
|
* This file was generated by langium-cli 3.2.0.
|
|
@@ -931,33 +960,6 @@ declare function checksFromDiagnostics(doc: LikeC4LangiumDocument): {
|
|
|
931
960
|
};
|
|
932
961
|
type ChecksFromDiagnostics = ReturnType<typeof checksFromDiagnostics>;
|
|
933
962
|
|
|
934
|
-
declare class LikeC4CodeLensProvider implements CodeLensProvider {
|
|
935
|
-
private services;
|
|
936
|
-
constructor(services: LikeC4Services);
|
|
937
|
-
provideCodeLens(doc: LangiumDocument, _params: CodeLensParams, cancelToken?: CancellationToken): Promise<CodeLens[] | undefined>;
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
declare class LikeC4CompletionProvider extends DefaultCompletionProvider {
|
|
941
|
-
readonly completionOptions: {
|
|
942
|
-
triggerCharacters: string[];
|
|
943
|
-
};
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
declare class LikeC4DocumentHighlightProvider extends DefaultDocumentHighlightProvider {
|
|
947
|
-
/**
|
|
948
|
-
* Override this method to determine the highlight kind of the given reference.
|
|
949
|
-
*/
|
|
950
|
-
protected createDocumentHighlight(reference: ReferenceDescription): DocumentHighlight;
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
declare class LikeC4DocumentLinkProvider implements DocumentLinkProvider {
|
|
954
|
-
private services;
|
|
955
|
-
constructor(services: LikeC4Services);
|
|
956
|
-
getDocumentLinks(doc: LangiumDocument, _params: DocumentLinkParams): MaybePromise<DocumentLink[]>;
|
|
957
|
-
resolveLink(doc: LangiumDocument, link: string): string;
|
|
958
|
-
relativeLink(doc: LangiumDocument, link: string): string | null;
|
|
959
|
-
}
|
|
960
|
-
|
|
961
963
|
declare class LikeC4DocumentSymbolProvider implements DocumentSymbolProvider {
|
|
962
964
|
private services;
|
|
963
965
|
protected readonly nodeKindProvider: NodeKindProvider$1;
|
|
@@ -989,6 +991,111 @@ declare class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider
|
|
|
989
991
|
private highlightView;
|
|
990
992
|
}
|
|
991
993
|
|
|
994
|
+
declare function computeDocumentFqn(document: LikeC4LangiumDocument, services: LikeC4Services): void;
|
|
995
|
+
|
|
996
|
+
interface FqnIndexEntry {
|
|
997
|
+
fqn: Fqn;
|
|
998
|
+
name: string;
|
|
999
|
+
el: Element;
|
|
1000
|
+
doc: FqnIndexedDocument;
|
|
1001
|
+
path: string;
|
|
1002
|
+
}
|
|
1003
|
+
declare class FqnIndex {
|
|
1004
|
+
private services;
|
|
1005
|
+
protected langiumDocuments: LangiumDocuments;
|
|
1006
|
+
constructor(services: LikeC4Services);
|
|
1007
|
+
get documents(): Stream<FqnIndexedDocument>;
|
|
1008
|
+
private entries;
|
|
1009
|
+
getFqn(el: Element): Fqn | null;
|
|
1010
|
+
byFqn(fqn: Fqn): Stream<AstNodeDescription>;
|
|
1011
|
+
directChildrenOf(parent: Fqn): Stream<AstNodeDescription>;
|
|
1012
|
+
/**
|
|
1013
|
+
* Returns descedant elements with unique names in the scope
|
|
1014
|
+
*/
|
|
1015
|
+
uniqueDescedants(parent: Fqn): Stream<AstNodeDescription>;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
type ModelParsedListener$1 = (docs: URI[]) => void;
|
|
1019
|
+
declare class LikeC4ModelBuilder {
|
|
1020
|
+
private services;
|
|
1021
|
+
private langiumDocuments;
|
|
1022
|
+
private listeners;
|
|
1023
|
+
constructor(services: LikeC4Services);
|
|
1024
|
+
/**
|
|
1025
|
+
* WARNING:
|
|
1026
|
+
* This method is internal and should to be called only when all documents are known to be parsed.
|
|
1027
|
+
* Otherwise, the model may be incomplete.
|
|
1028
|
+
*/
|
|
1029
|
+
unsafeSyncBuildModel(): c4.ParsedLikeC4Model | null;
|
|
1030
|
+
buildModel(cancelToken?: Cancellation.CancellationToken): Promise<c4.ParsedLikeC4Model | null>;
|
|
1031
|
+
private previousViews;
|
|
1032
|
+
/**
|
|
1033
|
+
* WARNING:
|
|
1034
|
+
* This method is internal and should to be called only when all documents are known to be parsed.
|
|
1035
|
+
* Otherwise, the model may be incomplete.
|
|
1036
|
+
*/
|
|
1037
|
+
unsafeSyncBuildComputedModel(model: c4.ParsedLikeC4Model): c4.ComputedLikeC4Model;
|
|
1038
|
+
buildComputedModel(cancelToken?: Cancellation.CancellationToken): Promise<c4.ComputedLikeC4Model | null>;
|
|
1039
|
+
computeView(viewId: ViewID, cancelToken?: Cancellation.CancellationToken): Promise<c4.ComputedView | null>;
|
|
1040
|
+
onModelParsed(callback: ModelParsedListener$1): Disposable;
|
|
1041
|
+
private documents;
|
|
1042
|
+
private notifyListeners;
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
declare class LikeC4ModelLocator {
|
|
1046
|
+
private services;
|
|
1047
|
+
private fqnIndex;
|
|
1048
|
+
private langiumDocuments;
|
|
1049
|
+
constructor(services: LikeC4Services);
|
|
1050
|
+
private documents;
|
|
1051
|
+
getParsedElement(astNode: Element): ParsedAstElement | null;
|
|
1052
|
+
locateElement(fqn: c4.Fqn, _prop?: string): Location | null;
|
|
1053
|
+
locateRelation(relationId: c4.RelationID): Location | null;
|
|
1054
|
+
locateViewAst(viewId: c4.ViewID): {
|
|
1055
|
+
doc: ParsedLikeC4LangiumDocument;
|
|
1056
|
+
view: ParsedAstView;
|
|
1057
|
+
viewAst: LikeC4View;
|
|
1058
|
+
};
|
|
1059
|
+
locateView(viewId: c4.ViewID): Location | null;
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
type ModelParsedListener = () => void;
|
|
1063
|
+
type IsValidFn = ChecksFromDiagnostics['isValid'];
|
|
1064
|
+
declare class LikeC4ModelParser {
|
|
1065
|
+
private services;
|
|
1066
|
+
private fqnIndex;
|
|
1067
|
+
constructor(services: LikeC4Services);
|
|
1068
|
+
parse(doc: LangiumDocument | LangiumDocument[]): ParsedLikeC4LangiumDocument[];
|
|
1069
|
+
protected parseLikeC4Document(_doc: FqnIndexedDocument): ParsedLikeC4LangiumDocument;
|
|
1070
|
+
private parseSpecification;
|
|
1071
|
+
private parseModel;
|
|
1072
|
+
private parseElement;
|
|
1073
|
+
private parseRelation;
|
|
1074
|
+
private parseViews;
|
|
1075
|
+
private parseViewRulePredicate;
|
|
1076
|
+
private parsePredicate;
|
|
1077
|
+
private parseElementExpressionsIterator;
|
|
1078
|
+
private parseElementPredicate;
|
|
1079
|
+
private parseElementExpr;
|
|
1080
|
+
private parseElementPredicateWith;
|
|
1081
|
+
private parseElementPredicateWhere;
|
|
1082
|
+
private parseRelationPredicate;
|
|
1083
|
+
private parseRelationPredicateWhere;
|
|
1084
|
+
private parseRelationPredicateWith;
|
|
1085
|
+
private parseRelationExpr;
|
|
1086
|
+
private parseViewRule;
|
|
1087
|
+
private parseViewManualLaout;
|
|
1088
|
+
private parseDynamicParallelSteps;
|
|
1089
|
+
private parseDynamicStep;
|
|
1090
|
+
private parseElementView;
|
|
1091
|
+
private parseDynamicElementView;
|
|
1092
|
+
protected resolveFqn(node: Element | ExtendElement): c4.Fqn;
|
|
1093
|
+
private getAstNodePath;
|
|
1094
|
+
private getMetadata;
|
|
1095
|
+
private convertTags;
|
|
1096
|
+
private convertLinks;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
992
1099
|
declare class LikeC4ModelChanges {
|
|
993
1100
|
private services;
|
|
994
1101
|
private locator;
|
|
@@ -1059,7 +1166,7 @@ declare class LikeC4WorkspaceManager extends DefaultWorkspaceManager {
|
|
|
1059
1166
|
*/
|
|
1060
1167
|
protected loadAdditionalDocuments(folders: WorkspaceFolder[], collector: (document: LangiumDocument) => void): Promise<void>;
|
|
1061
1168
|
workspace(): WorkspaceFolder;
|
|
1062
|
-
get workspaceUri(): URI;
|
|
1169
|
+
get workspaceUri(): URI$1;
|
|
1063
1170
|
get workspaceURL(): URL;
|
|
1064
1171
|
}
|
|
1065
1172
|
|
|
@@ -1117,107 +1224,7 @@ declare function createLanguageServices(context?: LanguageServicesContext): {
|
|
|
1117
1224
|
likec4: LikeC4Services;
|
|
1118
1225
|
};
|
|
1119
1226
|
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
name: string;
|
|
1123
|
-
el: Element;
|
|
1124
|
-
doc: FqnIndexedDocument;
|
|
1125
|
-
path: string;
|
|
1126
|
-
}
|
|
1127
|
-
declare class FqnIndex {
|
|
1128
|
-
private services;
|
|
1129
|
-
protected langiumDocuments: LangiumDocuments;
|
|
1130
|
-
constructor(services: LikeC4Services);
|
|
1131
|
-
get documents(): Stream<FqnIndexedDocument>;
|
|
1132
|
-
private entries;
|
|
1133
|
-
getFqn(el: Element): Fqn | null;
|
|
1134
|
-
byFqn(fqn: Fqn): Stream<AstNodeDescription>;
|
|
1135
|
-
directChildrenOf(parent: Fqn): Stream<AstNodeDescription>;
|
|
1136
|
-
/**
|
|
1137
|
-
* Returns descedant elements with unique names in the scope
|
|
1138
|
-
*/
|
|
1139
|
-
uniqueDescedants(parent: Fqn): Stream<AstNodeDescription>;
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
type ModelParsedListener$1 = (docs: URI$1[]) => void;
|
|
1143
|
-
declare class LikeC4ModelBuilder {
|
|
1144
|
-
private services;
|
|
1145
|
-
private langiumDocuments;
|
|
1146
|
-
private listeners;
|
|
1147
|
-
constructor(services: LikeC4Services);
|
|
1148
|
-
/**
|
|
1149
|
-
* WARNING:
|
|
1150
|
-
* This method is internal and should to be called only when all documents are known to be parsed.
|
|
1151
|
-
* Otherwise, the model may be incomplete.
|
|
1152
|
-
*/
|
|
1153
|
-
unsafeSyncBuildModel(): c4.ParsedLikeC4Model | null;
|
|
1154
|
-
buildModel(cancelToken?: Cancellation.CancellationToken): Promise<c4.ParsedLikeC4Model | null>;
|
|
1155
|
-
private previousViews;
|
|
1156
|
-
/**
|
|
1157
|
-
* WARNING:
|
|
1158
|
-
* This method is internal and should to be called only when all documents are known to be parsed.
|
|
1159
|
-
* Otherwise, the model may be incomplete.
|
|
1160
|
-
*/
|
|
1161
|
-
unsafeSyncBuildComputedModel(model: c4.ParsedLikeC4Model): c4.ComputedLikeC4Model;
|
|
1162
|
-
buildComputedModel(cancelToken?: Cancellation.CancellationToken): Promise<c4.ComputedLikeC4Model | null>;
|
|
1163
|
-
computeView(viewId: ViewID, cancelToken?: Cancellation.CancellationToken): Promise<c4.ComputedView | null>;
|
|
1164
|
-
onModelParsed(callback: ModelParsedListener$1): Disposable;
|
|
1165
|
-
private documents;
|
|
1166
|
-
private notifyListeners;
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
|
-
declare class LikeC4ModelLocator {
|
|
1170
|
-
private services;
|
|
1171
|
-
private fqnIndex;
|
|
1172
|
-
private langiumDocuments;
|
|
1173
|
-
constructor(services: LikeC4Services);
|
|
1174
|
-
private documents;
|
|
1175
|
-
getParsedElement(astNode: Element): ParsedAstElement | null;
|
|
1176
|
-
locateElement(fqn: c4.Fqn, _prop?: string): Location | null;
|
|
1177
|
-
locateRelation(relationId: c4.RelationID): Location | null;
|
|
1178
|
-
locateViewAst(viewId: c4.ViewID): {
|
|
1179
|
-
doc: ParsedLikeC4LangiumDocument;
|
|
1180
|
-
view: ParsedAstView;
|
|
1181
|
-
viewAst: LikeC4View;
|
|
1182
|
-
};
|
|
1183
|
-
locateView(viewId: c4.ViewID): Location | null;
|
|
1184
|
-
}
|
|
1185
|
-
|
|
1186
|
-
type ModelParsedListener = () => void;
|
|
1187
|
-
type IsValidFn = ChecksFromDiagnostics['isValid'];
|
|
1188
|
-
declare class LikeC4ModelParser {
|
|
1189
|
-
private services;
|
|
1190
|
-
private fqnIndex;
|
|
1191
|
-
constructor(services: LikeC4Services);
|
|
1192
|
-
parse(doc: LangiumDocument | LangiumDocument[]): ParsedLikeC4LangiumDocument[];
|
|
1193
|
-
protected parseLikeC4Document(_doc: FqnIndexedDocument): ParsedLikeC4LangiumDocument;
|
|
1194
|
-
private parseSpecification;
|
|
1195
|
-
private parseModel;
|
|
1196
|
-
private parseElement;
|
|
1197
|
-
private parseRelation;
|
|
1198
|
-
private parseViews;
|
|
1199
|
-
private parseViewRulePredicate;
|
|
1200
|
-
private parsePredicate;
|
|
1201
|
-
private parseElementExpressionsIterator;
|
|
1202
|
-
private parseElementPredicate;
|
|
1203
|
-
private parseElementExpr;
|
|
1204
|
-
private parseElementPredicateWith;
|
|
1205
|
-
private parseElementPredicateWhere;
|
|
1206
|
-
private parseRelationPredicate;
|
|
1207
|
-
private parseRelationPredicateWhere;
|
|
1208
|
-
private parseRelationPredicateWith;
|
|
1209
|
-
private parseRelationExpr;
|
|
1210
|
-
private parseViewRule;
|
|
1211
|
-
private parseViewManualLaout;
|
|
1212
|
-
private parseDynamicParallelSteps;
|
|
1213
|
-
private parseDynamicStep;
|
|
1214
|
-
private parseElementView;
|
|
1215
|
-
private parseDynamicElementView;
|
|
1216
|
-
protected resolveFqn(node: Element | ExtendElement): c4.Fqn;
|
|
1217
|
-
private getAstNodePath;
|
|
1218
|
-
private getMetadata;
|
|
1219
|
-
private convertTags;
|
|
1220
|
-
private convertLinks;
|
|
1221
|
-
}
|
|
1227
|
+
declare const logger: _likec4_log.ConsolaInstance;
|
|
1228
|
+
declare function setLogLevel(level: keyof typeof LogLevels): void;
|
|
1222
1229
|
|
|
1223
|
-
export { type FqnIndexEntry as F, type IsValidFn as I, type
|
|
1230
|
+
export { type FqnIndexEntry as F, type IsValidFn as I, type LikeC4SharedServices as L, type ModelParsedListener as M, type LikeC4Services as a, createLanguageServices as b, createCustomLanguageServices as c, LikeC4Module as d, computeDocumentFqn as e, FqnIndex as f, LikeC4ModelBuilder as g, LikeC4ModelLocator as h, LikeC4ModelParser as i, type LikeC4AddedServices as j, type LanguageServicesContext as k, createSharedServices as l, logger as m, setLogLevel as s };
|