File tree Expand file tree Collapse file tree 1 file changed +12
-14
lines changed
arduino-ide-extension/src/browser/monitor Expand file tree Collapse file tree 1 file changed +12
-14
lines changed Original file line number Diff line number Diff line change @@ -87,25 +87,23 @@ export class MonitorViewContribution extends AbstractViewContribution<MonitorWid
87
87
}
88
88
} ) ;
89
89
if ( this . toggleCommand ) {
90
- commands . registerCommand ( this . toggleCommand , {
91
- execute : ( ) => this . openView ( {
92
- toggle : true ,
93
- activate : true
94
- } )
95
- } ) ;
96
- const toolbarCmd = {
97
- id : MonitorViewContribution . TOGGLE_SERIAL_MONITOR_TOOLBAR
98
- }
99
- commands . registerCommand ( toolbarCmd , {
90
+ commands . registerCommand ( this . toggleCommand , { execute : ( ) => this . toggle ( ) } ) ;
91
+ commands . registerCommand ( { id : MonitorViewContribution . TOGGLE_SERIAL_MONITOR_TOOLBAR } , {
100
92
isVisible : widget => ArduinoToolbar . is ( widget ) && widget . side === 'right' ,
101
- execute : ( ) => this . openView ( {
102
- toggle : true ,
103
- activate : true
104
- } )
93
+ execute : ( ) => this . toggle ( )
105
94
} ) ;
106
95
}
107
96
}
108
97
98
+ protected async toggle ( ) : Promise < void > {
99
+ const widget = this . tryGetWidget ( ) ;
100
+ if ( widget ) {
101
+ widget . dispose ( ) ;
102
+ } else {
103
+ await this . openView ( { activate : true , reveal : true } ) ;
104
+ }
105
+ }
106
+
109
107
protected renderAutoScrollButton ( ) : React . ReactNode {
110
108
return < React . Fragment key = 'autoscroll-toolbar-item' >
111
109
< div
You can’t perform that action at this time.
0 commit comments