fix: update codemp and usage

This commit is contained in:
əlemi 2024-09-15 03:11:13 +02:00
parent cc5d93570b
commit 366f5aec82
Signed by: alemi
GPG key ID: A4895B84D311642C
4 changed files with 21 additions and 10 deletions

View file

@ -6,7 +6,7 @@
"homepage": "https://code.mp",
"repository": "https://github.com/hexedtech/codemp-vscode",
"publisher": "hexedtech",
"version": "0.0.6",
"version": "0.0.10",
"engines": {
"vscode": "^1.81.0"
},
@ -206,6 +206,6 @@
"typescript": "^5.1.6"
},
"dependencies": {
"codemp": "^0.0.5"
"codemp": "^0.0.10"
}
}

View file

@ -12,7 +12,6 @@ let locks : Map<string, boolean> = new Map();
export async function connect() {
let config = vscode.workspace.getConfiguration('codemp');
let server = config.get<string>("server", "http://code.mp:50053");
let username = config.get<string>("username");
if (!username) {
@ -23,10 +22,21 @@ export async function connect() {
if (!password) {
return vscode.window.showErrorMessage("missing password in settings: configure it first!");
}
try {
client = await codemp.connect({
username: username,
password: password,
host: config.get<string>("server"),
port: config.get<number>("port"),
tls: config.get<boolean>("tls"),
});
vscode.window.showInformationMessage("Connected to codemp");
client = await codemp.connect(server, username, password);
provider.refresh();
listWorkspaces(); // dont await, run in background
} catch (e) {
vscode.window.showErrorMessage("could not connect: " + e);
}
}
@ -206,7 +216,7 @@ export async function sync(selected: vscode.TreeItem | undefined) {
export async function listBuffers() {
if (workspace === null) throw "join a workspace first"
let buffers = workspace.filetree();
let buffers = workspace.filetree(undefined, false);
vscode.window.showInformationMessage(buffers.join("\n"));
provider.refresh();
}

View file

@ -19,6 +19,7 @@ export function activate(context: vscode.ExtensionContext) {
vscode.commands.registerCommand('codemp.connect', commands.connect),
vscode.commands.registerCommand('codemp.join', commands.join),
vscode.commands.registerCommand('codemp.attach', commands.attach),
vscode.commands.registerCommand('codemp.share', commands.share),
vscode.commands.registerCommand('codemp.createWorkspace', commands.createWorkspace),
vscode.commands.registerCommand('codemp.inviteWorkspace', commands.inviteToWorkspace),
vscode.commands.registerCommand('codemp.listWorkspaces', commands.listWorkspaces),

View file

@ -27,7 +27,7 @@ export class CodempTreeProvider implements vscode.TreeDataProvider<CodempTreeIte
// new CodempTreeItem("Buffers", Type.BufferContainer, true),
// new CodempTreeItem("Users", Type.UserContainer, true)
// ];
return workspace.filetree().map((x) =>
return workspace.filetree(undefined, false).map((x) =>
new CodempTreeItem(x, Type.Buffer, false, bufferMapper.bufferToEditorMapping.has(x))
);
} else {
@ -35,7 +35,7 @@ export class CodempTreeProvider implements vscode.TreeDataProvider<CodempTreeIte
}
case Type.BufferContainer:
if (workspace === null) { return [] };
return workspace.filetree().map((x) =>
return workspace.filetree(undefined, false).map((x) =>
new CodempTreeItem(x, Type.Buffer, false, bufferMapper.bufferToEditorMapping.has(x))
);
case Type.UserContainer: