mirror of
https://github.com/hexedtech/codemp-vscode.git
synced 2024-11-22 15:34:49 +01:00
fix: update codemp and usage
This commit is contained in:
parent
cc5d93570b
commit
366f5aec82
4 changed files with 21 additions and 10 deletions
|
@ -6,7 +6,7 @@
|
||||||
"homepage": "https://code.mp",
|
"homepage": "https://code.mp",
|
||||||
"repository": "https://github.com/hexedtech/codemp-vscode",
|
"repository": "https://github.com/hexedtech/codemp-vscode",
|
||||||
"publisher": "hexedtech",
|
"publisher": "hexedtech",
|
||||||
"version": "0.0.6",
|
"version": "0.0.10",
|
||||||
"engines": {
|
"engines": {
|
||||||
"vscode": "^1.81.0"
|
"vscode": "^1.81.0"
|
||||||
},
|
},
|
||||||
|
@ -206,6 +206,6 @@
|
||||||
"typescript": "^5.1.6"
|
"typescript": "^5.1.6"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"codemp": "^0.0.5"
|
"codemp": "^0.0.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ let locks : Map<string, boolean> = new Map();
|
||||||
|
|
||||||
export async function connect() {
|
export async function connect() {
|
||||||
let config = vscode.workspace.getConfiguration('codemp');
|
let config = vscode.workspace.getConfiguration('codemp');
|
||||||
let server = config.get<string>("server", "http://code.mp:50053");
|
|
||||||
|
|
||||||
let username = config.get<string>("username");
|
let username = config.get<string>("username");
|
||||||
if (!username) {
|
if (!username) {
|
||||||
|
@ -23,10 +22,21 @@ export async function connect() {
|
||||||
if (!password) {
|
if (!password) {
|
||||||
return vscode.window.showErrorMessage("missing password in settings: configure it first!");
|
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");
|
vscode.window.showInformationMessage("Connected to codemp");
|
||||||
client = await codemp.connect(server, username, password);
|
|
||||||
provider.refresh();
|
provider.refresh();
|
||||||
listWorkspaces(); // dont await, run in background
|
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() {
|
export async function listBuffers() {
|
||||||
if (workspace === null) throw "join a workspace first"
|
if (workspace === null) throw "join a workspace first"
|
||||||
let buffers = workspace.filetree();
|
let buffers = workspace.filetree(undefined, false);
|
||||||
vscode.window.showInformationMessage(buffers.join("\n"));
|
vscode.window.showInformationMessage(buffers.join("\n"));
|
||||||
provider.refresh();
|
provider.refresh();
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ export function activate(context: vscode.ExtensionContext) {
|
||||||
vscode.commands.registerCommand('codemp.connect', commands.connect),
|
vscode.commands.registerCommand('codemp.connect', commands.connect),
|
||||||
vscode.commands.registerCommand('codemp.join', commands.join),
|
vscode.commands.registerCommand('codemp.join', commands.join),
|
||||||
vscode.commands.registerCommand('codemp.attach', commands.attach),
|
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.createWorkspace', commands.createWorkspace),
|
||||||
vscode.commands.registerCommand('codemp.inviteWorkspace', commands.inviteToWorkspace),
|
vscode.commands.registerCommand('codemp.inviteWorkspace', commands.inviteToWorkspace),
|
||||||
vscode.commands.registerCommand('codemp.listWorkspaces', commands.listWorkspaces),
|
vscode.commands.registerCommand('codemp.listWorkspaces', commands.listWorkspaces),
|
||||||
|
|
|
@ -27,7 +27,7 @@ export class CodempTreeProvider implements vscode.TreeDataProvider<CodempTreeIte
|
||||||
// new CodempTreeItem("Buffers", Type.BufferContainer, true),
|
// new CodempTreeItem("Buffers", Type.BufferContainer, true),
|
||||||
// new CodempTreeItem("Users", Type.UserContainer, 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))
|
new CodempTreeItem(x, Type.Buffer, false, bufferMapper.bufferToEditorMapping.has(x))
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -35,7 +35,7 @@ export class CodempTreeProvider implements vscode.TreeDataProvider<CodempTreeIte
|
||||||
}
|
}
|
||||||
case Type.BufferContainer:
|
case Type.BufferContainer:
|
||||||
if (workspace === null) { return [] };
|
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))
|
new CodempTreeItem(x, Type.Buffer, false, bufferMapper.bufferToEditorMapping.has(x))
|
||||||
);
|
);
|
||||||
case Type.UserContainer:
|
case Type.UserContainer:
|
||||||
|
|
Loading…
Reference in a new issue