debug.hideActionBar

fixes #21696
This commit is contained in:
isidor 2017-03-02 11:33:48 +01:00
parent d2ae4d766a
commit adc4ebf7ef
3 changed files with 15 additions and 11 deletions

View file

@ -18,16 +18,15 @@ import { EventType } from 'vs/base/common/events';
import { ActionBar, ActionsOrientation } from 'vs/base/browser/ui/actionbar/actionbar'; import { ActionBar, ActionsOrientation } from 'vs/base/browser/ui/actionbar/actionbar';
import { IPartService } from 'vs/workbench/services/part/common/partService'; import { IPartService } from 'vs/workbench/services/part/common/partService';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions'; import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import * as debug from 'vs/workbench/parts/debug/common/debug'; import { IDebugConfiguration, IDebugService, State } from 'vs/workbench/parts/debug/common/debug';
import { AbstractDebugAction, PauseAction, ContinueAction, StepBackAction, ReverseContinueAction, StopAction, DisconnectAction, StepOverAction, StepIntoAction, StepOutAction, RestartAction, FocusProcessAction } from 'vs/workbench/parts/debug/browser/debugActions'; import { AbstractDebugAction, PauseAction, ContinueAction, StepBackAction, ReverseContinueAction, StopAction, DisconnectAction, StepOverAction, StepIntoAction, StepOutAction, RestartAction, FocusProcessAction } from 'vs/workbench/parts/debug/browser/debugActions';
import { FocusProcessActionItem } from 'vs/workbench/parts/debug/browser/debugActionItems'; import { FocusProcessActionItem } from 'vs/workbench/parts/debug/browser/debugActionItems';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { IMessageService } from 'vs/platform/message/common/message'; import { IMessageService } from 'vs/platform/message/common/message';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import IDebugService = debug.IDebugService;
const $ = builder.$; const $ = builder.$;
const DEBUG_ACTIONS_WIDGET_POSITION_KEY = 'debug.actionswidgetposition'; const DEBUG_ACTIONS_WIDGET_POSITION_KEY = 'debug.actionswidgetposition';
@ -51,7 +50,8 @@ export class DebugActionsWidget implements IWorkbenchContribution {
@IDebugService private debugService: IDebugService, @IDebugService private debugService: IDebugService,
@IInstantiationService private instantiationService: IInstantiationService, @IInstantiationService private instantiationService: IInstantiationService,
@IPartService private partService: IPartService, @IPartService private partService: IPartService,
@IStorageService private storageService: IStorageService @IStorageService private storageService: IStorageService,
@IConfigurationService private configurationService: IConfigurationService
) { ) {
this.$el = $().div().addClass('debug-actions-widget').style('top', `${partService.getTitleBarOffset()}px`); this.$el = $().div().addClass('debug-actions-widget').style('top', `${partService.getTitleBarOffset()}px`);
this.dragArea = $().div().addClass('drag-area'); this.dragArea = $().div().addClass('drag-area');
@ -86,9 +86,8 @@ export class DebugActionsWidget implements IWorkbenchContribution {
} }
private registerListeners(): void { private registerListeners(): void {
this.toDispose.push(this.debugService.onDidChangeState(() => { this.toDispose.push(this.debugService.onDidChangeState(() => this.update()));
this.update(); this.toDispose.push(this.configurationService.onDidUpdateConfiguration(() => this.update()));
}));
this.toDispose.push(this.actionBar.actionRunner.addListener2(EventType.RUN, (e: any) => { this.toDispose.push(this.actionBar.actionRunner.addListener2(EventType.RUN, (e: any) => {
// check for error // check for error
if (e.error && !errors.isPromiseCanceledError(e.error)) { if (e.error && !errors.isPromiseCanceledError(e.error)) {
@ -156,8 +155,7 @@ export class DebugActionsWidget implements IWorkbenchContribution {
} }
private update(): void { private update(): void {
const state = this.debugService.state; if (this.debugService.state === State.Inactive || this.configurationService.getConfiguration<IDebugConfiguration>('debug').hideActionBar) {
if (state === debug.State.Inactive) {
return this.hide(); return this.hide();
} }
@ -214,10 +212,10 @@ export class DebugActionsWidget implements IWorkbenchContribution {
return this.allActions.filter(a => { return this.allActions.filter(a => {
if (a.id === ContinueAction.ID) { if (a.id === ContinueAction.ID) {
return state !== debug.State.Running; return state !== State.Running;
} }
if (a.id === PauseAction.ID) { if (a.id === PauseAction.ID) {
return state === debug.State.Running; return state === State.Running;
} }
if (a.id === StepBackAction.ID) { if (a.id === StepBackAction.ID) {
return process && process.session.capabilities.supportsStepBack; return process && process.session.capabilities.supportsStepBack;

View file

@ -277,6 +277,7 @@ export interface IDebugConfiguration {
allowBreakpointsEverywhere: boolean; allowBreakpointsEverywhere: boolean;
openExplorerOnEnd: boolean; openExplorerOnEnd: boolean;
inlineValues: boolean; inlineValues: boolean;
hideActionBar: boolean;
} }
export interface IGlobalConfig { export interface IGlobalConfig {

View file

@ -165,6 +165,11 @@ configurationRegistry.registerConfiguration({
type: 'boolean', type: 'boolean',
description: nls.localize({ comment: ['This is the description for a setting'], key: 'inlineValues' }, "Show variable values inline in editor while debugging"), description: nls.localize({ comment: ['This is the description for a setting'], key: 'inlineValues' }, "Show variable values inline in editor while debugging"),
default: false default: false
},
'debug.hideActionBar': {
type: 'boolean',
description: nls.localize({ comment: ['This is the description for a setting'], key: 'hideActionBar' }, "Controls if the floating debug action bar should be hidden"),
default: false
} }
} }
}); });