Skip to content
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
24 changes: 12 additions & 12 deletions vscode-integration/out/extension.js

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions vscode-integration/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified vscode-integration/roboview-0.0.1.vsix
Binary file not shown.
2 changes: 1 addition & 1 deletion vscode-integration/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class CommandHandler {
),

vscode.commands.registerCommand("roboview.restart", () =>
lifecycleManager.restartRoboView(currentPanel),
lifecycleManager.restartRoboView(),
),
);
}
Expand Down
14 changes: 9 additions & 5 deletions vscode-integration/src/services/backendConnectionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ export class BackendConnectionManager {
);
}

public async startServer(pythonInterpreterPath: string): Promise<void> {
public async startServer(pythonInterpreterPath: string): Promise<boolean> {
const workspaceFolder = PathManager.getWorkspaceRoot();

if (!workspaceFolder) {
vscode.window.showErrorMessage("No Workspace Folder Selected.");
return;
return false;
}

this.killServerProcess();

if (await this.isServerRunning()) {
vscode.window.showInformationMessage("Server already running.");
return;
return true;
}

try {
Expand Down Expand Up @@ -83,7 +83,7 @@ export class BackendConnectionManager {
const errorMsg =
"RoboView is not installed. Please install it using: pip install roboview";
vscode.window.showErrorMessage(errorMsg);
return;
return false;
}

this.serverOutputChannel.appendLine("✓ RoboView is installed");
Expand Down Expand Up @@ -122,10 +122,12 @@ export class BackendConnectionManager {
this.serverOutputChannel.appendLine(`[ERROR] ${message}`);
vscode.window.showErrorMessage(message);
});
return true;
} catch (error) {
const message = `Error starting backend: ${error}`;
this.serverOutputChannel.appendLine(`[ERROR] ${message}`);
vscode.window.showErrorMessage(message);
return false;
}
}

Expand All @@ -139,7 +141,9 @@ export class BackendConnectionManager {
).getConfigPath();

if (robocopConfigPath) {
vscode.window.showInformationMessage("Using Robocop Config File from .env: " + robocopConfigPath);
vscode.window.showInformationMessage(
"Using Robocop Config File from .env: " + robocopConfigPath,
);
}

if (!vsProjectRootDir) {
Expand Down
48 changes: 33 additions & 15 deletions vscode-integration/src/services/lifecycleManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { PythonEnvironmentManager } from "./pythonEnvironmentManager";
import { BackendConnectionManager } from "./backendConnectionManager";
import vscode from "vscode";
import { RoboViewControlProvider } from "../views";
import { RoboViewPanel } from "../roboViewPanel";

export class LifecycleManager {
private backendConnectionManager: BackendConnectionManager;
Expand Down Expand Up @@ -43,20 +44,39 @@ export class LifecycleManager {
pythonInterpreterPath !== "" ||
!(await this.backendConnectionManager.isServerRunning())
) {
progress.report({ increment: 20, message: "Starting server..." });
await this.backendConnectionManager.startServer(
pythonInterpreterPath,
);
try {
progress.report({ increment: 20, message: "Starting server..." });
const serverStarted =
await this.backendConnectionManager.startServer(
pythonInterpreterPath,
);

progress.report({ increment: 40, message: "Waiting for server..." });
await this.backendConnectionManager.waitForServerReady(100000);
if (!serverStarted) {
vscode.window.showErrorMessage("Failed to start server.");
return;
}

progress.report({ increment: 70, message: "Initializing server..." });
await this.backendConnectionManager.initializeServer(currentPanel);
progress.report({
increment: 40,
message: "Waiting for server...",
});
await this.backendConnectionManager.waitForServerReady(100000);

progress.report({ increment: 100, message: "Done!" });
vscode.commands.executeCommand("roboview.show-monitor");
this.roboViewControlProvider.setExtensionReady(true);
progress.report({
increment: 70,
message: "Initializing server...",
});
await this.backendConnectionManager.initializeServer(currentPanel);

progress.report({ increment: 100, message: "Done!" });
vscode.commands.executeCommand("roboview.show-monitor");
this.roboViewControlProvider.setExtensionReady(true);
} catch (error) {
vscode.window.showErrorMessage(
`Failed to start server: ${error instanceof Error ? error.message : String(error)}`,
);
return;
}
} else {
vscode.window.showErrorMessage(
"Not a valid Python Interpreter Path chosen.",
Expand All @@ -67,10 +87,8 @@ export class LifecycleManager {
);
}

public async restartRoboView(
currentPanel: vscode.WebviewPanel | undefined,
): Promise<void> {
currentPanel?.dispose();
public async restartRoboView(): Promise<void> {
RoboViewPanel.currentPanel?.dispose();
vscode.commands.executeCommand("workbench.action.restartExtensionHost");
}
}