mirror of
https://github.com/hexedtech/codemp-vscode.git
synced 2024-12-23 05:54:51 +01:00
chore: refactor
This commit is contained in:
parent
af3cde19fc
commit
2a72104a02
3 changed files with 10 additions and 10 deletions
|
@ -36,7 +36,7 @@ export async function apply_changes_to_buffer(path: string, controller: codemp.B
|
|||
.replace(range, event.content)
|
||||
})) {
|
||||
vscode.window.showWarningMessage("Couldn't apply changes");
|
||||
await resync(path, workspace, editor, 100);
|
||||
await resync(path, workspace, editor, 100);
|
||||
}
|
||||
locks.delete(path);
|
||||
|
||||
|
@ -244,7 +244,7 @@ export async function resync(buffer_name: string, workspace: codemp.Workspace, e
|
|||
console.log("attempts to sync", i);
|
||||
break;
|
||||
}
|
||||
if (i == tries-1) {
|
||||
if (i == tries - 1) {
|
||||
vscode.window.showErrorMessage(`Failed setting buffer content after ${tries} tries`);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import { LOGGER, provider } from '../extension';
|
|||
// TODO this "global state" should probably live elsewher but we need lo update it from these commands
|
||||
export let client: codemp.Client | null = null;
|
||||
export let workspace_list: string[] = [];
|
||||
export let cursor_disposable : vscode.Disposable | null;
|
||||
export let cursor_disposable: vscode.Disposable | null;
|
||||
|
||||
export async function connect() {
|
||||
let config = vscode.workspace.getConfiguration('codemp');
|
||||
|
@ -59,7 +59,7 @@ export async function join(selected: vscode.TreeItem | undefined) {
|
|||
setWorkspace(await client.join_workspace(workspace_id));
|
||||
if (!workspace) return;
|
||||
let controller = workspace.cursor();
|
||||
controller.callback(async function(controller: codemp.CursorController) {
|
||||
controller.callback(async function (controller: codemp.CursorController) {
|
||||
while (true) {
|
||||
let event = await controller.try_recv();
|
||||
if (workspace === null) {
|
||||
|
@ -104,12 +104,12 @@ export async function join(selected: vscode.TreeItem | undefined) {
|
|||
once = false;
|
||||
} else {
|
||||
await controller.send({
|
||||
startRow: selection.anchor.line,
|
||||
startCol: selection.anchor.character,
|
||||
endRow: selection.active.line,
|
||||
startRow: selection.anchor.line,
|
||||
startCol: selection.anchor.character,
|
||||
endRow: selection.active.line,
|
||||
endCol: selection.active.character,
|
||||
buffer: buffer,
|
||||
user: undefined,
|
||||
buffer: buffer,
|
||||
user: undefined,
|
||||
});
|
||||
once = true;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ import * as codemp from 'codemp';
|
|||
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 , deleteBuffer } from './commands/workspaces'
|
||||
import { workspace, jump, listBuffers, createBuffer, deleteBuffer } from './commands/workspaces'
|
||||
import { attach, share, sync, apply_changes_to_buffer, detach } from './commands/buffers'
|
||||
|
||||
export let provider = new CodempTreeProvider();
|
||||
|
|
Loading…
Reference in a new issue