Skip to content

Commit bc04f0c

Browse files
committed
debug: cleanup open on session start
1 parent a54c44c commit bc04f0c

5 files changed

Lines changed: 11 additions & 15 deletions

File tree

src/vs/workbench/parts/debug/common/debug.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ export const INTERNAL_CONSOLE_OPTIONS_SCHEMA = {
4747
default: 'openOnFirstSessionStart',
4848
description: nls.localize('internalConsoleOptions', "Controls behavior of the internal debug console.")
4949
};
50-
export const OPEN_DEBUG_OPTIONS_SCHEMA = {
51-
enum: ['neverOpen', 'openOnSessionStart', 'openOnFirstSessionStart'],
52-
default: 'openOnFirstSessionStart',
53-
description: nls.localize('openDebug', "Controls whether debug viewlet should be open on debugging session start.")
54-
};
5550

5651
// raw
5752

src/vs/workbench/parts/debug/common/debugViewModel.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,12 @@ export class ViewModel implements debug.IViewModel {
1717
private _onDidSelectExpression: Emitter<debug.IExpression>;
1818
private _onDidSelectFunctionBreakpoint: Emitter<debug.IFunctionBreakpoint>;
1919
private multiProcessView: boolean;
20-
public changedWorkbenchViewState: boolean;
2120

2221
constructor() {
2322
this._onDidFocusProcess = new Emitter<debug.IProcess | undefined>();
2423
this._onDidFocusStackFrame = new Emitter<{ stackFrame: debug.IStackFrame, explicit: boolean }>();
2524
this._onDidSelectExpression = new Emitter<debug.IExpression>();
2625
this._onDidSelectFunctionBreakpoint = new Emitter<debug.IFunctionBreakpoint>();
27-
this.changedWorkbenchViewState = false;
2826
this.multiProcessView = false;
2927
}
3028

src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { VariablesView, WatchExpressionsView, CallStackView, BreakpointsView } f
2020
import { Extensions as WorkbenchExtensions, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions';
2121
import {
2222
IDebugService, VIEWLET_ID, REPL_ID, CONTEXT_NOT_IN_DEBUG_MODE, CONTEXT_IN_DEBUG_MODE, INTERNAL_CONSOLE_OPTIONS_SCHEMA,
23-
CONTEXT_DEBUG_STATE, VARIABLES_VIEW_ID, CALLSTACK_VIEW_ID, WATCH_VIEW_ID, BREAKPOINTS_VIEW_ID, OPEN_DEBUG_OPTIONS_SCHEMA
23+
CONTEXT_DEBUG_STATE, VARIABLES_VIEW_ID, CALLSTACK_VIEW_ID, WATCH_VIEW_ID, BREAKPOINTS_VIEW_ID
2424
} from 'vs/workbench/parts/debug/common/debug';
2525
import { IPartService } from 'vs/workbench/services/part/common/partService';
2626
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
@@ -188,7 +188,11 @@ configurationRegistry.registerConfiguration({
188188
default: false
189189
},
190190
'debug.internalConsoleOptions': INTERNAL_CONSOLE_OPTIONS_SCHEMA,
191-
'debug.openDebug': OPEN_DEBUG_OPTIONS_SCHEMA,
191+
'debug.openDebug': {
192+
enum: ['neverOpen', 'openOnSessionStart', 'openOnFirstSessionStart'],
193+
default: 'openOnFirstSessionStart',
194+
description: nls.localize('openDebug', "Controls whether debug viewlet should be open on debugging session start.")
195+
},
192196
'launch': {
193197
type: 'object',
194198
description: nls.localize({ comment: ['This is the description for a setting'], key: 'launch' }, "Global debug launch configuration. Should be used as an alternative to 'launch.json' that is shared across workspaces"),

src/vs/workbench/parts/debug/electron-browser/debugService.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export class DebugService implements debug.IDebugService {
7979
private debugState: IContextKey<string>;
8080
private breakpointsToSendOnResourceSaved: Set<string>;
8181
private launchJsonChanged: boolean;
82+
private firstSessionStart: boolean;
8283
private previousState: debug.State;
8384

8485
constructor(
@@ -126,6 +127,7 @@ export class DebugService implements debug.IDebugService {
126127
this.loadExceptionBreakpoints(), this.loadWatchExpressions());
127128
this.toDispose.push(this.model);
128129
this.viewModel = new ViewModel();
130+
this.firstSessionStart = true;
129131

130132
this.registerListeners(lifecycleService);
131133
}
@@ -865,18 +867,16 @@ export class DebugService implements debug.IDebugService {
865867
this.focusStackFrameAndEvaluate(null, process);
866868

867869
const internalConsoleOptions = configuration.internalConsoleOptions || this.configurationService.getConfiguration<debug.IDebugConfiguration>('debug').internalConsoleOptions;
868-
if (internalConsoleOptions === 'openOnSessionStart' || (!this.viewModel.changedWorkbenchViewState && internalConsoleOptions === 'openOnFirstSessionStart')) {
870+
if (internalConsoleOptions === 'openOnSessionStart' || (this.firstSessionStart && internalConsoleOptions === 'openOnFirstSessionStart')) {
869871
this.panelService.openPanel(debug.REPL_ID, false).done(undefined, errors.onUnexpectedError);
870872
}
871873

872874
const openDebugOptions = this.configurationService.getConfiguration<debug.IDebugConfiguration>('debug').openDebug;
873875
// Open debug viewlet based on the visibility of the side bar and openDebug setting
874-
if ((this.partService.isVisible(Parts.SIDEBAR_PART) || this.contextService.getWorkbenchState() === WorkbenchState.EMPTY)
875-
&& ((openDebugOptions === 'openOnSessionStart')
876-
|| (openDebugOptions === 'openOnFirstSessionStart' && !this.viewModel.changedWorkbenchViewState))) {
877-
this.viewModel.changedWorkbenchViewState = true;
876+
if (openDebugOptions === 'openOnSessionStart' || (openDebugOptions === 'openOnFirstSessionStart' && this.firstSessionStart)) {
878877
this.viewletService.openViewlet(debug.VIEWLET_ID);
879878
}
879+
this.firstSessionStart = false;
880880

881881
this.debugType.set(configuration.type);
882882
if (this.model.getProcesses().length > 1) {

src/vs/workbench/parts/debug/test/common/debugViewModel.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ suite('Debug - View Model', () => {
4242
});
4343

4444
test('multi process view and changed workbench state', () => {
45-
assert.equal(model.changedWorkbenchViewState, false);
4645
assert.equal(model.isMultiProcessView(), false);
4746
model.setMultiProcessView(true);
4847
assert.equal(model.isMultiProcessView(), true);

0 commit comments

Comments
 (0)