mirror of
https://github.com/hexedtech/codemp-vscode.git
synced 2024-11-22 15:34:49 +01:00
feat: detach
Co-authored-by: alemi <me@alemi.dev>
This commit is contained in:
parent
87f2b6f2fb
commit
9c00cf9eeb
3 changed files with 10 additions and 2 deletions
|
@ -156,6 +156,12 @@
|
||||||
"category": "codemp",
|
"category": "codemp",
|
||||||
"icon": "$(output-view-icon)"
|
"icon": "$(output-view-icon)"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"command": "codemp.detach",
|
||||||
|
"title": "Detach from Buffer",
|
||||||
|
"category": "codemp",
|
||||||
|
"icon": "$(arrow-down)"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"command": "codemp.sync",
|
"command": "codemp.sync",
|
||||||
"title": "Sync",
|
"title": "Sync",
|
||||||
|
|
|
@ -173,7 +173,7 @@ export async function detach(selected: vscode.TreeItem | undefined) {
|
||||||
buffer_name = selected.label.label; // TODO ughh what is this api?
|
buffer_name = selected.label.label; // TODO ughh what is this api?
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
buffer_name = await vscode.window.showInputBox({ prompt: "path of buffer to attach to" });
|
buffer_name = await vscode.window.showInputBox({ prompt: "path of buffer to detach from" });
|
||||||
}
|
}
|
||||||
if (!buffer_name) return;
|
if (!buffer_name) return;
|
||||||
let controller = workspace.buffer_by_name(buffer_name);
|
let controller = workspace.buffer_by_name(buffer_name);
|
||||||
|
@ -181,6 +181,7 @@ export async function detach(selected: vscode.TreeItem | undefined) {
|
||||||
workspace.detach(buffer_name);
|
workspace.detach(buffer_name);
|
||||||
mapping.bufferMapper.remove(buffer_name);
|
mapping.bufferMapper.remove(buffer_name);
|
||||||
vscode.window.showInformationMessage(`Detached from buffer ${buffer_name}`)
|
vscode.window.showInformationMessage(`Detached from buffer ${buffer_name}`)
|
||||||
|
provider.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { client, connect, join, refresh, createWorkspace, inviteToWorkspace, lis
|
||||||
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 } from './commands/workspaces'
|
||||||
import { attach, share, sync, apply_changes_to_buffer } 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();
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ export function activate(context: vscode.ExtensionContext) {
|
||||||
vscode.commands.registerCommand('codemp.leaveWorkspace', leaveWorkspace),
|
vscode.commands.registerCommand('codemp.leaveWorkspace', leaveWorkspace),
|
||||||
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.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),
|
||||||
|
|
Loading…
Reference in a new issue