feat: welcome view

This commit is contained in:
əlemi 2024-09-06 23:15:03 +02:00
parent a5691d550a
commit 7ff90b8a3b
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 9 additions and 14 deletions

View file

@ -25,6 +25,12 @@
}
]
},
"viewsWelcome": [
{
"view": "codemp-tree-view",
"contents": "[codemp](https://codemp.dev) -- code multiplexer\n[Connect](command:codemp.connect)"
}
],
"views": {
"codemp-tree-container": [

View file

@ -1,5 +1,4 @@
import * as vscode from 'vscode';
import * as codemp from 'codemp';
import { client, workspace, workspace_list } from './commands';
export class CodempTreeProvider implements vscode.TreeDataProvider<CodempTreeItem> {
@ -20,9 +19,6 @@ export class CodempTreeProvider implements vscode.TreeDataProvider<CodempTreeIte
async getChildren(element?: CodempTreeItem): Promise<CodempTreeItem[]> {
if (element) {
switch (element.type) {
case Type.Root:
if (client === null) { return [] };
return workspace_list.map((x) => new CodempTreeItem(x, Type.Workspace));
case Type.Workspace:
if (workspace === null) { return [] };
if (element.label == workspace.id()) {
@ -45,14 +41,8 @@ export class CodempTreeProvider implements vscode.TreeDataProvider<CodempTreeIte
return [];
}
} else {
if(client === null) {
return [
new CodempTreeItem("Connect", Type.Root)
];
}
return [
new CodempTreeItem("Codemp", Type.Root)
];
if(client === null) return [];
return workspace_list.map((x) => new CodempTreeItem(x, Type.Workspace));
}
}
@ -67,7 +57,6 @@ class CodempTreeItem extends vscode.TreeItem {
}
enum Type {
Root,
Workspace,
BufferContainer,
UserContainer,