mirror of
https://github.com/hexedtech/codemp-vscode.git
synced 2024-12-23 05:54:51 +01:00
feat: better UX on commands with quickPick
This commit is contained in:
parent
4bc9d27a32
commit
6bc6561769
2 changed files with 10 additions and 10 deletions
|
@ -157,7 +157,7 @@ export async function attach(selected: vscode.TreeItem | undefined) {
|
|||
buffer_name = selected.label.label; // TODO ughh what is this api?
|
||||
}
|
||||
} else {
|
||||
buffer_name = await vscode.window.showInputBox({ prompt: "path of buffer to attach to" });
|
||||
buffer_name = await vscode.window.showQuickPick(workspace.filetree(null, false), { placeHolder: "buffer to attach to:" }, undefined);
|
||||
}
|
||||
if (!buffer_name) return;
|
||||
await attach_to_remote_buffer(buffer_name);
|
||||
|
@ -173,7 +173,7 @@ export async function detach(selected: vscode.TreeItem | undefined) {
|
|||
buffer_name = selected.label.label; // TODO ughh what is this api?
|
||||
}
|
||||
} else {
|
||||
buffer_name = await vscode.window.showInputBox({ prompt: "path of buffer to detach from" });
|
||||
buffer_name = await vscode.window.showQuickPick(workspace.buffer_list(), { placeHolder: "buffer to detach from:" }, undefined);
|
||||
}
|
||||
if (!buffer_name) return;
|
||||
let controller = workspace.buffer_by_name(buffer_name);
|
||||
|
@ -191,7 +191,7 @@ export async function share() {
|
|||
if (vscode.window.activeTextEditor !== null) {
|
||||
buffer_name = vscode.window.activeTextEditor?.document.uri.toString();
|
||||
} 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 share" });
|
||||
}
|
||||
if (!buffer_name) return; // action cancelled by user
|
||||
if (!vscode.workspace.workspaceFolders) return vscode.window.showWarningMessage("Open a vscode workspace folder first")
|
||||
|
@ -218,7 +218,7 @@ export async function sync(selected: vscode.TreeItem | undefined) {
|
|||
editor = vscode.window.activeTextEditor;
|
||||
if (editor === undefined) throw "no active editor to sync";
|
||||
buffer_name = mapping.bufferMapper.by_editor(editor.document.uri);
|
||||
if (buffer_name === undefined) throw "No such buffer managed by codemp"
|
||||
if (buffer_name === undefined) return vscode.window.showWarningMessage("Buffer not synched with codemp");
|
||||
}
|
||||
|
||||
resync(buffer_name, workspace, editor);
|
||||
|
@ -249,4 +249,4 @@ export async function resync(buffer_name: string, workspace: codemp.Workspace, e
|
|||
}
|
||||
}
|
||||
locks.delete(buffer_name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,12 +50,12 @@ export async function join(selected: vscode.TreeItem | undefined) {
|
|||
workspace_id = selected.label.label; // TODO ughh what is this api?
|
||||
}
|
||||
} else {
|
||||
workspace_id = await vscode.window.showInputBox({ prompt: "name of workspace to attach to" });
|
||||
workspace_id = await vscode.window.showQuickPick(workspace_list, { placeHolder: "workspace to join:" }, undefined);
|
||||
}
|
||||
if (!workspace_id) return; // user cancelled with ESC
|
||||
if (vscode.workspace.workspaceFolders === undefined) {
|
||||
vscode.window.showErrorMessage("Open a Workspace folder first");
|
||||
return;
|
||||
let ws = await vscode.window.showWorkspaceFolderPick({ placeHolder: "directory to open workspace into:" });
|
||||
if (ws === undefined) return vscode.window.showErrorMessage("Open a Workspace folder first");
|
||||
}
|
||||
setWorkspace(await client.join_workspace(workspace_id));
|
||||
if (!workspace) return;
|
||||
|
@ -173,9 +173,9 @@ export async function createWorkspace() {
|
|||
|
||||
export async function inviteToWorkspace() {
|
||||
if (client === null) return vscode.window.showWarningMessage("Connect first");
|
||||
let workspace_id = await vscode.window.showInputBox({ prompt: "Enter name of the workspace you want to invite the user into" });
|
||||
let workspace_id = await vscode.window.showQuickPick(workspace_list, { placeHolder: "workspace to invite to:" });
|
||||
if (workspace_id === undefined) return;
|
||||
let user_id = await vscode.window.showInputBox({ prompt: "Enter name of the user you want to invite" });
|
||||
let user_id = await vscode.window.showInputBox({ prompt: "Name of user to invite" });
|
||||
if (user_id === undefined) return;
|
||||
await client.invite_to_workspace(workspace_id, user_id);
|
||||
vscode.window.showInformationMessage("Invited " + user_id + " into workspace " + workspace_id);
|
||||
|
|
Loading…
Reference in a new issue