mirror of
https://github.com/hexedtech/codemp-vscode.git
synced 2024-12-23 05:54:51 +01:00
feat: new workspace commands
This commit is contained in:
parent
e34f8e9ec9
commit
36e2a99f9e
3 changed files with 86 additions and 9 deletions
36
package.json
36
package.json
|
@ -4,7 +4,7 @@
|
|||
"description": "VSCode codemp plugin -- code multiplexer",
|
||||
"repository": "https://github.com/hexedtech/codemp-vscode",
|
||||
"publisher": "codemp",
|
||||
"version": "0.0.1",
|
||||
"version": "0.0.5",
|
||||
"engines": {
|
||||
"vscode": "^1.81.0"
|
||||
},
|
||||
|
@ -94,6 +94,12 @@
|
|||
"category": "codemp",
|
||||
"icon": "$(diff-insert)"
|
||||
},
|
||||
{
|
||||
"command": "codemp.inviteWorkspace",
|
||||
"title": "Invite in Workspace",
|
||||
"category": "codemp",
|
||||
"icon": "$(arrow-up)"
|
||||
},
|
||||
{
|
||||
"command": "codemp.listWorkspaces",
|
||||
"title": "List Workspaces",
|
||||
|
@ -101,10 +107,16 @@
|
|||
"icon": "$(extensions-view-icon)"
|
||||
},
|
||||
{
|
||||
"command": "codemp.listBuffers",
|
||||
"title": "List Buffers",
|
||||
"command": "codemp.activeWorkspaces",
|
||||
"title": "Active Workspaces",
|
||||
"category": "codemp",
|
||||
"icon": "$(output-view-icon)"
|
||||
"icon": "$(extensions-view-icon)"
|
||||
},
|
||||
{
|
||||
"command": "codemp.leaveWorkspace",
|
||||
"title": "Leave Workspace",
|
||||
"category": "codemp",
|
||||
"icon": "$(arrow-down)"
|
||||
},
|
||||
{
|
||||
"command": "codemp.createBuffer",
|
||||
|
@ -113,16 +125,22 @@
|
|||
"icon": "$(diff-insert)"
|
||||
},
|
||||
{
|
||||
"command": "codemp.disconnectBuffer",
|
||||
"title": "Disconnect Buffer",
|
||||
"command": "codemp.listBuffers",
|
||||
"title": "List Buffers",
|
||||
"category": "codemp",
|
||||
"icon": "$(testing-cancel-icon)"
|
||||
"icon": "$(output-view-icon)"
|
||||
},
|
||||
{
|
||||
"command": "codemp.sync",
|
||||
"title": "Sync",
|
||||
"category": "codemp",
|
||||
"icon": "$(extensions-refresh)"
|
||||
},
|
||||
{
|
||||
"command": "codemp.refresh",
|
||||
"title": "Refresh",
|
||||
"category": "codemp",
|
||||
"icon": "$(extensions-refresh)"
|
||||
}
|
||||
],
|
||||
"configuration": {
|
||||
|
@ -130,7 +148,7 @@
|
|||
"properties": {
|
||||
"codemp.server": {
|
||||
"type": "string",
|
||||
"default": "http://code.mp:50053",
|
||||
"default": "http://codemp.dev:50053",
|
||||
"description": "Server address to connect to"
|
||||
},
|
||||
"codemp.username": {
|
||||
|
@ -173,4 +191,4 @@
|
|||
"dependencies": {
|
||||
"codemp": "^0.0.5"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -223,6 +223,27 @@ export async function createWorkspace() {
|
|||
return;
|
||||
}
|
||||
await client.create_workspace(workspace_id);
|
||||
vscode.window.showInformationMessage("Created new workspace " + workspace_id);
|
||||
provider.refresh();
|
||||
}
|
||||
|
||||
export async function inviteToWorkspace() {
|
||||
if(client===null){
|
||||
vscode.window.showInformationMessage("Connect first");
|
||||
return;
|
||||
}
|
||||
let workspace_id = await vscode.window.showInputBox({ prompt: "Enter name of the workspace you want to invite the user into" });
|
||||
if(workspace_id===undefined){
|
||||
vscode.window.showInformationMessage("You didn't enter a name");
|
||||
return;
|
||||
}
|
||||
let user_id = await vscode.window.showInputBox({ prompt: "Enter name of the user you want to invite" });
|
||||
if(user_id===undefined){
|
||||
vscode.window.showInformationMessage("You didn't enter a name");
|
||||
return;
|
||||
}
|
||||
await client.invite_to_workspace(workspace_id,user_id);
|
||||
vscode.window.showInformationMessage("Invited " + user_id + "into workspace " + workspace_id);
|
||||
provider.refresh();
|
||||
}
|
||||
|
||||
|
@ -235,6 +256,40 @@ export async function listWorkspaces() {
|
|||
provider.refresh();
|
||||
}
|
||||
|
||||
export async function leaveWorkspace() {
|
||||
if(client===null){
|
||||
vscode.window.showInformationMessage("Connect first");
|
||||
return;
|
||||
}
|
||||
let workspace_id = await vscode.window.showInputBox({ prompt: "Enter name for workspace you want to leave" });
|
||||
if(workspace_id===undefined){
|
||||
vscode.window.showInformationMessage("You didn't enter a name");
|
||||
return;
|
||||
}
|
||||
await client.leave_workspace(workspace_id);
|
||||
vscode.window.showInformationMessage("Left workspace " + workspace_id);
|
||||
provider.refresh();
|
||||
}
|
||||
|
||||
export async function activeWorkspaces() {
|
||||
if(client===null){
|
||||
vscode.window.showInformationMessage("Connect first");
|
||||
return;
|
||||
}
|
||||
workspace_list = await client.active_workspaces();
|
||||
provider.refresh();
|
||||
}
|
||||
|
||||
export async function refresh() {
|
||||
if(client===null){
|
||||
vscode.window.showInformationMessage("Connect first");
|
||||
return;
|
||||
}
|
||||
await client.refresh();
|
||||
vscode.window.showInformationMessage("Refreshed Session token");
|
||||
provider.refresh();
|
||||
}
|
||||
|
||||
|
||||
// This method is called when your extension is deactivated
|
||||
export function deactivate() {
|
||||
|
|
|
@ -20,10 +20,14 @@ export function activate(context: vscode.ExtensionContext) {
|
|||
vscode.commands.registerCommand('codemp.join', commands.join),
|
||||
vscode.commands.registerCommand('codemp.attach', commands.attach),
|
||||
vscode.commands.registerCommand('codemp.createWorkspace', commands.createWorkspace),
|
||||
vscode.commands.registerCommand('codemp.inviteWorkspace', commands.inviteToWorkspace),
|
||||
vscode.commands.registerCommand('codemp.listWorkspaces', commands.listWorkspaces),
|
||||
vscode.commands.registerCommand('codemp.activeWorkspaces', commands.activeWorkspaces),
|
||||
vscode.commands.registerCommand('codemp.leaveWorkspace', commands.leaveWorkspace),
|
||||
vscode.commands.registerCommand('codemp.createBuffer', commands.createBuffer),
|
||||
vscode.commands.registerCommand('codemp.listBuffers', commands.listBuffers),
|
||||
vscode.commands.registerCommand('codemp.sync', commands.sync),
|
||||
vscode.commands.registerCommand('codemp.refresh', commands.refresh),
|
||||
]) {
|
||||
context.subscriptions.push(cmd);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue