@typespec/prettier-plugin-typespec 0.44.0 → 0.45.0-dev.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/index.js +23 -12
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -1020,6 +1020,21 @@ const diagnostics = {
|
|
|
1020
1020
|
default: paramMessage `${"message"}`,
|
|
1021
1021
|
},
|
|
1022
1022
|
},
|
|
1023
|
+
/**
|
|
1024
|
+
* Init templates
|
|
1025
|
+
*/
|
|
1026
|
+
"init-template-invalid-json": {
|
|
1027
|
+
severity: "error",
|
|
1028
|
+
messages: {
|
|
1029
|
+
default: paramMessage `Unable to parse ${"url"}: ${"message"}. Check that the template URL is correct.`,
|
|
1030
|
+
},
|
|
1031
|
+
},
|
|
1032
|
+
"init-template-download-failed": {
|
|
1033
|
+
severity: "error",
|
|
1034
|
+
messages: {
|
|
1035
|
+
default: paramMessage `Failed to download template from ${"url"}: ${"message"}. Check that the template URL is correct.`,
|
|
1036
|
+
},
|
|
1037
|
+
},
|
|
1023
1038
|
/**
|
|
1024
1039
|
* Parser errors.
|
|
1025
1040
|
*/
|
|
@@ -1511,12 +1526,6 @@ const diagnostics = {
|
|
|
1511
1526
|
default: paramMessage `Requested emitter package ${"emitterPackage"} does not provide an "onEmit" function.`,
|
|
1512
1527
|
},
|
|
1513
1528
|
},
|
|
1514
|
-
"emitter-not-found": {
|
|
1515
|
-
severity: "warning",
|
|
1516
|
-
messages: {
|
|
1517
|
-
default: paramMessage `Emitter with name ${"emitterName"} is not found.`,
|
|
1518
|
-
},
|
|
1519
|
-
},
|
|
1520
1529
|
"missing-import": {
|
|
1521
1530
|
severity: "error",
|
|
1522
1531
|
messages: {
|
|
@@ -1604,8 +1613,8 @@ const diagnostics = {
|
|
|
1604
1613
|
severity: "error",
|
|
1605
1614
|
messages: {
|
|
1606
1615
|
default: "Invalid encoding",
|
|
1607
|
-
wrongType: paramMessage `Encoding '${"encoding"}' cannot be used on type ${"type"}. Expected
|
|
1608
|
-
wrongEncodingType: paramMessage `Encoding '${"encoding"}'
|
|
1616
|
+
wrongType: paramMessage `Encoding '${"encoding"}' cannot be used on type '${"type"}'. Expected: ${"expected"}.`,
|
|
1617
|
+
wrongEncodingType: paramMessage `Encoding '${"encoding"}' on type '${"type"}' is expected to be serialized as '${"expected"}' but got '${"actual"}'.`,
|
|
1609
1618
|
},
|
|
1610
1619
|
},
|
|
1611
1620
|
/**
|
|
@@ -2948,6 +2957,7 @@ function addStatementDecoratorComment(comment) {
|
|
|
2948
2957
|
(enclosingNode.kind === SyntaxKind.NamespaceStatement ||
|
|
2949
2958
|
enclosingNode.kind === SyntaxKind.ModelStatement ||
|
|
2950
2959
|
enclosingNode.kind === SyntaxKind.EnumStatement ||
|
|
2960
|
+
enclosingNode.kind === SyntaxKind.OperationStatement ||
|
|
2951
2961
|
enclosingNode.kind === SyntaxKind.ModelProperty ||
|
|
2952
2962
|
enclosingNode.kind === SyntaxKind.EnumMember ||
|
|
2953
2963
|
enclosingNode.kind === SyntaxKind.UnionStatement)) {
|
|
@@ -5057,12 +5067,13 @@ function createParser(code, options = {}) {
|
|
|
5057
5067
|
}
|
|
5058
5068
|
function parseNumericLiteral() {
|
|
5059
5069
|
const pos = tokenPos();
|
|
5060
|
-
const
|
|
5061
|
-
const value = Number(
|
|
5070
|
+
const valueAsString = tokenValue();
|
|
5071
|
+
const value = Number(valueAsString);
|
|
5062
5072
|
parseExpected(Token.NumericLiteral);
|
|
5063
5073
|
return {
|
|
5064
5074
|
kind: SyntaxKind.NumericLiteral,
|
|
5065
5075
|
value,
|
|
5076
|
+
valueAsString,
|
|
5066
5077
|
...finishNode(pos),
|
|
5067
5078
|
};
|
|
5068
5079
|
}
|
|
@@ -5797,7 +5808,7 @@ function createParser(code, options = {}) {
|
|
|
5797
5808
|
};
|
|
5798
5809
|
}
|
|
5799
5810
|
function parseDocList() {
|
|
5800
|
-
if (docRanges.length === 0 ||
|
|
5811
|
+
if (docRanges.length === 0 || options.docs === false) {
|
|
5801
5812
|
return [tokenPos(), []];
|
|
5802
5813
|
}
|
|
5803
5814
|
const docs = [];
|
|
@@ -6317,7 +6328,7 @@ function isBlocklessNamespace(node) {
|
|
|
6317
6328
|
}
|
|
6318
6329
|
|
|
6319
6330
|
function parse(text, parsers, opts) {
|
|
6320
|
-
const result = parse$1(text, { comments: true });
|
|
6331
|
+
const result = parse$1(text, { comments: true, docs: false });
|
|
6321
6332
|
const errors = result.parseDiagnostics.filter((x) => x.severity === "error");
|
|
6322
6333
|
if (errors.length > 0 && !result.printable) {
|
|
6323
6334
|
throw new PrettierParserError(errors[0]);
|