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

Change Rebuild Package Environment to deal with both Actions and Tasks. #159

Merged
merged 2 commits into from
Dec 17, 2024
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
32 changes: 10 additions & 22 deletions sema4ai/vscode-client/src/activities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,31 +159,19 @@ export async function resolveInterpreter(targetRobot: string): Promise<ActionRes
// Note: this may also activate `Sema4.ai` if it's still not activated
// (so, it cannot be used during startup as there'd be a cyclic dependency).
try {
let interpreter: InterpreterInfo | undefined = await commands.executeCommand(
"robot.resolveInterpreter",
targetRobot
let interpreter: ActionResult<InterpreterInfo | undefined> = await commands.executeCommand(
roboCommands.SEMA4AI_RESOLVE_INTERPRETER,
{
"target_robot": targetRobot,
}
);
if (interpreter === null || (typeof interpreter === "string" && interpreter === "null")) {
throw Error("Interpreter not found. Retrying call...");
throw Error("Interpreter not found");
}
return { "success": true, "message": "", "result": interpreter };
return interpreter;
} catch (error) {
// We couldn't resolve with the robotframework language server command, fallback to the robocorp code command.
try {
let interpreter: ActionResult<InterpreterInfo | undefined> = await commands.executeCommand(
roboCommands.SEMA4AI_RESOLVE_INTERPRETER,
{
"target_robot": targetRobot,
}
);
if (interpreter === null || (typeof interpreter === "string" && interpreter === "null")) {
throw Error("Interpreter not found");
}
return interpreter;
} catch (error) {
logError("Error resolving interpreter.", error, "ACT_RESOLVE_INTERPRETER");
return { "success": false, "message": "Unable to resolve interpreter.", "result": undefined };
}
logError("Error resolving interpreter.", error, "ACT_RESOLVE_INTERPRETER");
return { "success": false, "message": "Unable to resolve interpreter.", "result": undefined };
}
}

Expand Down Expand Up @@ -223,7 +211,7 @@ export async function listAndAskRobotSelection(
);

if (!actionResult.success) {
window.showInformationMessage("Error listing robots: " + actionResult.message);
window.showInformationMessage("Error listing packages: " + actionResult.message);
return;
}
let robotsInfo: LocalPackageMetadataInfo[] = actionResult.result;
Expand Down
6 changes: 3 additions & 3 deletions sema4ai/vscode-client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -788,9 +788,9 @@ export async function doActivate(context: ExtensionContext, C: CommandRegistry)
C.register(SEMA4AI_PACKAGE_ENVIRONMENT_REBUILD, async (actionPackagePath?: vscode.Uri) => {
if (!actionPackagePath) {
const selected = await listAndAskRobotSelection(
"Please select the Action Package for which you'd like to rebuild the environment",
"Unable to continue because no Action Package was found in the workspace.",
{ showActionPackages: true, showTaskPackages: false, showAgentPackages: false }
"Please select the Action or Task Package for which you'd like to rebuild the environment",
"Unable to continue because no Action nor Task Package was found in the workspace.",
{ showActionPackages: true, showTaskPackages: true, showAgentPackages: false }
);
if (!selected) {
return;
Expand Down
Loading