1
- import { globalState } from '../services/global-state' ;
2
1
import { accountService } from '../services/account.service' ;
3
- import { Event , ProviderResult , TreeDataProvider , TreeItem , Uri } from 'vscode' ;
2
+ import { Event , ProviderResult , ThemeIcon , TreeDataProvider , TreeItem } from 'vscode' ;
4
3
5
4
export class AccountViewDataProvider implements TreeDataProvider < TreeItem > {
6
5
constructor ( ) { }
@@ -13,9 +12,8 @@ export class AccountViewDataProvider implements TreeDataProvider<TreeItem> {
13
12
return [ ] ;
14
13
}
15
14
const u = accountService . curUser ;
16
- const extensionPath = globalState . extensionContext ?. extensionPath ;
17
15
return [
18
- { label : u . name , tooltip : '用户名' , iconPath : Uri . parse ( ` ${ extensionPath } /dist/assets/icon-avatar.svg` ) } ,
16
+ { label : u . name , tooltip : '用户名' , iconPath : new ThemeIcon ( 'account' ) } ,
19
17
{
20
18
label : '账户设置' ,
21
19
tooltip : '账户设置' ,
@@ -24,7 +22,7 @@ export class AccountViewDataProvider implements TreeDataProvider<TreeItem> {
24
22
command : 'vscode-cnb.open-my-account-settings' ,
25
23
tooltip : '浏览器中打开我的账户设置' ,
26
24
} ,
27
- iconPath : Uri . parse ( ` ${ extensionPath } /dist/assets/icon-account-settings.svg` ) ,
25
+ iconPath : new ThemeIcon ( 'gear' ) ,
28
26
} ,
29
27
{
30
28
label : '博客后台' ,
@@ -34,7 +32,7 @@ export class AccountViewDataProvider implements TreeDataProvider<TreeItem> {
34
32
command : 'vscode-cnb.open-my-blog-management-background' ,
35
33
tooltip : '浏览器中打开我的博客后台' ,
36
34
} ,
37
- iconPath : Uri . parse ( ` ${ extensionPath } /dist/assets/icon-blog-management.svg` ) ,
35
+ iconPath : new ThemeIcon ( 'console' ) ,
38
36
} ,
39
37
{
40
38
label : '我的博客' ,
@@ -44,7 +42,7 @@ export class AccountViewDataProvider implements TreeDataProvider<TreeItem> {
44
42
command : 'vscode-cnb.open-my-blog' ,
45
43
tooltip : '浏览器中打开我的博客' ,
46
44
} ,
47
- iconPath : Uri . parse ( ` ${ extensionPath } /dist/assets/icon-blog.svg` ) ,
45
+ iconPath : new ThemeIcon ( 'window' ) ,
48
46
} ,
49
47
{
50
48
label : '我的主页' ,
@@ -54,7 +52,16 @@ export class AccountViewDataProvider implements TreeDataProvider<TreeItem> {
54
52
command : 'vscode-cnb.open-my-home-page' ,
55
53
tooltip : '浏览器中打开我的博客' ,
56
54
} ,
57
- iconPath : Uri . parse ( `${ extensionPath } /dist/assets/icon-home.svg` ) ,
55
+ iconPath : new ThemeIcon ( 'home' ) ,
56
+ } ,
57
+ {
58
+ label : '退出登录' ,
59
+ tooltip : '' ,
60
+ command : {
61
+ title : '退出登录' ,
62
+ command : 'vscode-cnb.logout' ,
63
+ } ,
64
+ iconPath : new ThemeIcon ( 'log-out' ) ,
58
65
} ,
59
66
] ;
60
67
}
0 commit comments