when switching serial monitor on/off

open/dispose the monitor widget instead of toggling it.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
Akos Kitta 2020-07-31 15:48:35 +02:00
parent a2b3d9b314
commit 5aae800a4e

View File

@ -87,25 +87,23 @@ export class MonitorViewContribution extends AbstractViewContribution<MonitorWid
}
});
if (this.toggleCommand) {
commands.registerCommand(this.toggleCommand, {
execute: () => this.openView({
toggle: true,
activate: true
})
});
const toolbarCmd = {
id: MonitorViewContribution.TOGGLE_SERIAL_MONITOR_TOOLBAR
}
commands.registerCommand(toolbarCmd, {
commands.registerCommand(this.toggleCommand, { execute: () => this.toggle() });
commands.registerCommand({ id: MonitorViewContribution.TOGGLE_SERIAL_MONITOR_TOOLBAR }, {
isVisible: widget => ArduinoToolbar.is(widget) && widget.side === 'right',
execute: () => this.openView({
toggle: true,
activate: true
})
execute: () => this.toggle()
});
}
}
protected async toggle(): Promise<void> {
const widget = this.tryGetWidget();
if (widget) {
widget.dispose();
} else {
await this.openView({ activate: true, reveal: true });
}
}
protected renderAutoScrollButton(): React.ReactNode {
return <React.Fragment key='autoscroll-toolbar-item'>
<div