@@ -11,24 +11,25 @@ export async function activate(_context: vscode.ExtensionContext, client: BaseLa
11
11
12
12
await client . start ( ) ;
13
13
14
+ const disposes : vscode . Disposable [ ] = [ ] ;
14
15
const statusBar = vscode . window . createStatusBarItem ( vscode . StatusBarAlignment . Right ) ;
15
16
statusBar . command = 'volar.action.nameCasing' ;
16
17
17
18
update ( vscode . window . activeTextEditor ?. document ) ;
18
19
19
- const d_1 = vscode . window . onDidChangeActiveTextEditor ( e => {
20
+ disposes . push ( vscode . window . onDidChangeActiveTextEditor ( e => {
20
21
update ( e ?. document ) ;
21
- } ) ;
22
- const d_2 = vscode . workspace . onDidChangeConfiguration ( ( ) => {
22
+ } ) ) ;
23
+ disposes . push ( vscode . workspace . onDidChangeConfiguration ( ( ) => {
23
24
attrNameCasings . clear ( ) ;
24
25
tagNameCasings . clear ( ) ;
25
26
update ( vscode . window . activeTextEditor ?. document ) ;
26
- } ) ;
27
- const d_3 = vscode . workspace . onDidCloseTextDocument ( ( doc ) => {
27
+ } ) ) ;
28
+ disposes . push ( vscode . workspace . onDidCloseTextDocument ( ( doc ) => {
28
29
attrNameCasings . delete ( doc . uri . toString ( ) ) ;
29
30
tagNameCasings . delete ( doc . uri . toString ( ) ) ;
30
- } ) ;
31
- const d_4 = vscode . commands . registerCommand ( 'volar.action.nameCasing' , async ( ) => {
31
+ } ) ) ;
32
+ disposes . push ( vscode . commands . registerCommand ( 'volar.action.nameCasing' , async ( ) => {
32
33
33
34
if ( ! vscode . window . activeTextEditor ?. document ) return ;
34
35
@@ -80,14 +81,11 @@ export async function activate(_context: vscode.ExtensionContext, client: BaseLa
80
81
await convertAttr ( vscode . window . activeTextEditor , AttrNameCasing . Camel ) ;
81
82
}
82
83
updateStatusBarText ( ) ;
83
- } ) ;
84
+ } ) ) ;
84
85
85
86
client . onDidChangeState ( e => {
86
87
if ( e . newState === State . Stopped ) {
87
- d_1 . dispose ( ) ;
88
- d_2 . dispose ( ) ;
89
- d_3 . dispose ( ) ;
90
- d_4 . dispose ( ) ;
88
+ disposes . forEach ( d => d . dispose ( ) ) ;
91
89
statusBar . dispose ( ) ;
92
90
}
93
91
} ) ;
0 commit comments