mirror of
https://github.com/hexedtech/codemp-vscode.git
synced 2024-11-22 15:34:49 +01:00
fix: error when share/attach already active buffer
This commit is contained in:
parent
a1497010f4
commit
18f0733831
1 changed files with 6 additions and 0 deletions
|
@ -119,6 +119,9 @@ export async function share(selected: vscode.TreeItem | undefined) {
|
||||||
buffer_name = await vscode.window.showInputBox({ prompt: "path of buffer to attach to" });
|
buffer_name = await vscode.window.showInputBox({ prompt: "path of buffer to attach to" });
|
||||||
}
|
}
|
||||||
if (!buffer_name) return; // action cancelled by user
|
if (!buffer_name) return; // action cancelled by user
|
||||||
|
if (mapping.bufferMapper.by_buffer(buffer_name) !== undefined) {
|
||||||
|
return vscode.window.showWarningMessage("buffer already attached");
|
||||||
|
}
|
||||||
let buffer: codemp.BufferController = await workspace.attach(buffer_name);
|
let buffer: codemp.BufferController = await workspace.attach(buffer_name);
|
||||||
await buffer.poll(); // wait for server changes
|
await buffer.poll(); // wait for server changes
|
||||||
LOGGER.info(`attached to buffer ${buffer_name}`);
|
LOGGER.info(`attached to buffer ${buffer_name}`);
|
||||||
|
@ -197,6 +200,9 @@ export async function attach(selected: vscode.TreeItem | undefined) {
|
||||||
buffer_name = await vscode.window.showInputBox({ prompt: "path of buffer to attach to" });
|
buffer_name = await vscode.window.showInputBox({ prompt: "path of buffer to attach to" });
|
||||||
}
|
}
|
||||||
if (!buffer_name) return; // action cancelled by user
|
if (!buffer_name) return; // action cancelled by user
|
||||||
|
if (mapping.bufferMapper.by_buffer(buffer_name) !== undefined) {
|
||||||
|
return vscode.window.showWarningMessage("buffer already attached");
|
||||||
|
}
|
||||||
let buffer: codemp.BufferController = await workspace.attach(buffer_name);
|
let buffer: codemp.BufferController = await workspace.attach(buffer_name);
|
||||||
await buffer.poll(); // wait for server changes
|
await buffer.poll(); // wait for server changes
|
||||||
LOGGER.info(`attached to buffer ${buffer_name}`);
|
LOGGER.info(`attached to buffer ${buffer_name}`);
|
||||||
|
|
Loading…
Reference in a new issue