@likec4/language-server 1.39.1 → 1.39.2
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 → LikeC4LanguageServices.mjs} +3 -3
- package/dist/{Rpc.js → Rpc.mjs} +3 -3
- package/dist/{ast.js → ast.mjs} +2 -2
- package/dist/browser-worker.mjs +2 -0
- package/dist/{browser.js → browser.mjs} +3 -3
- package/dist/bundled.mjs +2165 -2165
- package/dist/documentation/{documentation-provider.js → documentation-provider.mjs} +2 -2
- package/dist/documentation/{index.js → index.mjs} +1 -1
- package/dist/filesystem/{ChokidarWatcher.js → ChokidarWatcher.mjs} +8 -7
- package/dist/filesystem/LikeC4FileSystem.d.ts +1 -0
- package/dist/filesystem/{LikeC4FileSystem.js → LikeC4FileSystem.mjs} +6 -6
- package/dist/filesystem/{index.js → index.mjs} +1 -1
- package/dist/formatting/{LikeC4Formatter.js → LikeC4Formatter.mjs} +2 -2
- package/dist/generated/{module.js → module.mjs} +2 -2
- package/dist/{index.js → index.mjs} +9 -9
- package/dist/{likec4lib.js → likec4lib.mjs} +1 -1
- package/dist/lsp/{CodeLensProvider.js → CodeLensProvider.mjs} +3 -3
- package/dist/lsp/{CompletionProvider.js → CompletionProvider.mjs} +1 -1
- package/dist/lsp/{DocumentLinkProvider.js → DocumentLinkProvider.mjs} +2 -2
- package/dist/lsp/{DocumentSymbolProvider.js → DocumentSymbolProvider.mjs} +3 -3
- package/dist/lsp/{HoverProvider.js → HoverProvider.mjs} +1 -1
- package/dist/lsp/{SemanticTokenProvider.js → SemanticTokenProvider.mjs} +1 -1
- package/dist/lsp/index.mjs +7 -0
- package/dist/mcp/{MCPServerFactory.js → MCPServerFactory.mjs} +9 -9
- package/dist/mcp/{interfaces.js → interfaces.mjs} +1 -1
- package/dist/mcp/server/{StdioLikeC4MCPServer.js → StdioLikeC4MCPServer.mjs} +1 -1
- package/dist/mcp/server/{StreamableLikeC4MCPServer.js → StreamableLikeC4MCPServer.mjs} +1 -1
- package/dist/mcp/server/{WithMCPServer.js → WithMCPServer.mjs} +3 -3
- package/dist/mcp/tools/{_common.js → _common.mjs} +2 -2
- package/dist/mcp/tools/{find-relationships.js → find-relationships.mjs} +2 -2
- package/dist/mcp/tools/{list-projects.js → list-projects.mjs} +1 -1
- package/dist/mcp/tools/{open-view.js → open-view.mjs} +2 -2
- package/dist/mcp/tools/{read-deployment.js → read-deployment.mjs} +2 -2
- package/dist/mcp/tools/{read-element.js → read-element.mjs} +2 -2
- package/dist/mcp/tools/{read-project-summary.js → read-project-summary.mjs} +2 -2
- package/dist/mcp/tools/{read-view.js → read-view.mjs} +2 -2
- package/dist/mcp/tools/{search-element.js → search-element.mjs} +2 -2
- package/dist/mcp/{utils.js → utils.mjs} +1 -1
- package/dist/model/builder/{MergedSpecification.js → MergedSpecification.mjs} +2 -2
- package/dist/model/builder/{buildModel.js → buildModel.mjs} +4 -4
- package/dist/model/{deployments-index.js → deployments-index.mjs} +4 -4
- package/dist/model/{fqn-index.js → fqn-index.mjs} +5 -5
- package/dist/model/index.mjs +6 -0
- package/dist/model/{model-builder.js → model-builder.mjs} +5 -5
- package/dist/model/{model-locator.js → model-locator.mjs} +4 -4
- package/dist/model/{model-parser-where.js → model-parser-where.mjs} +1 -1
- package/dist/model/{model-parser.js → model-parser.mjs} +13 -13
- package/dist/model/parser/{Base.js → Base.mjs} +5 -5
- package/dist/model/parser/{DeploymentModelParser.js → DeploymentModelParser.mjs} +3 -3
- package/dist/model/parser/{DeploymentViewParser.js → DeploymentViewParser.mjs} +5 -5
- package/dist/model/parser/{FqnRefParser.js → FqnRefParser.mjs} +6 -6
- package/dist/model/parser/{GlobalsParser.js → GlobalsParser.mjs} +2 -2
- package/dist/model/parser/{ImportsParser.js → ImportsParser.mjs} +1 -1
- package/dist/model/parser/{ModelParser.js → ModelParser.mjs} +3 -3
- package/dist/model/parser/{PredicatesParser.js → PredicatesParser.mjs} +1 -1
- package/dist/model/parser/{SpecificationParser.js → SpecificationParser.mjs} +3 -3
- package/dist/model/parser/{ViewsParser.js → ViewsParser.mjs} +6 -6
- package/dist/model-change/{ModelChanges.js → ModelChanges.mjs} +3 -3
- package/dist/model-change/{changeElementStyle.js → changeElementStyle.mjs} +1 -1
- package/dist/model-change/{changeViewLayout.js → changeViewLayout.mjs} +1 -1
- package/dist/model-change/{saveManualLayout.js → saveManualLayout.mjs} +1 -1
- package/dist/{module.js → module.mjs} +16 -16
- package/dist/references/index.mjs +3 -0
- package/dist/references/{name-provider.js → name-provider.mjs} +1 -1
- package/dist/references/{scope-computation.js → scope-computation.mjs} +2 -2
- package/dist/references/{scope-provider.js → scope-provider.mjs} +4 -4
- package/dist/shared/{NodeKindProvider.js → NodeKindProvider.mjs} +1 -1
- package/dist/shared/index.mjs +2 -0
- package/dist/test/index.mjs +1 -0
- package/dist/test/{testServices.js → testServices.mjs} +2 -2
- package/dist/utils/{disposable.js → disposable.mjs} +1 -1
- package/dist/utils/{elementRef.js → elementRef.mjs} +1 -1
- package/dist/utils/{fqnRef.js → fqnRef.mjs} +1 -1
- package/dist/utils/{index.js → index.mjs} +6 -6
- package/dist/utils/{projectId.js → projectId.mjs} +1 -1
- package/dist/validation/{_shared.js → _shared.mjs} +1 -1
- package/dist/validation/{deployment-checks.js → deployment-checks.mjs} +3 -3
- package/dist/validation/{dynamic-view-step.js → dynamic-view-step.mjs} +2 -2
- package/dist/validation/{element-ref.js → element-ref.mjs} +2 -2
- package/dist/validation/{element.js → element.mjs} +2 -2
- package/dist/validation/{imports.js → imports.mjs} +2 -2
- package/dist/validation/{index.js → index.mjs} +13 -13
- package/dist/validation/{property-checks.js → property-checks.mjs} +2 -2
- package/dist/validation/{relation.js → relation.mjs} +2 -2
- package/dist/validation/{specification.js → specification.mjs} +3 -3
- package/dist/validation/view-predicates/{fqn-expr-with.js → fqn-expr-with.mjs} +4 -3
- package/dist/validation/view-predicates/{fqn-ref-expr.js → fqn-ref-expr.mjs} +3 -3
- package/dist/validation/view-predicates/{incoming.js → incoming.mjs} +2 -2
- package/dist/validation/view-predicates/index.mjs +6 -0
- package/dist/validation/view-predicates/{outgoing.js → outgoing.mjs} +2 -2
- package/dist/validation/view-predicates/{relation-expr.js → relation-expr.mjs} +2 -2
- package/dist/validation/view-predicates/{relation-with.js → relation-with.mjs} +2 -2
- package/dist/validation/{view.js → view.mjs} +3 -3
- package/dist/view-utils/index.mjs +2 -0
- package/dist/view-utils/{manual-layout.js → manual-layout.mjs} +1 -1
- package/dist/views/{configurable-layouter.js → configurable-layouter.mjs} +1 -1
- package/dist/views/index.mjs +1 -0
- package/dist/views/{likec4-views.js → likec4-views.mjs} +2 -2
- package/dist/workspace/{LangiumDocuments.js → LangiumDocuments.mjs} +2 -2
- package/dist/workspace/{ProjectsManager.js → ProjectsManager.mjs} +1 -1
- package/dist/workspace/{WorkspaceManager.js → WorkspaceManager.mjs} +2 -2
- package/dist/workspace/index.mjs +5 -0
- package/package.json +21 -19
- package/dist/browser-worker.js +0 -2
- package/dist/bundled.js +0 -40
- package/dist/lsp/index.js +0 -7
- package/dist/model/index.js +0 -6
- package/dist/references/index.js +0 -3
- package/dist/shared/index.js +0 -2
- package/dist/test/index.js +0 -1
- package/dist/validation/view-predicates/index.js +0 -6
- package/dist/view-utils/index.js +0 -2
- package/dist/views/index.js +0 -1
- package/dist/workspace/index.js +0 -5
- /package/dist/{empty.js → empty.mjs} +0 -0
- /package/dist/filesystem/{FileSystemWatcher.js → FileSystemWatcher.mjs} +0 -0
- /package/dist/formatting/{utils.js → utils.mjs} +0 -0
- /package/dist/generated/{ast.js → ast.mjs} +0 -0
- /package/dist/generated/{grammar.js → grammar.mjs} +0 -0
- /package/dist/generated-lib/{icons.js → icons.mjs} +0 -0
- /package/dist/{logger.js → logger.mjs} +0 -0
- /package/dist/lsp/{DocumentHighlightProvider.js → DocumentHighlightProvider.mjs} +0 -0
- /package/dist/lsp/{RenameProvider.js → RenameProvider.mjs} +0 -0
- /package/dist/mcp/{NoopLikeC4MCPServer.js → NoopLikeC4MCPServer.mjs} +0 -0
- /package/dist/model/builder/{MergedExtends.js → MergedExtends.mjs} +0 -0
- /package/dist/model/builder/{assignTagColors.js → assignTagColors.mjs} +0 -0
- /package/dist/model/parser/{ValueConverter.js → ValueConverter.mjs} +0 -0
- /package/dist/{protocol.js → protocol.mjs} +0 -0
- /package/dist/shared/{WorkspaceSymbolProvider.js → WorkspaceSymbolProvider.mjs} +0 -0
- /package/dist/utils/{printDocs.js → printDocs.mjs} +0 -0
- /package/dist/utils/{stringHash.js → stringHash.mjs} +0 -0
- /package/dist/validation/{DocumentValidator.js → DocumentValidator.mjs} +0 -0
- /package/dist/view-utils/{assignNavigateTo.js → assignNavigateTo.mjs} +0 -0
- /package/dist/view-utils/{resolve-relative-paths.js → resolve-relative-paths.mjs} +0 -0
- /package/dist/workspace/{AstNodeDescriptionProvider.js → AstNodeDescriptionProvider.mjs} +0 -0
- /package/dist/workspace/{IndexManager.js → IndexManager.mjs} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FqnRef } from "@likec4/core";
|
|
2
2
|
import { AstUtils } from "langium";
|
|
3
|
-
import { ast } from "../ast.
|
|
4
|
-
import { logWarnError } from "../logger.
|
|
3
|
+
import { ast } from "../ast.mjs";
|
|
4
|
+
import { logWarnError } from "../logger.mjs";
|
|
5
5
|
export class LikeC4DocumentationProvider {
|
|
6
6
|
parser;
|
|
7
7
|
locator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { LikeC4DocumentationProvider } from "./documentation-provider.
|
|
1
|
+
export { LikeC4DocumentationProvider } from "./documentation-provider.mjs";
|
|
@@ -2,8 +2,8 @@ import { isLikeC4Config } from "@likec4/config/node";
|
|
|
2
2
|
import { loggable } from "@likec4/log";
|
|
3
3
|
import chokidar from "chokidar";
|
|
4
4
|
import { URI } from "langium";
|
|
5
|
-
import { logger as mainLogger } from "../logger.
|
|
6
|
-
import { isAnyLikeC4File } from "./LikeC4FileSystem.
|
|
5
|
+
import { logger as mainLogger } from "../logger.mjs";
|
|
6
|
+
import { isAnyLikeC4File, isLikeC4File } from "./LikeC4FileSystem.mjs";
|
|
7
7
|
const logger = mainLogger.getChild("chokidar");
|
|
8
8
|
export const chokidarFileSystemWatcher = {
|
|
9
9
|
fileSystemWatcher: (services) => new ChokidarFileSystemWatcher(services)
|
|
@@ -30,9 +30,10 @@ export class ChokidarFileSystemWatcher {
|
|
|
30
30
|
}
|
|
31
31
|
createWatcher(folder) {
|
|
32
32
|
let watcher = chokidar.watch(folder, {
|
|
33
|
-
ignored:
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
ignored: [
|
|
34
|
+
(path) => path.includes("node_modules") || path.includes(".git"),
|
|
35
|
+
(path, stats) => !!stats && stats.isFile() && !isAnyLikeC4File(path)
|
|
36
|
+
],
|
|
36
37
|
ignoreInitial: true
|
|
37
38
|
});
|
|
38
39
|
const onAddOrChange = async (path) => {
|
|
@@ -40,7 +41,7 @@ export class ChokidarFileSystemWatcher {
|
|
|
40
41
|
if (isLikeC4Config(path)) {
|
|
41
42
|
logger.debug`project file changed: ${path}`;
|
|
42
43
|
await this.services.workspace.ProjectsManager.reloadProjects();
|
|
43
|
-
} else {
|
|
44
|
+
} else if (isLikeC4File(path)) {
|
|
44
45
|
logger.debug`file changed: ${path}`;
|
|
45
46
|
await this.services.workspace.DocumentBuilder.update([URI.file(path)], []);
|
|
46
47
|
}
|
|
@@ -53,7 +54,7 @@ export class ChokidarFileSystemWatcher {
|
|
|
53
54
|
if (isLikeC4Config(path)) {
|
|
54
55
|
logger.debug`project file removed: ${path}`;
|
|
55
56
|
await this.services.workspace.ProjectsManager.reloadProjects();
|
|
56
|
-
} else {
|
|
57
|
+
} else if (isLikeC4File(path)) {
|
|
57
58
|
logger.debug`file removed: ${path}`;
|
|
58
59
|
await this.services.workspace.DocumentBuilder.update([], [URI.file(path)]);
|
|
59
60
|
}
|
|
@@ -2,16 +2,16 @@ import { isLikeC4Config, loadConfig } from "@likec4/config/node";
|
|
|
2
2
|
import { fdir } from "fdir";
|
|
3
3
|
import { URI } from "langium";
|
|
4
4
|
import { NodeFileSystemProvider } from "langium/node";
|
|
5
|
-
import { LikeC4LanguageMetaData } from "../generated/module.
|
|
6
|
-
import { Content, isLikeC4Builtin } from "../likec4lib.
|
|
7
|
-
import { logError } from "../logger.
|
|
8
|
-
import { chokidarFileSystemWatcher } from "./ChokidarWatcher.
|
|
9
|
-
import { noopFileSystemWatcher } from "./FileSystemWatcher.
|
|
5
|
+
import { LikeC4LanguageMetaData } from "../generated/module.mjs";
|
|
6
|
+
import { Content, isLikeC4Builtin } from "../likec4lib.mjs";
|
|
7
|
+
import { logError } from "../logger.mjs";
|
|
8
|
+
import { chokidarFileSystemWatcher } from "./ChokidarWatcher.mjs";
|
|
9
|
+
import { noopFileSystemWatcher } from "./FileSystemWatcher.mjs";
|
|
10
10
|
export const LikeC4FileSystem = (ehableWatcher = true) => ({
|
|
11
11
|
fileSystemProvider: () => new SymLinkTraversingFileSystemProvider(),
|
|
12
12
|
...ehableWatcher ? chokidarFileSystemWatcher : noopFileSystemWatcher
|
|
13
13
|
});
|
|
14
|
-
const isLikeC4File = (path) => LikeC4LanguageMetaData.fileExtensions.some((ext) => path.endsWith(ext));
|
|
14
|
+
export const isLikeC4File = (path) => LikeC4LanguageMetaData.fileExtensions.some((ext) => path.endsWith(ext));
|
|
15
15
|
export const isAnyLikeC4File = (path) => isLikeC4File(path) || isLikeC4Config(path);
|
|
16
16
|
class SymLinkTraversingFileSystemProvider extends NodeFileSystemProvider {
|
|
17
17
|
async readFile(uri) {
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
} from "langium";
|
|
5
5
|
import { AbstractFormatter, Formatting } from "langium/lsp";
|
|
6
6
|
import { filter, isTruthy } from "remeda";
|
|
7
|
-
import * as ast from "../generated/ast.
|
|
8
|
-
import * as utils from "./utils.
|
|
7
|
+
import * as ast from "../generated/ast.mjs";
|
|
8
|
+
import * as utils from "./utils.mjs";
|
|
9
9
|
const FormattingOptions = {
|
|
10
10
|
newLine: Formatting.newLine({ allowMore: true }),
|
|
11
11
|
oneSpace: Formatting.oneSpace(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LikeC4AstReflection } from "./ast.
|
|
2
|
-
import { LikeC4Grammar } from "./grammar.
|
|
1
|
+
import { LikeC4AstReflection } from "./ast.mjs";
|
|
2
|
+
import { LikeC4Grammar } from "./grammar.mjs";
|
|
3
3
|
export const LikeC4LanguageMetaData = {
|
|
4
4
|
languageId: "likec4",
|
|
5
5
|
fileExtensions: [".c4", ".likec4", ".like-c4"],
|
|
@@ -2,15 +2,15 @@ import { configureLogger, getConsoleSink, getTextFormatter } from "@likec4/log";
|
|
|
2
2
|
import { defu } from "defu";
|
|
3
3
|
import { startLanguageServer as startLanguim } from "langium/lsp";
|
|
4
4
|
import { createConnection, ProposedFeatures } from "vscode-languageserver/node";
|
|
5
|
-
import { NoopFileSystem } from "./filesystem/index.
|
|
6
|
-
import { LikeC4FileSystem } from "./filesystem/LikeC4FileSystem.
|
|
7
|
-
import { getTelemetrySink, logger } from "./logger.
|
|
8
|
-
import { WithMCPServer } from "./mcp/server/WithMCPServer.
|
|
9
|
-
import { createLanguageServices } from "./module.
|
|
10
|
-
import { ConfigurableLayouter } from "./views/configurable-layouter.
|
|
11
|
-
export { getLspConnectionSink, logger as lspLogger } from "./logger.
|
|
12
|
-
export { isLikeC4Builtin } from "./likec4lib.
|
|
13
|
-
export { createLanguageServices } from "./module.
|
|
5
|
+
import { NoopFileSystem } from "./filesystem/index.mjs";
|
|
6
|
+
import { LikeC4FileSystem } from "./filesystem/LikeC4FileSystem.mjs";
|
|
7
|
+
import { getTelemetrySink, logger } from "./logger.mjs";
|
|
8
|
+
import { WithMCPServer } from "./mcp/server/WithMCPServer.mjs";
|
|
9
|
+
import { createLanguageServices } from "./module.mjs";
|
|
10
|
+
import { ConfigurableLayouter } from "./views/configurable-layouter.mjs";
|
|
11
|
+
export { getLspConnectionSink, logger as lspLogger } from "./logger.mjs";
|
|
12
|
+
export { isLikeC4Builtin } from "./likec4lib.mjs";
|
|
13
|
+
export { createLanguageServices } from "./module.mjs";
|
|
14
14
|
export { LikeC4FileSystem, NoopFileSystem, WithMCPServer };
|
|
15
15
|
export function startLanguageServer(options) {
|
|
16
16
|
const opts = defu(options, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DocumentState } from "langium";
|
|
2
|
-
import { isLikeC4LangiumDocument, ViewOps } from "../ast.
|
|
3
|
-
import { logger } from "../logger.
|
|
4
|
-
import { projectIdFrom } from "../utils/index.
|
|
2
|
+
import { isLikeC4LangiumDocument, ViewOps } from "../ast.mjs";
|
|
3
|
+
import { logger } from "../logger.mjs";
|
|
4
|
+
import { projectIdFrom } from "../utils/index.mjs";
|
|
5
5
|
export class LikeC4CodeLensProvider {
|
|
6
6
|
constructor(services) {
|
|
7
7
|
this.services = services;
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "langium/lsp";
|
|
6
6
|
import { anyPass } from "remeda";
|
|
7
7
|
import { CompletionItemKind, InsertTextFormat } from "vscode-languageserver-types";
|
|
8
|
-
import { ast } from "../ast.
|
|
8
|
+
import { ast } from "../ast.mjs";
|
|
9
9
|
const STYLE_FIELDS = [
|
|
10
10
|
"color",
|
|
11
11
|
"shape",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AstUtils, GrammarUtils } from "langium";
|
|
2
2
|
import { hasLeadingSlash, hasProtocol, isRelative, joinRelativeURL, withoutBase, withoutLeadingSlash } from "ufo";
|
|
3
|
-
import { ast, isLikeC4LangiumDocument } from "../ast.
|
|
4
|
-
import { logWarnError } from "../logger.
|
|
3
|
+
import { ast, isLikeC4LangiumDocument } from "../ast.mjs";
|
|
4
|
+
import { logWarnError } from "../logger.mjs";
|
|
5
5
|
export class LikeC4DocumentLinkProvider {
|
|
6
6
|
constructor(services) {
|
|
7
7
|
this.services = services;
|
|
@@ -2,9 +2,9 @@ import { nonexhaustive } from "@likec4/core";
|
|
|
2
2
|
import { AstUtils, DocumentState, GrammarUtils } from "langium";
|
|
3
3
|
import { filter, isEmpty, isTruthy, map, pipe } from "remeda";
|
|
4
4
|
import { SymbolKind } from "vscode-languageserver-types";
|
|
5
|
-
import { ast, isLikeC4LangiumDocument } from "../ast.
|
|
6
|
-
import { logger as rootLogger, logWarnError } from "../logger.
|
|
7
|
-
import { readStrictFqn } from "../utils/elementRef.
|
|
5
|
+
import { ast, isLikeC4LangiumDocument } from "../ast.mjs";
|
|
6
|
+
import { logger as rootLogger, logWarnError } from "../logger.mjs";
|
|
7
|
+
import { readStrictFqn } from "../utils/elementRef.mjs";
|
|
8
8
|
const logger = rootLogger.getChild("DocumentSymbolProvider");
|
|
9
9
|
export class LikeC4DocumentSymbolProvider {
|
|
10
10
|
constructor(services) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FqnRef } from "@likec4/core";
|
|
2
2
|
import { AstUtils } from "langium";
|
|
3
3
|
import { AstNodeHoverProvider } from "langium/lsp";
|
|
4
|
-
import { ast } from "../ast.
|
|
4
|
+
import { ast } from "../ast.mjs";
|
|
5
5
|
export class LikeC4HoverProvider extends AstNodeHoverProvider {
|
|
6
6
|
parser;
|
|
7
7
|
locator;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AbstractSemanticTokenProvider } from "langium/lsp";
|
|
2
2
|
import { isTruthy } from "remeda";
|
|
3
3
|
import { SemanticTokenModifiers, SemanticTokenTypes } from "vscode-languageserver-types";
|
|
4
|
-
import { ast } from "../ast.
|
|
4
|
+
import { ast } from "../ast.mjs";
|
|
5
5
|
export class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider {
|
|
6
6
|
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
7
7
|
highlightElement(node, acceptor) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./CodeLensProvider.mjs";
|
|
2
|
+
export * from "./CompletionProvider.mjs";
|
|
3
|
+
export * from "./DocumentHighlightProvider.mjs";
|
|
4
|
+
export * from "./DocumentLinkProvider.mjs";
|
|
5
|
+
export * from "./DocumentSymbolProvider.mjs";
|
|
6
|
+
export * from "./HoverProvider.mjs";
|
|
7
|
+
export * from "./SemanticTokenProvider.mjs";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { loggable } from "@likec4/log";
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
import packageJson from "../../package.json" with { type: "json" };
|
|
4
|
-
import { logger } from "../logger.
|
|
5
|
-
import { findRelationships } from "./tools/find-relationships.
|
|
6
|
-
import { listProjects } from "./tools/list-projects.
|
|
7
|
-
import { openView } from "./tools/open-view.
|
|
8
|
-
import { readDeployment } from "./tools/read-deployment.
|
|
9
|
-
import { readElement } from "./tools/read-element.
|
|
10
|
-
import { readProjectSummary } from "./tools/read-project-summary.
|
|
11
|
-
import { readView } from "./tools/read-view.
|
|
12
|
-
import { searchElement } from "./tools/search-element.
|
|
4
|
+
import { logger } from "../logger.mjs";
|
|
5
|
+
import { findRelationships } from "./tools/find-relationships.mjs";
|
|
6
|
+
import { listProjects } from "./tools/list-projects.mjs";
|
|
7
|
+
import { openView } from "./tools/open-view.mjs";
|
|
8
|
+
import { readDeployment } from "./tools/read-deployment.mjs";
|
|
9
|
+
import { readElement } from "./tools/read-element.mjs";
|
|
10
|
+
import { readProjectSummary } from "./tools/read-project-summary.mjs";
|
|
11
|
+
import { readView } from "./tools/read-view.mjs";
|
|
12
|
+
import { searchElement } from "./tools/search-element.mjs";
|
|
13
13
|
export class LikeC4MCPServerFactory {
|
|
14
14
|
constructor(services) {
|
|
15
15
|
this.services = services;
|
|
@@ -4,7 +4,7 @@ import { loggable } from "@likec4/log";
|
|
|
4
4
|
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
5
5
|
import { toFetchResponse, toReqRes } from "fetch-to-node";
|
|
6
6
|
import { Hono } from "hono";
|
|
7
|
-
import { logger } from "../utils.
|
|
7
|
+
import { logger } from "../utils.mjs";
|
|
8
8
|
export class StreamableLikeC4MCPServer {
|
|
9
9
|
constructor(services, _port = 33335) {
|
|
10
10
|
this.services = services;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { loggable } from "@likec4/log";
|
|
2
2
|
import { isError } from "remeda";
|
|
3
|
-
import { logger } from "../utils.
|
|
4
|
-
import { StdioLikeC4MCPServer } from "./StdioLikeC4MCPServer.
|
|
5
|
-
import { StreamableLikeC4MCPServer } from "./StreamableLikeC4MCPServer.
|
|
3
|
+
import { logger } from "../utils.mjs";
|
|
4
|
+
import { StdioLikeC4MCPServer } from "./StdioLikeC4MCPServer.mjs";
|
|
5
|
+
import { StreamableLikeC4MCPServer } from "./StreamableLikeC4MCPServer.mjs";
|
|
6
6
|
const streamableLikeC4MCPServer = (services, defaultPort = 33335) => {
|
|
7
7
|
logger.debug("Creating StreamableLikeC4MCPServer");
|
|
8
8
|
const server = new StreamableLikeC4MCPServer(services, defaultPort);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { URI } from "vscode-uri";
|
|
2
2
|
import z from "zod";
|
|
3
|
-
import { ProjectsManager } from "../../workspace/index.
|
|
4
|
-
import { logger } from "../utils.
|
|
3
|
+
import { ProjectsManager } from "../../workspace/index.mjs";
|
|
4
|
+
import { logger } from "../utils.mjs";
|
|
5
5
|
export const locationSchema = z.object({
|
|
6
6
|
path: z.string().describe("Path to the file"),
|
|
7
7
|
range: z.object({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { modelConnection } from "@likec4/core/model";
|
|
2
2
|
import { invariant, isSameHierarchy } from "@likec4/core/utils";
|
|
3
3
|
import z from "zod";
|
|
4
|
-
import { likec4Tool } from "../utils.
|
|
5
|
-
import { includedInViews, includedInViewsSchema, locationSchema, mkLocate, projectIdSchema } from "./_common.
|
|
4
|
+
import { likec4Tool } from "../utils.mjs";
|
|
5
|
+
import { includedInViews, includedInViewsSchema, locationSchema, mkLocate, projectIdSchema } from "./_common.mjs";
|
|
6
6
|
const endpointSchema = z.object({
|
|
7
7
|
id: z.string(),
|
|
8
8
|
title: z.string(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import z from "zod";
|
|
2
|
-
import { likec4Tool } from "../utils.
|
|
3
|
-
import { locationSchema, mkLocate, projectIdSchema } from "./_common.
|
|
2
|
+
import { likec4Tool } from "../utils.mjs";
|
|
3
|
+
import { locationSchema, mkLocate, projectIdSchema } from "./_common.mjs";
|
|
4
4
|
export const openView = likec4Tool({
|
|
5
5
|
name: "open-view",
|
|
6
6
|
description: `
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { invariant } from "@likec4/core";
|
|
2
2
|
import z from "zod";
|
|
3
|
-
import { likec4Tool } from "../utils.
|
|
4
|
-
import { includedInViews, includedInViewsSchema, locationSchema, mkLocate, projectIdSchema } from "./_common.
|
|
3
|
+
import { likec4Tool } from "../utils.mjs";
|
|
4
|
+
import { includedInViews, includedInViewsSchema, locationSchema, mkLocate, projectIdSchema } from "./_common.mjs";
|
|
5
5
|
export const readDeployment = likec4Tool({
|
|
6
6
|
name: "read-deployment",
|
|
7
7
|
description: `
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { invariant } from "@likec4/core";
|
|
2
2
|
import z from "zod";
|
|
3
|
-
import { likec4Tool } from "../utils.
|
|
4
|
-
import { includedInViews, includedInViewsSchema, locationSchema, mkLocate, projectIdSchema } from "./_common.
|
|
3
|
+
import { likec4Tool } from "../utils.mjs";
|
|
4
|
+
import { includedInViews, includedInViewsSchema, locationSchema, mkLocate, projectIdSchema } from "./_common.mjs";
|
|
5
5
|
export const readElement = likec4Tool({
|
|
6
6
|
name: "read-element",
|
|
7
7
|
description: `
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { keys } from "remeda";
|
|
2
2
|
import z from "zod";
|
|
3
|
-
import { likec4Tool } from "../utils.
|
|
4
|
-
import { projectIdSchema } from "./_common.
|
|
3
|
+
import { likec4Tool } from "../utils.mjs";
|
|
4
|
+
import { projectIdSchema } from "./_common.mjs";
|
|
5
5
|
export const readProjectSummary = likec4Tool({
|
|
6
6
|
name: "read-project-summary",
|
|
7
7
|
annotations: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import z from "zod";
|
|
2
|
-
import { likec4Tool } from "../utils.
|
|
3
|
-
import { locationSchema, mkLocate, projectIdSchema } from "./_common.
|
|
2
|
+
import { likec4Tool } from "../utils.mjs";
|
|
3
|
+
import { locationSchema, mkLocate, projectIdSchema } from "./_common.mjs";
|
|
4
4
|
const modelRef = (node) => {
|
|
5
5
|
if (node.hasElement()) {
|
|
6
6
|
return node.element.id;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ifilter } from "@likec4/core/utils";
|
|
2
2
|
import z from "zod";
|
|
3
|
-
import { likec4Tool, logger } from "../utils.
|
|
4
|
-
import { includedInViews, includedInViewsSchema } from "./_common.
|
|
3
|
+
import { likec4Tool, logger } from "../utils.mjs";
|
|
4
|
+
import { includedInViews, includedInViewsSchema } from "./_common.mjs";
|
|
5
5
|
const searchResultSchema = z.array(
|
|
6
6
|
z.discriminatedUnion("type", [
|
|
7
7
|
z.object({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { loggable } from "@likec4/log";
|
|
2
|
-
import { logger as mainLogger } from "../logger.
|
|
2
|
+
import { logger as mainLogger } from "../logger.mjs";
|
|
3
3
|
export const logger = mainLogger.getChild("mcp");
|
|
4
4
|
export function likec4Tool(config, cb) {
|
|
5
5
|
const { name, description, ...rest } = config;
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
isNonNullish,
|
|
7
7
|
isNumber
|
|
8
8
|
} from "remeda";
|
|
9
|
-
import { logger, logWarnError } from "../../logger.
|
|
10
|
-
import { assignTagColors } from "./assignTagColors.
|
|
9
|
+
import { logger, logWarnError } from "../../logger.mjs";
|
|
10
|
+
import { assignTagColors } from "./assignTagColors.mjs";
|
|
11
11
|
export class MergedSpecification {
|
|
12
12
|
specs = {
|
|
13
13
|
elements: {},
|
|
@@ -25,10 +25,10 @@ import {
|
|
|
25
25
|
prop,
|
|
26
26
|
reduce
|
|
27
27
|
} from "remeda";
|
|
28
|
-
import { logger } from "../../logger.
|
|
29
|
-
import { resolveRelativePaths } from "../../view-utils/index.
|
|
30
|
-
import { MergedExtends } from "./MergedExtends.
|
|
31
|
-
import { MergedSpecification } from "./MergedSpecification.
|
|
28
|
+
import { logger } from "../../logger.mjs";
|
|
29
|
+
import { resolveRelativePaths } from "../../view-utils/index.mjs";
|
|
30
|
+
import { MergedExtends } from "./MergedExtends.mjs";
|
|
31
|
+
import { MergedSpecification } from "./MergedSpecification.mjs";
|
|
32
32
|
export function buildModelData(project, docs) {
|
|
33
33
|
const c4Specification = new MergedSpecification(docs);
|
|
34
34
|
const customColors = mapValues(
|
|
@@ -4,10 +4,10 @@ import { isDefined, isTruthy } from "remeda";
|
|
|
4
4
|
import {
|
|
5
5
|
ast,
|
|
6
6
|
ElementOps
|
|
7
|
-
} from "../ast.
|
|
8
|
-
import { logWarnError } from "../logger.
|
|
9
|
-
import { readStrictFqn } from "../utils/elementRef.
|
|
10
|
-
import { DocumentFqnIndex, FqnIndex } from "./fqn-index.
|
|
7
|
+
} from "../ast.mjs";
|
|
8
|
+
import { logWarnError } from "../logger.mjs";
|
|
9
|
+
import { readStrictFqn } from "../utils/elementRef.mjs";
|
|
10
|
+
import { DocumentFqnIndex, FqnIndex } from "./fqn-index.mjs";
|
|
11
11
|
export class DeploymentsIndex extends FqnIndex {
|
|
12
12
|
constructor(services) {
|
|
13
13
|
super(services, "deployments-index");
|
|
@@ -12,11 +12,11 @@ import {
|
|
|
12
12
|
ast,
|
|
13
13
|
ElementOps,
|
|
14
14
|
isLikeC4LangiumDocument
|
|
15
|
-
} from "../ast.
|
|
16
|
-
import { logWarnError } from "../logger.
|
|
17
|
-
import { ADisposable } from "../utils/index.
|
|
18
|
-
import { readStrictFqn } from "../utils/elementRef.
|
|
19
|
-
import { ProjectsManager } from "../workspace/index.
|
|
15
|
+
} from "../ast.mjs";
|
|
16
|
+
import { logWarnError } from "../logger.mjs";
|
|
17
|
+
import { ADisposable } from "../utils/index.mjs";
|
|
18
|
+
import { readStrictFqn } from "../utils/elementRef.mjs";
|
|
19
|
+
import { ProjectsManager } from "../workspace/index.mjs";
|
|
20
20
|
export class FqnIndex extends ADisposable {
|
|
21
21
|
constructor(services, cachePrefix = "fqn-index") {
|
|
22
22
|
super();
|
|
@@ -23,11 +23,11 @@ import {
|
|
|
23
23
|
values
|
|
24
24
|
} from "remeda";
|
|
25
25
|
import { CancellationToken } from "vscode-jsonrpc";
|
|
26
|
-
import { isLikeC4Builtin } from "../likec4lib.
|
|
27
|
-
import { logger as mainLogger, logWarnError } from "../logger.
|
|
28
|
-
import { ADisposable, performanceMark } from "../utils/index.
|
|
29
|
-
import { assignNavigateTo } from "../view-utils/index.
|
|
30
|
-
import { buildModelData } from "./builder/buildModel.
|
|
26
|
+
import { isLikeC4Builtin } from "../likec4lib.mjs";
|
|
27
|
+
import { logger as mainLogger, logWarnError } from "../logger.mjs";
|
|
28
|
+
import { ADisposable, performanceMark } from "../utils/index.mjs";
|
|
29
|
+
import { assignNavigateTo } from "../view-utils/index.mjs";
|
|
30
|
+
import { buildModelData } from "./builder/buildModel.mjs";
|
|
31
31
|
const parsedWithoutImportsCacheKey = (projectId) => `parsed-without-imports-${projectId}`;
|
|
32
32
|
const parsedModelCacheKey = (projectId) => `parsed-model-${projectId}`;
|
|
33
33
|
const computedModelCacheKey = (projectId) => `computed-model-${projectId}`;
|
|
@@ -3,10 +3,10 @@ import { ifilter, invariant, toArray } from "@likec4/core/utils";
|
|
|
3
3
|
import { loggable } from "@likec4/log";
|
|
4
4
|
import { AstUtils, DocumentState, GrammarUtils } from "langium";
|
|
5
5
|
import { flatMap, isString, pipe } from "remeda";
|
|
6
|
-
import { ast, isLikeC4LangiumDocument } from "../ast.
|
|
7
|
-
import { logger as serverLogger } from "../logger.
|
|
8
|
-
import { projectIdFrom } from "../utils/index.
|
|
9
|
-
import { MergedSpecification } from "./builder/MergedSpecification.
|
|
6
|
+
import { ast, isLikeC4LangiumDocument } from "../ast.mjs";
|
|
7
|
+
import { logger as serverLogger } from "../logger.mjs";
|
|
8
|
+
import { projectIdFrom } from "../utils/index.mjs";
|
|
9
|
+
import { MergedSpecification } from "./builder/MergedSpecification.mjs";
|
|
10
10
|
const { findNodeForKeyword, findNodeForProperty } = GrammarUtils;
|
|
11
11
|
const { getDocument, streamAllContents } = AstUtils;
|
|
12
12
|
const logger = serverLogger.getChild("ModelLocator");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { invariant, isNonEmptyArray, nonexhaustive } from "@likec4/core";
|
|
2
2
|
import { isAndOperator, isOrOperator } from "@likec4/core";
|
|
3
|
-
import { ast } from "../ast.
|
|
3
|
+
import { ast } from "../ast.mjs";
|
|
4
4
|
const parseEquals = ({ operator, not }, value) => {
|
|
5
5
|
if (operator.startsWith("!=")) {
|
|
6
6
|
return {
|
|
@@ -3,19 +3,19 @@ import { loggable } from "@likec4/log";
|
|
|
3
3
|
import { DocumentState } from "langium";
|
|
4
4
|
import { pipe } from "remeda";
|
|
5
5
|
import { DiagnosticSeverity } from "vscode-languageserver-types";
|
|
6
|
-
import { isLikeC4LangiumDocument } from "../ast.
|
|
7
|
-
import { isLikeC4Builtin } from "../likec4lib.
|
|
8
|
-
import { logger as rootLogger } from "../logger.
|
|
9
|
-
import { BaseParser } from "./parser/Base.
|
|
10
|
-
import { DeploymentModelParser } from "./parser/DeploymentModelParser.
|
|
11
|
-
import { DeploymentViewParser } from "./parser/DeploymentViewParser.
|
|
12
|
-
import { ExpressionV2Parser } from "./parser/FqnRefParser.
|
|
13
|
-
import { GlobalsParser } from "./parser/GlobalsParser.
|
|
14
|
-
import { ImportsParser } from "./parser/ImportsParser.
|
|
15
|
-
import { ModelParser } from "./parser/ModelParser.
|
|
16
|
-
import { PredicatesParser } from "./parser/PredicatesParser.
|
|
17
|
-
import { SpecificationParser } from "./parser/SpecificationParser.
|
|
18
|
-
import { ViewsParser } from "./parser/ViewsParser.
|
|
6
|
+
import { isLikeC4LangiumDocument } from "../ast.mjs";
|
|
7
|
+
import { isLikeC4Builtin } from "../likec4lib.mjs";
|
|
8
|
+
import { logger as rootLogger } from "../logger.mjs";
|
|
9
|
+
import { BaseParser } from "./parser/Base.mjs";
|
|
10
|
+
import { DeploymentModelParser } from "./parser/DeploymentModelParser.mjs";
|
|
11
|
+
import { DeploymentViewParser } from "./parser/DeploymentViewParser.mjs";
|
|
12
|
+
import { ExpressionV2Parser } from "./parser/FqnRefParser.mjs";
|
|
13
|
+
import { GlobalsParser } from "./parser/GlobalsParser.mjs";
|
|
14
|
+
import { ImportsParser } from "./parser/ImportsParser.mjs";
|
|
15
|
+
import { ModelParser } from "./parser/ModelParser.mjs";
|
|
16
|
+
import { PredicatesParser } from "./parser/PredicatesParser.mjs";
|
|
17
|
+
import { SpecificationParser } from "./parser/SpecificationParser.mjs";
|
|
18
|
+
import { ViewsParser } from "./parser/ViewsParser.mjs";
|
|
19
19
|
const DocumentParserFromMixins = pipe(
|
|
20
20
|
BaseParser,
|
|
21
21
|
ExpressionV2Parser,
|
|
@@ -22,11 +22,11 @@ import {
|
|
|
22
22
|
parseAstSizeValue,
|
|
23
23
|
parseMarkdownAsString,
|
|
24
24
|
toColor
|
|
25
|
-
} from "../../ast.
|
|
26
|
-
import { logger } from "../../logger.
|
|
27
|
-
import { projectIdFrom } from "../../utils/index.
|
|
28
|
-
import { readStrictFqn } from "../../utils/elementRef.
|
|
29
|
-
import { checksFromDiagnostics } from "../../validation/index.
|
|
25
|
+
} from "../../ast.mjs";
|
|
26
|
+
import { logger } from "../../logger.mjs";
|
|
27
|
+
import { projectIdFrom } from "../../utils/index.mjs";
|
|
28
|
+
import { readStrictFqn } from "../../utils/elementRef.mjs";
|
|
29
|
+
import { checksFromDiagnostics } from "../../validation/index.mjs";
|
|
30
30
|
export function toSingleLine(str) {
|
|
31
31
|
if (str === null || str === void 0) {
|
|
32
32
|
return void 0;
|
|
@@ -3,9 +3,9 @@ import { filter, first, isDefined, isEmpty, isTruthy, map, mapToObj, pipe } from
|
|
|
3
3
|
import {
|
|
4
4
|
ast,
|
|
5
5
|
toRelationshipStyleExcludeDefaults
|
|
6
|
-
} from "../../ast.
|
|
7
|
-
import { logWarnError } from "../../logger.
|
|
8
|
-
import { stringHash } from "../../utils/stringHash.
|
|
6
|
+
} from "../../ast.mjs";
|
|
7
|
+
import { logWarnError } from "../../logger.mjs";
|
|
8
|
+
import { stringHash } from "../../utils/stringHash.mjs";
|
|
9
9
|
function* streamDeploymentModel(doc) {
|
|
10
10
|
const traverseStack = LinkedList.from(
|
|
11
11
|
doc.parseResult.value.deployments.flatMap((m) => m.elements)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as c4 from "@likec4/core";
|
|
2
2
|
import { invariant, isNonEmptyArray, nonexhaustive } from "@likec4/core";
|
|
3
3
|
import { filter, isNonNullish, mapToObj, pipe } from "remeda";
|
|
4
|
-
import { ast, parseMarkdownAsString, toAutoLayout, ViewOps } from "../../ast.
|
|
5
|
-
import { logWarnError } from "../../logger.
|
|
6
|
-
import { stringHash } from "../../utils/index.
|
|
7
|
-
import { parseViewManualLayout } from "../../view-utils/manual-layout.
|
|
8
|
-
import { removeIndent, toSingleLine } from "./Base.
|
|
4
|
+
import { ast, parseMarkdownAsString, toAutoLayout, ViewOps } from "../../ast.mjs";
|
|
5
|
+
import { logWarnError } from "../../logger.mjs";
|
|
6
|
+
import { stringHash } from "../../utils/index.mjs";
|
|
7
|
+
import { parseViewManualLayout } from "../../view-utils/manual-layout.mjs";
|
|
8
|
+
import { removeIndent, toSingleLine } from "./Base.mjs";
|
|
9
9
|
export function DeploymentViewParser(B) {
|
|
10
10
|
return class DeploymentViewParser extends B {
|
|
11
11
|
parseDeploymentView(astNode) {
|