File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
src/vs/workbench/contrib/share/browser Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ const targetMenus = [
47
47
class ShareWorkbenchContribution {
48
48
private static SHARE_ENABLED_SETTING = 'workbench.experimental.share.enabled' ;
49
49
50
- private _disposables = new DisposableStore ( ) ;
50
+ private _disposables : DisposableStore | undefined ;
51
51
52
52
constructor (
53
53
@IShareService private readonly shareService : IShareService ,
@@ -58,16 +58,22 @@ class ShareWorkbenchContribution {
58
58
}
59
59
this . configurationService . onDidChangeConfiguration ( e => {
60
60
if ( e . affectsConfiguration ( ShareWorkbenchContribution . SHARE_ENABLED_SETTING ) ) {
61
- if ( this . configurationService . getValue < boolean > ( ShareWorkbenchContribution . SHARE_ENABLED_SETTING ) ) {
61
+ const settingValue = this . configurationService . getValue < boolean > ( ShareWorkbenchContribution . SHARE_ENABLED_SETTING ) ;
62
+ if ( settingValue === true && this . _disposables === undefined ) {
62
63
this . registerActions ( ) ;
63
- } else {
64
- this . _disposables . clear ( ) ;
64
+ } else if ( settingValue === false && this . _disposables !== undefined ) {
65
+ this . _disposables ?. clear ( ) ;
66
+ this . _disposables = undefined ;
65
67
}
66
68
}
67
69
} ) ;
68
70
}
69
71
70
72
private registerActions ( ) {
73
+ if ( ! this . _disposables ) {
74
+ this . _disposables = new DisposableStore ( ) ;
75
+ }
76
+
71
77
this . _disposables . add (
72
78
registerAction2 ( class ShareAction extends Action2 {
73
79
static readonly ID = 'workbench.action.share' ;
You can’t perform that action at this time.
0 commit comments