From 7789b8bfd95b94694c4af4456720bca7f43780bf Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Sat, 7 Jan 2023 13:11:16 -0500 Subject: [PATCH] decomp: allow casting custom types via `__custom` (#184) --- src/decomp/type-caster.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/decomp/type-caster.ts b/src/decomp/type-caster.ts index c589d4c..cb25f3f 100644 --- a/src/decomp/type-caster.ts +++ b/src/decomp/type-caster.ts @@ -217,6 +217,15 @@ function generateCastSelectionItems( }); } } + items.unshift( + { + label: "Custom Types", + kind: vscode.QuickPickItemKind.Separator, + }, + { + label: "__custom", + } + ); return items; } @@ -270,6 +279,11 @@ async function labelCastSelection() { title: "Cast to Type?", }) )?.label; + if (castToType === "__custom") { + castToType = await vscode.window.showInputBox({ + title: "Cast to Type?", + }); + } } else { castToType = await vscode.window.showInputBox({ title: "Cast to Type?", @@ -382,6 +396,11 @@ async function stackCastSelection() { title: "Cast to Type?", }) )?.label; + if (castToType === "__custom") { + castToType = await vscode.window.showInputBox({ + title: "Cast to Type?", + }); + } } else { castToType = await vscode.window.showInputBox({ title: "Cast to Type?", @@ -528,6 +547,11 @@ async function typeCastSelection() { title: "Cast to Type?", }) )?.label; + if (castToType === "__custom") { + castToType = await vscode.window.showInputBox({ + title: "Cast to Type?", + }); + } } else { castToType = await vscode.window.showInputBox({ title: "Cast to Type?",