Skip to content

Commit

Permalink
debug: simplify context keys computation
Browse files Browse the repository at this point in the history
fixes #54378
  • Loading branch information
isidorn committed Jul 20, 2018
1 parent 0ef2155 commit f07a198
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/vs/workbench/parts/debug/common/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ export const BREAKPOINTS_VIEW_ID = 'workbench.debug.breakPointsView';
export const REPL_ID = 'workbench.panel.repl';
export const DEBUG_SERVICE_ID = 'debugService';
export const CONTEXT_DEBUG_TYPE = new RawContextKey<string>('debugType', undefined);
export const CONTEXT_DEBUG_STATE = new RawContextKey<string>('debugState', undefined);
export const CONTEXT_IN_DEBUG_MODE = new RawContextKey<boolean>('inDebugMode', false);
export const CONTEXT_NOT_IN_DEBUG_MODE: ContextKeyExpr = CONTEXT_IN_DEBUG_MODE.toNegated();
export const CONTEXT_DEBUG_STATE = new RawContextKey<string>('debugState', 'inactive');
export const CONTEXT_NOT_IN_DEBUG_MODE = CONTEXT_DEBUG_STATE.isEqualTo('inactive');
export const CONTEXT_IN_DEBUG_MODE = CONTEXT_DEBUG_STATE.notEqualsTo('inactive');
export const CONTEXT_IN_DEBUG_REPL = new RawContextKey<boolean>('inDebugRepl', false);
export const CONTEXT_NOT_IN_DEBUG_REPL: ContextKeyExpr = CONTEXT_IN_DEBUG_REPL.toNegated();
export const CONTEXT_BREAKPOINT_WIDGET_VISIBLE = new RawContextKey<boolean>('breakpointWidgetVisible', false);
Expand Down
7 changes: 0 additions & 7 deletions src/vs/workbench/parts/debug/electron-browser/debugService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export class DebugService implements debug.IDebugService {
private configurationManager: ConfigurationManager;
private toDispose: lifecycle.IDisposable[];
private toDisposeOnSessionEnd: Map<string, lifecycle.IDisposable[]>;
private inDebugMode: IContextKey<boolean>;
private debugType: IContextKey<string>;
private debugState: IContextKey<string>;
private breakpointsToSendOnResourceSaved: Set<string>;
Expand Down Expand Up @@ -120,7 +119,6 @@ export class DebugService implements debug.IDebugService {

this.configurationManager = this.instantiationService.createInstance(ConfigurationManager);
this.toDispose.push(this.configurationManager);
this.inDebugMode = debug.CONTEXT_IN_DEBUG_MODE.bindTo(contextKeyService);
this.debugType = debug.CONTEXT_DEBUG_TYPE.bindTo(contextKeyService);
this.debugState = debug.CONTEXT_DEBUG_STATE.bindTo(contextKeyService);

Expand Down Expand Up @@ -909,7 +907,6 @@ export class DebugService implements debug.IDebugService {

const resolved = configuration.resolved;
resolved.__sessionId = sessionId;
this.inDebugMode.set(true);

const dbg = this.configurationManager.getDebugger(resolved.type);
return this.initializeRawSession(root, configuration, sessionId).then(session => {
Expand Down Expand Up @@ -985,9 +982,6 @@ export class DebugService implements debug.IDebugService {
if (this.model.getReplElements().length > 0) {
this.panelService.openPanel(debug.REPL_ID, false).done(undefined, errors.onUnexpectedError);
}
if (this.model.getSessions().length === 0) {
this.inDebugMode.reset();
}

this.showError(errorMessage, errors.isErrorWithActions(error) ? error.actions : []);
return undefined;
Expand Down Expand Up @@ -1209,7 +1203,6 @@ export class DebugService implements debug.IDebugService {
this.updateStateAndEmit(raw.getId(), debug.State.Inactive);

if (this.model.getSessions().length === 0) {
this.inDebugMode.reset();
this.debugType.reset();
this.viewModel.setMultiSessionView(false);

Expand Down

0 comments on commit f07a198

Please sign in to comment.