mirror of
https://github.com/hexedtech/codemp-vscode.git
synced 2024-11-22 07:24:49 +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": {
|
"views": {
|
||||||
"codemp-tree-container": [
|
"codemp-tree-container": [
|
||||||
|
|
17
src/tree.ts
17
src/tree.ts
|
@ -1,5 +1,4 @@
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import * as codemp from 'codemp';
|
|
||||||
import { client, workspace, workspace_list } from './commands';
|
import { client, workspace, workspace_list } from './commands';
|
||||||
|
|
||||||
export class CodempTreeProvider implements vscode.TreeDataProvider<CodempTreeItem> {
|
export class CodempTreeProvider implements vscode.TreeDataProvider<CodempTreeItem> {
|
||||||
|
@ -20,9 +19,6 @@ export class CodempTreeProvider implements vscode.TreeDataProvider<CodempTreeIte
|
||||||
async getChildren(element?: CodempTreeItem): Promise<CodempTreeItem[]> {
|
async getChildren(element?: CodempTreeItem): Promise<CodempTreeItem[]> {
|
||||||
if (element) {
|
if (element) {
|
||||||
switch (element.type) {
|
switch (element.type) {
|
||||||
case Type.Root:
|
|
||||||
if (client === null) { return [] };
|
|
||||||
return workspace_list.map((x) => new CodempTreeItem(x, Type.Workspace));
|
|
||||||
case Type.Workspace:
|
case Type.Workspace:
|
||||||
if (workspace === null) { return [] };
|
if (workspace === null) { return [] };
|
||||||
if (element.label == workspace.id()) {
|
if (element.label == workspace.id()) {
|
||||||
|
@ -45,14 +41,8 @@ export class CodempTreeProvider implements vscode.TreeDataProvider<CodempTreeIte
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(client === null) {
|
if(client === null) return [];
|
||||||
return [
|
return workspace_list.map((x) => new CodempTreeItem(x, Type.Workspace));
|
||||||
new CodempTreeItem("Connect", Type.Root)
|
|
||||||
];
|
|
||||||
}
|
|
||||||
return [
|
|
||||||
new CodempTreeItem("Codemp", Type.Root)
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -66,8 +56,7 @@ class CodempTreeItem extends vscode.TreeItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Type{
|
enum Type {
|
||||||
Root,
|
|
||||||
Workspace,
|
Workspace,
|
||||||
BufferContainer,
|
BufferContainer,
|
||||||
UserContainer,
|
UserContainer,
|
||||||
|
|
Loading…
Reference in a new issue