Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decomp: remove popup error for decomp failure and type-cast auto-populator #191

Merged
merged 2 commits into from
Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions src/decomp/decomp-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,26 @@ const decompStatusItem = vscode.window.createStatusBarItem(
enum DecompStatus {
Idle,
Running,
Errored,
}

function updateStatus(status: DecompStatus, metadata?: any) {
let subText = "";
switch (status) {
case DecompStatus.Errored:
decompStatusItem.tooltip = "Toggle Auto-Decomp";
decompStatusItem.command = "opengoal.decomp.toggleAutoDecompilation";
decompStatusItem.text = "$(testing-error-icon) Decomp Failed";
break;
case DecompStatus.Idle:
decompStatusItem.tooltip = "Toggle Auto-Decompilation";
decompStatusItem.tooltip = "Toggle Auto-Decomp";
decompStatusItem.command = "opengoal.decomp.toggleAutoDecompilation";
if (fsWatcher === undefined) {
decompStatusItem.text =
"$(extensions-sync-ignored) Auto-Decompilation Disabled";
"$(extensions-sync-ignored) Auto-Decomp Disabled";
} else {
decompStatusItem.text =
"$(extensions-sync-enabled) Auto-Decompilation Enabled";
"$(extensions-sync-enabled) Auto-Decomp Enabled";
}
break;
case DecompStatus.Running:
Expand Down Expand Up @@ -211,15 +217,13 @@ async function decompFiles(decompConfig: string, fileNames: string[]) {
);
channel.append(stdout.toString());
channel.append(stderr.toString());
updateStatus(DecompStatus.Idle);
} catch (error: any) {
vscode.window.showErrorMessage(
"Decompilation Failed, see OpenGOAL Decompiler logs for details"
);
updateStatus(DecompStatus.Errored);
channel.append(
`DECOMP ERROR:\nSTDOUT:\n${error.stdout}\nSTDERR:\n${error.stderr}`
);
}
updateStatus(DecompStatus.Idle);
}

async function getValidObjectNames(gameName: string) {
Expand Down
8 changes: 3 additions & 5 deletions src/decomp/type-caster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,15 @@ export async function updateTypeCastSuggestions(gameName: GameName) {
{
encoding: "utf8",
cwd: getProjectRoot().fsPath,
timeout: 20000,
timeout: 500,
}
);
if (existsSync(jsonPath)) {
const result = readFileSync(jsonPath, { encoding: "utf-8" });
typeCastSuggestions.set(gameName, JSON.parse(result));
}
} catch (error: any) {
vscode.window.showErrorMessage(
"Couldn't get a list of all types to use for casting suggestions"
);
} catch (error: unknown) {
/* empty */
}
}

Expand Down