@typespec/prettier-plugin-typespec 0.62.0-dev.1 → 0.62.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 +51 -16
- package/dist/index.js.map +1 -1
- package/package.json +4 -5
package/dist/index.js
CHANGED
|
@@ -76,6 +76,15 @@ function binarySearch(array, value) {
|
|
|
76
76
|
return ~low;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
var ResolutionResultFlags;
|
|
80
|
+
(function (ResolutionResultFlags) {
|
|
81
|
+
ResolutionResultFlags[ResolutionResultFlags["None"] = 0] = "None";
|
|
82
|
+
ResolutionResultFlags[ResolutionResultFlags["Resolved"] = 2] = "Resolved";
|
|
83
|
+
ResolutionResultFlags[ResolutionResultFlags["Unknown"] = 4] = "Unknown";
|
|
84
|
+
ResolutionResultFlags[ResolutionResultFlags["Ambiguous"] = 8] = "Ambiguous";
|
|
85
|
+
ResolutionResultFlags[ResolutionResultFlags["NotFound"] = 16] = "NotFound";
|
|
86
|
+
ResolutionResultFlags[ResolutionResultFlags["ResolutionFailed"] = 28] = "ResolutionFailed";
|
|
87
|
+
})(ResolutionResultFlags || (ResolutionResultFlags = {}));
|
|
79
88
|
/**
|
|
80
89
|
* AST types
|
|
81
90
|
*/
|
|
@@ -596,18 +605,6 @@ const diagnostics = {
|
|
|
596
605
|
default: paramMessage `Intersection contains duplicate property definitions for ${"propName"}`,
|
|
597
606
|
},
|
|
598
607
|
},
|
|
599
|
-
"unknown-identifier": {
|
|
600
|
-
severity: "error",
|
|
601
|
-
messages: {
|
|
602
|
-
default: paramMessage `Unknown identifier ${"id"}`,
|
|
603
|
-
},
|
|
604
|
-
},
|
|
605
|
-
"unknown-decorator": {
|
|
606
|
-
severity: "error",
|
|
607
|
-
messages: {
|
|
608
|
-
default: "Unknown decorator",
|
|
609
|
-
},
|
|
610
|
-
},
|
|
611
608
|
"invalid-decorator": {
|
|
612
609
|
severity: "error",
|
|
613
610
|
messages: {
|
|
@@ -618,9 +615,11 @@ const diagnostics = {
|
|
|
618
615
|
severity: "error",
|
|
619
616
|
messages: {
|
|
620
617
|
default: paramMessage `Cannot resolve ${"id"}`,
|
|
618
|
+
identifier: paramMessage `Unknown identifier ${"id"}`,
|
|
619
|
+
decorator: paramMessage `Unknown decorator @${"id"}`,
|
|
621
620
|
inDecorator: paramMessage `Cannot resolve ${"id"} in decorator`,
|
|
622
621
|
underNamespace: paramMessage `Namespace ${"namespace"} doesn't have member ${"id"}`,
|
|
623
|
-
|
|
622
|
+
member: paramMessage `${"kind"} doesn't have member ${"id"}`,
|
|
624
623
|
metaProperty: paramMessage `${"kind"} doesn't have meta property ${"id"}`,
|
|
625
624
|
node: paramMessage `Cannot resolve '${"id"}' in node ${"nodeName"} since it has no members. Did you mean to use "::" instead of "."?`,
|
|
626
625
|
},
|
|
@@ -1007,7 +1006,13 @@ const diagnostics = {
|
|
|
1007
1006
|
"invalid-emitter": {
|
|
1008
1007
|
severity: "error",
|
|
1009
1008
|
messages: {
|
|
1010
|
-
default: paramMessage `Requested emitter package ${"emitterPackage"} does not provide an "onEmit" function.`,
|
|
1009
|
+
default: paramMessage `Requested emitter package ${"emitterPackage"} does not provide an "$onEmit" function.`,
|
|
1010
|
+
},
|
|
1011
|
+
},
|
|
1012
|
+
"js-error": {
|
|
1013
|
+
severity: "error",
|
|
1014
|
+
messages: {
|
|
1015
|
+
default: paramMessage `Failed to load ${"specifier"} due to the following JS error: ${"error"}`,
|
|
1011
1016
|
},
|
|
1012
1017
|
},
|
|
1013
1018
|
"missing-import": {
|
|
@@ -1158,6 +1163,32 @@ const diagnostics = {
|
|
|
1158
1163
|
duplicate: paramMessage `Same encoded name '${"name"}' is used for 2 members '${"mimeType"}'`,
|
|
1159
1164
|
},
|
|
1160
1165
|
},
|
|
1166
|
+
"incompatible-paging-props": {
|
|
1167
|
+
severity: "error",
|
|
1168
|
+
messages: {
|
|
1169
|
+
default: paramMessage `Paging property has multiple types: '${"kinds"}'`,
|
|
1170
|
+
},
|
|
1171
|
+
},
|
|
1172
|
+
"invalid-paging-prop": {
|
|
1173
|
+
severity: "error",
|
|
1174
|
+
messages: {
|
|
1175
|
+
default: paramMessage `Paging property '${"kind"}' is not valid in this context.`,
|
|
1176
|
+
input: paramMessage `Paging property '${"kind"}' cannot be used in the parameters of an operation.`,
|
|
1177
|
+
output: paramMessage `Paging property '${"kind"}' cannot be used in the return type of an operation.`,
|
|
1178
|
+
},
|
|
1179
|
+
},
|
|
1180
|
+
"duplicate-paging-prop": {
|
|
1181
|
+
severity: "error",
|
|
1182
|
+
messages: {
|
|
1183
|
+
default: paramMessage `Duplicate property paging '${"kind"}' for operation ${"operationName"}.`,
|
|
1184
|
+
},
|
|
1185
|
+
},
|
|
1186
|
+
"missing-paging-items": {
|
|
1187
|
+
severity: "error",
|
|
1188
|
+
messages: {
|
|
1189
|
+
default: paramMessage `Paged operation '${"operationName"}' return type must have a property annotated with @pageItems.`,
|
|
1190
|
+
},
|
|
1191
|
+
},
|
|
1161
1192
|
/**
|
|
1162
1193
|
* Service
|
|
1163
1194
|
*/
|
|
@@ -1285,9 +1316,13 @@ function getSourceLocation(target, options = {}) {
|
|
|
1285
1316
|
if ("file" in target) {
|
|
1286
1317
|
return target;
|
|
1287
1318
|
}
|
|
1288
|
-
if (!("kind" in target) && !("
|
|
1319
|
+
if (!("kind" in target) && !("entityKind" in target)) {
|
|
1320
|
+
// TemplateInstanceTarget
|
|
1321
|
+
if (!("declarations" in target)) {
|
|
1322
|
+
return getSourceLocationOfNode(target.node, options);
|
|
1323
|
+
}
|
|
1289
1324
|
// symbol
|
|
1290
|
-
if (target.flags &
|
|
1325
|
+
if (target.flags & 32768 /* SymbolFlags.Using */) {
|
|
1291
1326
|
target = target.symbolSource;
|
|
1292
1327
|
}
|
|
1293
1328
|
if (!target.declarations[0]) {
|