chore : check if there's a vscode workspace before joining a codemp workspace

This commit is contained in:
frelodev 2024-09-16 17:44:10 +02:00
parent 6dc6387a2d
commit f4be360513

View file

@ -53,6 +53,10 @@ export async function join(selected: vscode.TreeItem | undefined) {
workspace_id = await vscode.window.showInputBox({ prompt: "name of workspace to attach to" }); workspace_id = await vscode.window.showInputBox({ prompt: "name of workspace to attach to" });
} }
if (!workspace_id) return; // user cancelled with ESC if (!workspace_id) return; // user cancelled with ESC
if(vscode.workspace.getWorkspaceFolder === undefined) {
vscode.window.showErrorMessage("Open a Workspace folder first");
return;
}
workspace = await client.join_workspace(workspace_id) workspace = await client.join_workspace(workspace_id)
let controller = workspace.cursor(); let controller = workspace.cursor();
controller.callback(async function (controller: codemp.CursorController) { controller.callback(async function (controller: codemp.CursorController) {