@@ -25,7 +25,7 @@ import { Color, RGBA } from 'vs/base/common/color';
2525import { onUnexpectedError } from 'vs/base/common/errors' ;
2626import { Emitter , Event } from 'vs/base/common/event' ;
2727import { KeyCode } from 'vs/base/common/keyCodes' ;
28- import { dispose , IDisposable , Disposable } from 'vs/base/common/lifecycle' ;
28+ import { dispose , IDisposable , Disposable , DisposableStore } from 'vs/base/common/lifecycle' ;
2929import { ISpliceable } from 'vs/base/common/sequence' ;
3030import { escapeRegExpCharacters , startsWith } from 'vs/base/common/strings' ;
3131import { URI } from 'vs/base/common/uri' ;
@@ -941,19 +941,19 @@ export class SettingBoolRenderer extends AbstractSettingRenderer implements ITre
941941
942942 const deprecationWarningElement = DOM . append ( container , $ ( '.setting-item-deprecation-message' ) ) ;
943943
944- const toDispose : IDisposable [ ] = [ ] ;
944+ const toDispose = new DisposableStore ( ) ;
945945 const checkbox = new Checkbox ( { actionClassName : 'setting-value-checkbox' , isChecked : true , title : '' , inputActiveOptionBorder : undefined } ) ;
946946 controlElement . appendChild ( checkbox . domNode ) ;
947- toDispose . push ( checkbox ) ;
948- toDispose . push ( checkbox . onChange ( ( ) => {
947+ toDispose . add ( checkbox ) ;
948+ toDispose . add ( checkbox . onChange ( ( ) => {
949949 if ( template . onChange ) {
950950 template . onChange ( checkbox . checked ) ;
951951 }
952952 } ) ) ;
953953
954954 // Need to listen for mouse clicks on description and toggle checkbox - use target ID for safety
955955 // Also have to ignore embedded links - too buried to stop propagation
956- toDispose . push ( DOM . addDisposableListener ( descriptionElement , DOM . EventType . MOUSE_DOWN , ( e ) => {
956+ toDispose . add ( DOM . addDisposableListener ( descriptionElement , DOM . EventType . MOUSE_DOWN , ( e ) => {
957957 const targetElement = < HTMLElement > e . target ;
958958 const targetId = descriptionElement . getAttribute ( 'checkbox_label_target_id' ) ;
959959
@@ -970,10 +970,10 @@ export class SettingBoolRenderer extends AbstractSettingRenderer implements ITre
970970 checkbox . domNode . classList . add ( AbstractSettingRenderer . CONTROL_CLASS ) ;
971971 const toolbarContainer = DOM . append ( container , $ ( '.setting-toolbar-container' ) ) ;
972972 const toolbar = this . renderSettingToolbar ( toolbarContainer ) ;
973- toDispose . push ( toolbar ) ;
973+ toDispose . add ( toolbar ) ;
974974
975975 const template : ISettingBoolItemTemplate = {
976- toDispose,
976+ toDispose : [ toDispose ] ,
977977
978978 containerElement : container ,
979979 categoryElement,
@@ -989,16 +989,16 @@ export class SettingBoolRenderer extends AbstractSettingRenderer implements ITre
989989 this . addSettingElementFocusHandler ( template ) ;
990990
991991 // Prevent clicks from being handled by list
992- toDispose . push ( DOM . addDisposableListener ( controlElement , 'mousedown' , ( e : IMouseEvent ) => e . stopPropagation ( ) ) ) ;
992+ toDispose . add ( DOM . addDisposableListener ( controlElement , 'mousedown' , ( e : IMouseEvent ) => e . stopPropagation ( ) ) ) ;
993993
994- toDispose . push ( DOM . addStandardDisposableListener ( controlElement , 'keydown' , ( e : StandardKeyboardEvent ) => {
994+ toDispose . add ( DOM . addStandardDisposableListener ( controlElement , 'keydown' , ( e : StandardKeyboardEvent ) => {
995995 if ( e . keyCode === KeyCode . Escape ) {
996996 e . browserEvent . stopPropagation ( ) ;
997997 }
998998 } ) ) ;
999999
1000- toDispose . push ( DOM . addDisposableListener ( titleElement , DOM . EventType . MOUSE_ENTER , e => container . classList . add ( 'mouseover' ) ) ) ;
1001- toDispose . push ( DOM . addDisposableListener ( titleElement , DOM . EventType . MOUSE_LEAVE , e => container . classList . remove ( 'mouseover' ) ) ) ;
1000+ toDispose . add ( DOM . addDisposableListener ( titleElement , DOM . EventType . MOUSE_ENTER , e => container . classList . add ( 'mouseover' ) ) ) ;
1001+ toDispose . add ( DOM . addDisposableListener ( titleElement , DOM . EventType . MOUSE_LEAVE , e => container . classList . remove ( 'mouseover' ) ) ) ;
10021002
10031003 return template ;
10041004 }
0 commit comments