feat: deleteWorkspace function

This commit is contained in:
frelodev 2024-10-27 22:48:07 +01:00
parent 467defc486
commit 3c3da87b19
3 changed files with 17 additions and 1 deletions

View file

@ -144,6 +144,12 @@
"category": "codemp",
"icon": "$(arrow-down)"
},
{
"command": "codemp.deleteWorkspace",
"title": "Delete Workspace",
"category": "codemp",
"icon": "$(arrow-down)"
},
{
"command": "codemp.createBuffer",
"title": "Create Buffer",

View file

@ -187,6 +187,15 @@ export async function leave() {
vscode.window.showInformationMessage("Left workspace " + workspace_id);
}
export async function deleteWorkspace() {
if (client === null) return vscode.window.showWarningMessage("Connect first");
let workspace_id = await vscode.window.showInputBox({ prompt: "Enter workspace's name to delete" });
if (workspace_id === undefined) return;
await client.deleteWorkspace(workspace_id);
vscode.window.showInformationMessage("Deleted workspace " + workspace_id);
listWorkspaces();
}
export async function refresh() {
if (client === null) return vscode.window.showWarningMessage("Connect first");

View file

@ -1,6 +1,6 @@
import * as vscode from 'vscode';
import * as codemp from 'codemp';
import { client, connect, join, refresh, createWorkspace, inviteToWorkspace, listWorkspaces, leave } from './commands/client';
import { client, connect, join, refresh, createWorkspace, inviteToWorkspace, listWorkspaces, leave, deleteWorkspace } from './commands/client';
import { CodempTreeProvider } from './tree';
import * as mapping from './mapping';
import { workspaceState, jump, listBuffers, createBuffer, deleteBuffer } from './commands/workspaces'
@ -39,6 +39,7 @@ export function activate(context: vscode.ExtensionContext) {
vscode.commands.registerCommand('codemp.inviteWorkspace', inviteToWorkspace),
vscode.commands.registerCommand('codemp.listWorkspaces', listWorkspaces),
vscode.commands.registerCommand('codemp.leave', leave),
vscode.commands.registerCommand('codemp.deleteWorkspace', deleteWorkspace),
vscode.commands.registerCommand('codemp.createBuffer', createBuffer),
vscode.commands.registerCommand('codemp.listBuffers', listBuffers),
vscode.commands.registerCommand('codemp.detach', detach),