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 = [
4747class ShareWorkbenchContribution {
4848 private static SHARE_ENABLED_SETTING = 'workbench.experimental.share.enabled' ;
4949
50- private _disposables = new DisposableStore ( ) ;
50+ private _disposables : DisposableStore | undefined ;
5151
5252 constructor (
5353 @IShareService private readonly shareService : IShareService ,
@@ -58,16 +58,22 @@ class ShareWorkbenchContribution {
5858 }
5959 this . configurationService . onDidChangeConfiguration ( e => {
6060 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 ) {
6263 this . registerActions ( ) ;
63- } else {
64- this . _disposables . clear ( ) ;
64+ } else if ( settingValue === false && this . _disposables !== undefined ) {
65+ this . _disposables ?. clear ( ) ;
66+ this . _disposables = undefined ;
6567 }
6668 }
6769 } ) ;
6870 }
6971
7072 private registerActions ( ) {
73+ if ( ! this . _disposables ) {
74+ this . _disposables = new DisposableStore ( ) ;
75+ }
76+
7177 this . _disposables . add (
7278 registerAction2 ( class ShareAction extends Action2 {
7379 static readonly ID = 'workbench.action.share' ;
You can’t perform that action at this time.
0 commit comments