diff --git a/package.json b/package.json index 3345691..3a0dd9c 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/commands/client.ts b/src/commands/client.ts index 85aae72..eb52b92 100644 --- a/src/commands/client.ts +++ b/src/commands/client.ts @@ -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"); diff --git a/src/extension.ts b/src/extension.ts index ce046bd..ae798cc 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -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),