mirror of
https://github.com/hexedtech/codemp-vscode.git
synced 2024-12-23 05:54:51 +01:00
feat: welcome view
This commit is contained in:
parent
a5691d550a
commit
7ff90b8a3b
2 changed files with 9 additions and 14 deletions
|
@ -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": [
|
||||
|
|
17
src/tree.ts
17
src/tree.ts
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -66,8 +56,7 @@ class CodempTreeItem extends vscode.TreeItem {
|
|||
}
|
||||
}
|
||||
|
||||
enum Type{
|
||||
Root,
|
||||
enum Type {
|
||||
Workspace,
|
||||
BufferContainer,
|
||||
UserContainer,
|
||||
|
|
Loading…
Reference in a new issue