feat: delete Buffer

This commit is contained in:
frelodev 2024-10-05 17:55:23 +02:00
parent 4b98c836c6
commit bec2dea2cd
3 changed files with 18 additions and 1 deletions

View file

@ -163,6 +163,13 @@
"icon": "$(arrow-down)" "icon": "$(arrow-down)"
}, },
{ {
"command": "codemp.deleteBuffer",
"title": "Delete Buffer",
"category": "codemp",
"icon": "$(arrow-down)"
},
{
"command": "codemp.sync", "command": "codemp.sync",
"title": "Sync", "title": "Sync",
"category": "codemp", "category": "codemp",

View file

@ -55,3 +55,12 @@ export async function listBuffers() {
vscode.window.showInformationMessage(buffers.join("\n")); vscode.window.showInformationMessage(buffers.join("\n"));
provider.refresh(); provider.refresh();
} }
export async function deleteBuffer() {
let bufferName: any = (await vscode.window.showInputBox({ prompt: "path of the buffer to delete" }));
if (workspace === null) return vscode.window.showWarningMessage("Join a workspace first");
await workspace.delete(bufferName);
vscode.window.showInformationMessage(`Deleted buffer :${bufferName}`);
listBuffers();
}

View file

@ -3,7 +3,7 @@ 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 } from './commands/client';
import { CodempTreeProvider } from './tree'; import { CodempTreeProvider } from './tree';
import * as mapping from './mapping'; import * as mapping from './mapping';
import { workspace, jump, listBuffers, createBuffer } from './commands/workspaces' import { workspace, jump, listBuffers, createBuffer , deleteBuffer } from './commands/workspaces'
import { attach, share, sync, apply_changes_to_buffer, detach } from './commands/buffers' import { attach, share, sync, apply_changes_to_buffer, detach } from './commands/buffers'
export let provider = new CodempTreeProvider(); export let provider = new CodempTreeProvider();
@ -42,6 +42,7 @@ export function activate(context: vscode.ExtensionContext) {
vscode.commands.registerCommand('codemp.createBuffer', createBuffer), vscode.commands.registerCommand('codemp.createBuffer', createBuffer),
vscode.commands.registerCommand('codemp.listBuffers', listBuffers), vscode.commands.registerCommand('codemp.listBuffers', listBuffers),
vscode.commands.registerCommand('codemp.detach', detach), vscode.commands.registerCommand('codemp.detach', detach),
vscode.commands.registerCommand('codemp.deleteBuffer', deleteBuffer),
vscode.commands.registerCommand('codemp.sync', sync), vscode.commands.registerCommand('codemp.sync', sync),
vscode.commands.registerCommand('codemp.refresh', refresh), vscode.commands.registerCommand('codemp.refresh', refresh),
vscode.commands.registerCommand('codemp.jump', jump), vscode.commands.registerCommand('codemp.jump', jump),