@likec4/language-server 1.33.0 → 1.34.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/README.md +27 -1
- package/dist/Rpc.d.ts +2 -0
- package/dist/Rpc.js +24 -6
- package/dist/bundled.mjs +2747 -2892
- package/dist/formatting/LikeC4Formatter.d.ts +1 -0
- package/dist/formatting/LikeC4Formatter.js +25 -1
- package/dist/generated/ast.d.ts +1 -1
- package/dist/generated/ast.js +5 -5
- package/dist/generated/grammar.js +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -2
- package/dist/mcp/{LikeC4MCPServerFactory.d.ts → NoopLikeC4MCPServer.d.ts} +1 -9
- package/dist/mcp/interfaces.d.ts +11 -0
- package/dist/mcp/interfaces.js +0 -0
- package/dist/mcp/sseserver/MCPServer.d.ts +1 -1
- package/dist/mcp/sseserver/MCPServer.js +5 -5
- package/dist/mcp/sseserver/MCPServerFactory.js +30 -58
- package/dist/mcp/sseserver/{with-mcp-server.d.ts → WithMCPServer.d.ts} +1 -1
- package/dist/mcp/tools/_common.d.ts +68 -0
- package/dist/mcp/tools/_common.js +14 -0
- package/dist/mcp/tools/list-projects.d.ts +6 -0
- package/dist/mcp/tools/list-projects.js +31 -0
- package/dist/mcp/tools/open-view.d.ts +10 -0
- package/dist/mcp/tools/open-view.js +29 -0
- package/dist/mcp/tools/read-element.d.ts +10 -0
- package/dist/mcp/tools/read-element.js +135 -0
- package/dist/mcp/tools/read-project-elements.d.ts +8 -0
- package/dist/mcp/tools/read-project-elements.js +93 -0
- package/dist/mcp/tools/read-project-summary.d.ts +8 -0
- package/dist/mcp/tools/read-project-summary.js +68 -0
- package/dist/mcp/tools/read-view.d.ts +10 -0
- package/dist/mcp/tools/read-view.js +164 -0
- package/dist/mcp/tools/search-element.d.ts +8 -0
- package/dist/mcp/tools/search-element.js +105 -0
- package/dist/mcp/utils.d.ts +17 -34
- package/dist/mcp/utils.js +41 -101
- package/dist/model/model-parser-where.d.ts +1 -0
- package/dist/model/model-parser-where.js +30 -24
- package/dist/model/model-parser.d.ts +14 -0
- package/dist/model/parser/DeploymentModelParser.d.ts +3 -1
- package/dist/model/parser/DeploymentViewParser.d.ts +3 -1
- package/dist/model/parser/FqnRefParser.d.ts +3 -1
- package/dist/model/parser/FqnRefParser.js +34 -10
- package/dist/model/parser/GlobalsParser.d.ts +3 -1
- package/dist/model/parser/ModelParser.d.ts +3 -1
- package/dist/model/parser/PredicatesParser.d.ts +3 -1
- package/dist/model/parser/ViewsParser.d.ts +3 -1
- package/dist/module.d.ts +1 -3
- package/dist/module.js +1 -6
- package/dist/protocol.d.ts +16 -0
- package/dist/protocol.js +4 -0
- package/dist/validation/property-checks.js +1 -1
- package/dist/views/likec4-views.d.ts +5 -0
- package/dist/views/likec4-views.js +6 -0
- package/package.json +8 -8
- package/dist/mcp/LikeC4MCPTools.d.ts +0 -96
- package/dist/mcp/LikeC4MCPTools.js +0 -293
- /package/dist/mcp/{LikeC4MCPServerFactory.js → NoopLikeC4MCPServer.js} +0 -0
- /package/dist/mcp/sseserver/{with-mcp-server.js → WithMCPServer.js} +0 -0
|
@@ -52,6 +52,7 @@ export declare class LikeC4Formatter extends AbstractFormatter {
|
|
|
52
52
|
private doExtendedFormatting;
|
|
53
53
|
protected normalizeQuotes(node: AstNode): void;
|
|
54
54
|
private quotesNormalizerFactory;
|
|
55
|
+
private escapeQuotesInternalQuotes;
|
|
55
56
|
private getAutoQuoteStyle;
|
|
56
57
|
private onConfigurationUpdate;
|
|
57
58
|
}
|
|
@@ -429,11 +429,35 @@ export class LikeC4Formatter extends AbstractFormatter {
|
|
|
429
429
|
const quotesToInsert = quoteStyle === "single" ? "'" : '"';
|
|
430
430
|
const newEdits = command.region.nodes.map((node) => ({
|
|
431
431
|
range: node.range,
|
|
432
|
-
newText:
|
|
432
|
+
newText: quotesToInsert + this.escapeQuotesInternalQuotes(
|
|
433
|
+
node.text.slice(1, -1),
|
|
434
|
+
quotesToReplace,
|
|
435
|
+
quotesToInsert
|
|
436
|
+
) + quotesToInsert
|
|
433
437
|
}));
|
|
434
438
|
edits.push(...newEdits);
|
|
435
439
|
};
|
|
436
440
|
}
|
|
441
|
+
escapeQuotesInternalQuotes(text, quotesToReplace, quoteToInsert) {
|
|
442
|
+
let result = "";
|
|
443
|
+
let start = 0;
|
|
444
|
+
while (start >= 0) {
|
|
445
|
+
let pos = text.indexOf(quoteToInsert, start);
|
|
446
|
+
if (pos < 0) {
|
|
447
|
+
result += text.slice(start);
|
|
448
|
+
break;
|
|
449
|
+
}
|
|
450
|
+
result += text.slice(start, pos);
|
|
451
|
+
start = pos + 1;
|
|
452
|
+
let escaped = false;
|
|
453
|
+
while (pos > 0 && text[pos - 1] == "\\") {
|
|
454
|
+
escaped = !escaped;
|
|
455
|
+
pos--;
|
|
456
|
+
}
|
|
457
|
+
result += escaped ? quoteToInsert : `\\${quoteToInsert}`;
|
|
458
|
+
}
|
|
459
|
+
return result;
|
|
460
|
+
}
|
|
437
461
|
getAutoQuoteStyle(commands) {
|
|
438
462
|
const nodes = commands.flatMap((x) => x.region.nodes);
|
|
439
463
|
const doubleQuotesCount = nodes.filter((x) => x.text[0] == '"').length;
|
package/dist/generated/ast.d.ts
CHANGED
|
@@ -24,8 +24,8 @@ export declare const LikeC4Terminals: {
|
|
|
24
24
|
String: RegExp;
|
|
25
25
|
Float: RegExp;
|
|
26
26
|
Number: RegExp;
|
|
27
|
-
Hex: RegExp;
|
|
28
27
|
IdTerminal: RegExp;
|
|
28
|
+
Hex: RegExp;
|
|
29
29
|
};
|
|
30
30
|
export type LikeC4TerminalNames = keyof typeof LikeC4Terminals;
|
|
31
31
|
export type LikeC4KeywordNames = "(" | ")" | "*" | "," | "->" | "-[" | ":" | ";" | "<-" | "<->" | "BottomTop" | "LeftRight" | "RightLeft" | "TopBottom" | "]->" | "amber" | "and" | "autoLayout" | "blue" | "border" | "browser" | "color" | "crow" | "cylinder" | "dashed" | "deployment" | "deploymentNode" | "description" | "diamond" | "dot" | "dotted" | "dynamic" | "dynamicPredicateGroup" | "element" | "element.kind" | "element.tag" | "exclude" | "extend" | "extends" | "from" | "global" | "gray" | "green" | "group" | "head" | "icon" | "icons" | "import" | "include" | "indigo" | "instance" | "instanceOf" | "is" | "kind" | "large" | "lg" | "likec4lib" | "line" | "link" | "md" | "medium" | "metadata" | "mobile" | "model" | "multiple" | "muted" | "navigateTo" | "node" | "none" | "normal" | "not" | "notation" | "notes" | "odiamond" | "odot" | "of" | "onormal" | "opacity" | "open" | "or" | "padding" | "par" | "parallel" | "person" | "predicate" | "predicateGroup" | "primary" | "queue" | "rectangle" | "red" | "relationship" | "rgb" | "rgba" | "secondary" | "shape" | "size" | "sky" | "slate" | "sm" | "small" | "solid" | "source" | "specification" | "storage" | "style" | "styleGroup" | "tag" | "tail" | "target" | "technology" | "textSize" | "title" | "vee" | "view" | "views" | "where" | "with" | "xl" | "xlarge" | "xs" | "xsmall" | "{" | "}";
|
package/dist/generated/ast.js
CHANGED
|
@@ -4,7 +4,7 @@ export const LikeC4Terminals = {
|
|
|
4
4
|
LINE_COMMENT: /\/\/[^\n\r]*/,
|
|
5
5
|
WS: /[\t ]+/,
|
|
6
6
|
NL: /[\r\n]+/,
|
|
7
|
-
BOOLEAN:
|
|
7
|
+
BOOLEAN: /\b(true|false)\b/,
|
|
8
8
|
LIB_ICON: /(aws|azure|gcp|tech):[-\w]*/,
|
|
9
9
|
URI_WITH_SCHEMA: /\w+:\/{2}\S+/,
|
|
10
10
|
URI_RELATIVE: /\.{0,2}\/[^\/]\S+/,
|
|
@@ -20,8 +20,8 @@ export const LikeC4Terminals = {
|
|
|
20
20
|
String: /"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/,
|
|
21
21
|
Float: /\b\d+\.\d+\b/,
|
|
22
22
|
Number: /\b\d+\b/,
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
IdTerminal: /[_]*[a-zA-Z][-\w]*/,
|
|
24
|
+
Hex: /[a-fA-F0-9]{3,}(?![-_g-zG-Z])/
|
|
25
25
|
};
|
|
26
26
|
export function isArrowType(item) {
|
|
27
27
|
return item === "none" || item === "normal" || item === "onormal" || item === "dot" || item === "odot" || item === "diamond" || item === "odiamond" || item === "crow" || item === "open" || item === "vee";
|
|
@@ -34,7 +34,7 @@ export function isColorLiteral(item) {
|
|
|
34
34
|
return reflection.isInstance(item, ColorLiteral);
|
|
35
35
|
}
|
|
36
36
|
export function isCustomColorId(item) {
|
|
37
|
-
return isElementShape(item) || isArrowType(item) || isLineOptions(item) || item === "element" || item === "model" || typeof item === "string" &&
|
|
37
|
+
return isElementShape(item) || isArrowType(item) || isLineOptions(item) || item === "element" || item === "model" || typeof item === "string" && /[_]*[a-zA-Z][-\w]*/.test(item);
|
|
38
38
|
}
|
|
39
39
|
export const DeploymentElement = "DeploymentElement";
|
|
40
40
|
export function isDeploymentElement(item) {
|
|
@@ -87,7 +87,7 @@ export function isIconId(item) {
|
|
|
87
87
|
return typeof item === "string" && /(aws|azure|gcp|tech):[-\w]*/.test(item);
|
|
88
88
|
}
|
|
89
89
|
export function isId(item) {
|
|
90
|
-
return isElementShape(item) || isThemeColor(item) || isArrowType(item) || isLineOptions(item) || isParticipant(item) || isSizeValue(item) || item === "element" || item === "model" || item === "group" || item === "node" || item === "deployment" || item === "instance" || typeof item === "string" &&
|
|
90
|
+
return isElementShape(item) || isThemeColor(item) || isArrowType(item) || isLineOptions(item) || isParticipant(item) || isSizeValue(item) || item === "element" || item === "model" || item === "group" || item === "node" || item === "deployment" || item === "instance" || typeof item === "string" && /[_]*[a-zA-Z][-\w]*/.test(item);
|
|
91
91
|
}
|
|
92
92
|
export const LikeC4View = "LikeC4View";
|
|
93
93
|
export function isLikeC4View(item) {
|