@@ -6,16 +6,18 @@ import { uploadFromBucketExplorerClipboard } from '@/commands/bucketExplorer/upl
6
6
import { copyLinkFromBucketExplorer } from '@/commands/bucketExplorer/copyLink'
7
7
import { copyFromBucketExplorerContext } from '@/commands/bucketExplorer/copyFromContext'
8
8
import { moveFromBucketExplorerContext } from '@/commands/bucketExplorer/moveFromContext'
9
+ import { BucketExplorerProvider } from './bucket'
9
10
import { CommandContext } from '@/constant'
10
11
11
- export function registerBucket ( context : vscode . ExtensionContext ) : void {
12
+ export function registerBucket ( ) : vscode . Disposable [ ] {
13
+ ext . bucketExplorer = new BucketExplorerProvider ( )
12
14
ext . bucketExplorerTreeView = vscode . window . createTreeView ( 'bucketExplorer' , {
13
15
treeDataProvider : ext . bucketExplorer ,
14
16
// TODO: support select many
15
17
// canSelectMany: true,
16
18
showCollapseAll : true
17
19
} )
18
- const registerCommands = [
20
+ const _disposable = [
19
21
vscode . commands . registerCommand (
20
22
uploadFromBucketExplorerContext . command ,
21
23
uploadFromBucketExplorerContext
@@ -43,13 +45,16 @@ export function registerBucket(context: vscode.ExtensionContext): void {
43
45
vscode . commands . registerCommand (
44
46
copyFromBucketExplorerContext . command ,
45
47
copyFromBucketExplorerContext
46
- )
48
+ ) ,
49
+ ext . bucketExplorerTreeView
47
50
]
48
- context . subscriptions . push ( ext . bucketExplorerTreeView )
49
- context . subscriptions . push ( ...registerCommands )
50
- context . subscriptions . push (
51
- ext . bucketExplorerTreeView . onDidChangeVisibility ( ( { visible } ) => {
51
+
52
+ ext . bucketExplorerTreeView . onDidChangeVisibility (
53
+ ( { visible } ) => {
52
54
ext . bucketExplorerTreeViewVisible = visible
53
- } )
55
+ } ,
56
+ null ,
57
+ _disposable
54
58
)
59
+ return _disposable
55
60
}
0 commit comments