Skip to content

Commit

Permalink
✨ Add a button to reset the PROS conductor file (#224)
Browse files Browse the repository at this point in the history
* pros c reset button

Works

* fix prettier warning

automated CI run of prettier is bugged

* run prettier on new file

please pass ci check

* Allow conductor reset regardless of vscode context

Co-authored-by: BennyBot <[email protected]>

* Add package.json entry for resetConductor

---------

Co-authored-by: BennyBot <[email protected]>
  • Loading branch information
Jackman3323 and BennyBot authored May 21, 2024
1 parent c55104d commit e9c433b
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 0 deletions.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@
"command": "pros.infoProject",
"title": "PROS: Project Information"
},
{
"command": "pros.resetConductor",
"title": "PROS: Reset Conductor"
},
{
"command": "pros.welcome",
"title": "PROS: Welcome"
Expand Down
1 change: 1 addition & 0 deletions src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ export * from "./set-team-number";
export * from "./set-robot-name";
export * from "./runvision";
export * from "./info-project";
export * from "./reset-conductor";
21 changes: 21 additions & 0 deletions src/commands/reset-conductor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import * as vscode from "vscode";
import { BaseCommand, BaseCommandOptions } from "./base-command";

export const resetConductor = async () => {
const resetConductorCommandOptions: BaseCommandOptions = {
command: "pros",
args: ["c", "reset"], //--force not needed: Ben's base-commands class auto-handles warning + confirmation.
message: "Resetting Conductor",
requiresProsProject: false,
successMessage:
"Conductor Reset Successfully. Any templates and/or depots previously cached will need to be re-fetched.",
};
const resetConductorCommand: BaseCommand = new BaseCommand(
resetConductorCommandOptions
);
try {
await resetConductorCommand.runCommand();
} catch (err: any) {
await vscode.window.showErrorMessage(err.message);
}
};
2 changes: 2 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
setRobotName,
runVision,
getCurrentKernelOkapiVersion,
resetConductor,
} from "./commands";
import { ProsProjectEditorProvider } from "./views/editor";
import { Analytics } from "./ga";
Expand Down Expand Up @@ -229,6 +230,7 @@ export async function activate(context: vscode.ExtensionContext) {
setupCommandBlocker("pros.upgrade", upgradeProject);
setupCommandBlocker("pros.new", createNewProject);
setupCommandBlocker("pros.infoProject", infoProject);
setupCommandBlocker("pros.resetConductor", resetConductor);

// Beta commands (notice the fourth argument is set to true for these)
setupCommandBlocker("pros.installVision", installVision, context, true);
Expand Down
1 change: 1 addition & 0 deletions src/views/tree-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class TreeDataProvider implements vscode.TreeDataProvider<TreeItem> {
new TreeItem("Upgrade Project", undefined, "pros.upgrade"),
new TreeItem("Create Project", undefined, "pros.new"),
new TreeItem("Project/Template Info", undefined, "pros.infoProject"),
new TreeItem("Reset Conductor", undefined, "pros.resetConductor"),
// open branchline will go here in the future
]),
new TreeItem("Manage Installations", [
Expand Down

0 comments on commit e9c433b

Please sign in to comment.