mirror of
https://github.com/hexedtech/codemp-vscode.git
synced 2024-11-21 23:14:49 +01:00
feat: leave
Co-authored-by: alemi <me@alemi.dev>
This commit is contained in:
parent
9c00cf9eeb
commit
4b98c836c6
3 changed files with 13 additions and 18 deletions
|
@ -139,7 +139,7 @@
|
|||
"icon": "$(extensions-view-icon)"
|
||||
},
|
||||
{
|
||||
"command": "codemp.leaveWorkspace",
|
||||
"command": "codemp.leave",
|
||||
"title": "Leave Workspace",
|
||||
"category": "codemp",
|
||||
"icon": "$(arrow-down)"
|
||||
|
|
|
@ -144,15 +144,6 @@ export async function join(selected: vscode.TreeItem | undefined) {
|
|||
provider.refresh();
|
||||
}
|
||||
|
||||
export async function leave() {
|
||||
if (!client) throw "can't leave while disconnected";
|
||||
if (!workspace) return vscode.window.showWarningMessage("Not in a workspace");
|
||||
client.leave_workspace(workspace.id());
|
||||
if (cursor_disposable !== null) cursor_disposable.dispose();
|
||||
cursor_disposable = null;
|
||||
setWorkspace(null);
|
||||
}
|
||||
|
||||
|
||||
export async function listWorkspaces() {
|
||||
if (client === null) return vscode.window.showWarningMessage("Connect first");
|
||||
|
@ -181,15 +172,19 @@ export async function inviteToWorkspace() {
|
|||
vscode.window.showInformationMessage("Invited " + user_id + " into workspace " + workspace_id);
|
||||
}
|
||||
|
||||
export async function leaveWorkspace() {
|
||||
if (client === null) return vscode.window.showWarningMessage("Connect first");
|
||||
let workspace_id = await vscode.window.showInputBox({ prompt: "Enter name for workspace you want to leave" });
|
||||
if (workspace_id === undefined) return;
|
||||
await client.leave_workspace(workspace_id);
|
||||
vscode.window.showInformationMessage("Left workspace " + workspace_id);
|
||||
export async function leave() {
|
||||
if (!client) throw "can't leave while disconnected";
|
||||
if (!workspace) throw "can't leave while not in a workspace";
|
||||
workspace.cursor().clear_callback()
|
||||
client.leave_workspace(workspace.id());
|
||||
if (cursor_disposable !== null) cursor_disposable.dispose();
|
||||
let workspace_id = workspace.id();
|
||||
setWorkspace(null);
|
||||
provider.refresh();
|
||||
vscode.window.showInformationMessage("Left workspace " + workspace_id);
|
||||
}
|
||||
|
||||
|
||||
export async function refresh() {
|
||||
if (client === null) return vscode.window.showWarningMessage("Connect first");
|
||||
await client.refresh();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import * as vscode from 'vscode';
|
||||
import * as codemp from 'codemp';
|
||||
import { client, connect, join, refresh, createWorkspace, inviteToWorkspace, listWorkspaces, leaveWorkspace } from './commands/client';
|
||||
import { client, connect, join, refresh, createWorkspace, inviteToWorkspace, listWorkspaces, leave } from './commands/client';
|
||||
import { CodempTreeProvider } from './tree';
|
||||
import * as mapping from './mapping';
|
||||
import { workspace, jump, listBuffers, createBuffer } from './commands/workspaces'
|
||||
|
@ -38,7 +38,7 @@ export function activate(context: vscode.ExtensionContext) {
|
|||
vscode.commands.registerCommand('codemp.createWorkspace', createWorkspace),
|
||||
vscode.commands.registerCommand('codemp.inviteWorkspace', inviteToWorkspace),
|
||||
vscode.commands.registerCommand('codemp.listWorkspaces', listWorkspaces),
|
||||
vscode.commands.registerCommand('codemp.leaveWorkspace', leaveWorkspace),
|
||||
vscode.commands.registerCommand('codemp.leave', leave),
|
||||
vscode.commands.registerCommand('codemp.createBuffer', createBuffer),
|
||||
vscode.commands.registerCommand('codemp.listBuffers', listBuffers),
|
||||
vscode.commands.registerCommand('codemp.detach', detach),
|
||||
|
|
Loading…
Reference in a new issue