@@ -32,7 +32,7 @@ import { IProgressService, ProgressLocation } from '../../../../platform/progres
32
32
import { ICodeEditorService } from '../../../../editor/browser/services/codeEditorService.js' ;
33
33
import { IConfigurationRegistry , Extensions as ConfigurationExtensions } from '../../../../platform/configuration/common/configurationRegistry.js' ;
34
34
import { workbenchConfigurationNodeBase } from '../../../common/configuration.js' ;
35
- import { DisposableStore } from '../../../../base/common/lifecycle.js' ;
35
+ import { Disposable , DisposableStore } from '../../../../base/common/lifecycle.js' ;
36
36
37
37
const targetMenus = [
38
38
MenuId . EditorContextShare ,
@@ -44,7 +44,7 @@ const targetMenus = [
44
44
MenuId . ExplorerContextShare
45
45
] ;
46
46
47
- class ShareWorkbenchContribution {
47
+ class ShareWorkbenchContribution extends Disposable {
48
48
private static SHARE_ENABLED_SETTING = 'workbench.experimental.share.enabled' ;
49
49
50
50
private _disposables : DisposableStore | undefined ;
@@ -53,10 +53,12 @@ class ShareWorkbenchContribution {
53
53
@IShareService private readonly shareService : IShareService ,
54
54
@IConfigurationService private readonly configurationService : IConfigurationService
55
55
) {
56
+ super ( ) ;
57
+
56
58
if ( this . configurationService . getValue < boolean > ( ShareWorkbenchContribution . SHARE_ENABLED_SETTING ) ) {
57
59
this . registerActions ( ) ;
58
60
}
59
- this . configurationService . onDidChangeConfiguration ( e => {
61
+ this . _register ( this . configurationService . onDidChangeConfiguration ( e => {
60
62
if ( e . affectsConfiguration ( ShareWorkbenchContribution . SHARE_ENABLED_SETTING ) ) {
61
63
const settingValue = this . configurationService . getValue < boolean > ( ShareWorkbenchContribution . SHARE_ENABLED_SETTING ) ;
62
64
if ( settingValue === true && this . _disposables === undefined ) {
@@ -66,7 +68,12 @@ class ShareWorkbenchContribution {
66
68
this . _disposables = undefined ;
67
69
}
68
70
}
69
- } ) ;
71
+ } ) ) ;
72
+ }
73
+
74
+ override dispose ( ) : void {
75
+ super . dispose ( ) ;
76
+ this . _disposables ?. dispose ( ) ;
70
77
}
71
78
72
79
private registerActions ( ) {
0 commit comments