@typespec/prettier-plugin-typespec 1.5.0-dev.0 → 1.6.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 +15 -18
- package/dist/index.js.map +2 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -179,33 +179,30 @@ var ListenerFlow;
|
|
|
179
179
|
})(ListenerFlow || (ListenerFlow = {}));
|
|
180
180
|
|
|
181
181
|
// ../compiler/dist/src/core/diagnostics.js
|
|
182
|
-
function
|
|
183
|
-
if (target === NoTarget || target === void 0) {
|
|
184
|
-
return void 0;
|
|
185
|
-
}
|
|
186
|
-
if ("file" in target) {
|
|
187
|
-
return target;
|
|
188
|
-
}
|
|
182
|
+
function getNodeForTarget(target) {
|
|
189
183
|
if (!("kind" in target) && !("entityKind" in target)) {
|
|
190
184
|
if (!("declarations" in target)) {
|
|
191
|
-
return
|
|
185
|
+
return target.node;
|
|
192
186
|
}
|
|
193
187
|
if (target.flags & 8192) {
|
|
194
188
|
target = target.symbolSource;
|
|
195
189
|
}
|
|
196
|
-
|
|
197
|
-
return createSyntheticSourceLocation();
|
|
198
|
-
}
|
|
199
|
-
return getSourceLocationOfNode(target.declarations[0], options);
|
|
190
|
+
return target.declarations[0];
|
|
200
191
|
} else if ("kind" in target && typeof target.kind === "number") {
|
|
201
|
-
return
|
|
192
|
+
return target;
|
|
202
193
|
} else {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
194
|
+
return target.node;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function getSourceLocation(target, options = {}) {
|
|
198
|
+
if (target === NoTarget || target === void 0) {
|
|
199
|
+
return void 0;
|
|
200
|
+
}
|
|
201
|
+
if ("file" in target) {
|
|
202
|
+
return target;
|
|
208
203
|
}
|
|
204
|
+
const node = getNodeForTarget(target);
|
|
205
|
+
return node ? getSourceLocationOfNode(node, options) : createSyntheticSourceLocation();
|
|
209
206
|
}
|
|
210
207
|
function createSyntheticSourceLocation(loc = "<unknown location>") {
|
|
211
208
|
return {
|