Skip to content

Commit da818d1

Browse files
committed
debug: introduce debuggersAvailable context
1 parent 3f392ec commit da818d1

6 files changed

Lines changed: 45 additions & 46 deletions

File tree

src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import { isSafari } from 'vs/base/browser/browser';
3535
import { registerThemingParticipant, themeColorFromId } from 'vs/platform/theme/common/themeService';
3636
import { registerColor } from 'vs/platform/theme/common/colorRegistry';
3737
import { ILabelService } from 'vs/platform/label/common/label';
38-
import { debugAdapterRegisteredEmitter } from 'vs/workbench/contrib/debug/browser/debugConfigurationManager';
3938

4039
const $ = dom.$;
4140

@@ -169,20 +168,16 @@ export class BreakpointEditorContribution implements IBreakpointEditorContributi
169168
) {
170169
this.breakpointWidgetVisible = CONTEXT_BREAKPOINT_WIDGET_VISIBLE.bindTo(contextKeyService);
171170
this.setDecorationsScheduler = new RunOnceScheduler(() => this.setDecorations(), 30);
172-
const manager = this.debugService.getConfigurationManager();
173-
if (manager.hasDebuggers()) {
174-
this.registerListeners();
175-
this.setDecorationsScheduler.schedule();
176-
} else {
177-
this.toDispose.push(debugAdapterRegisteredEmitter.event(() => {
178-
this.registerListeners();
179-
this.setDecorationsScheduler.schedule();
180-
}));
181-
}
171+
this.registerListeners();
172+
this.setDecorationsScheduler.schedule();
182173
}
183174

184175
private registerListeners(): void {
185176
this.toDispose.push(this.editor.onMouseDown(async (e: IEditorMouseEvent) => {
177+
if (!this.debugService.getConfigurationManager().hasDebuggers()) {
178+
return;
179+
}
180+
186181
const data = e.target.detail as IMarginData;
187182
const model = this.editor.getModel();
188183
if (!e.target.position || !model || e.target.type !== MouseTargetType.GUTTER_GLYPH_MARGIN || data.isAfterLines || !this.marginFreeFromNonDebugDecorations(e.target.position.lineNumber)) {
@@ -257,6 +252,10 @@ export class BreakpointEditorContribution implements IBreakpointEditorContributi
257252
* 2. When users click on line numbers, the breakpoint hint displays immediately, however it doesn't create the breakpoint unless users click on the left gutter. On a touch screen, it's hard to click on that small area.
258253
*/
259254
this.toDispose.push(this.editor.onMouseMove((e: IEditorMouseEvent) => {
255+
if (!this.debugService.getConfigurationManager().hasDebuggers()) {
256+
return;
257+
}
258+
260259
let showBreakpointHintAtLineNumber = -1;
261260
const model = this.editor.getModel();
262261
if (model && e.target.position && (e.target.type === MouseTargetType.GUTTER_GLYPH_MARGIN || e.target.type === MouseTargetType.GUTTER_LINE_NUMBERS) && this.debugService.getConfigurationManager().canSetBreakpointsIn(model) &&

src/vs/workbench/contrib/debug/browser/debug.contribution.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { CallStackView } from 'vs/workbench/contrib/debug/browser/callStackView'
1717
import { Extensions as WorkbenchExtensions, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions';
1818
import {
1919
IDebugService, VIEWLET_ID, DEBUG_PANEL_ID, CONTEXT_IN_DEBUG_MODE, INTERNAL_CONSOLE_OPTIONS_SCHEMA,
20-
CONTEXT_DEBUG_STATE, VARIABLES_VIEW_ID, CALLSTACK_VIEW_ID, WATCH_VIEW_ID, BREAKPOINTS_VIEW_ID, LOADED_SCRIPTS_VIEW_ID, CONTEXT_LOADED_SCRIPTS_SUPPORTED, CONTEXT_FOCUSED_SESSION_IS_ATTACH, CONTEXT_STEP_BACK_SUPPORTED, CONTEXT_CALLSTACK_ITEM_TYPE, CONTEXT_RESTART_FRAME_SUPPORTED, CONTEXT_JUMP_TO_CURSOR_SUPPORTED, CONTEXT_DEBUG_UX, BREAKPOINT_EDITOR_CONTRIBUTION_ID, REPL_VIEW_ID, CONTEXT_BREAKPOINTS_EXIST, EDITOR_CONTRIBUTION_ID,
20+
CONTEXT_DEBUG_STATE, VARIABLES_VIEW_ID, CALLSTACK_VIEW_ID, WATCH_VIEW_ID, BREAKPOINTS_VIEW_ID, LOADED_SCRIPTS_VIEW_ID, CONTEXT_LOADED_SCRIPTS_SUPPORTED, CONTEXT_FOCUSED_SESSION_IS_ATTACH, CONTEXT_STEP_BACK_SUPPORTED, CONTEXT_CALLSTACK_ITEM_TYPE, CONTEXT_RESTART_FRAME_SUPPORTED, CONTEXT_JUMP_TO_CURSOR_SUPPORTED, CONTEXT_DEBUG_UX, BREAKPOINT_EDITOR_CONTRIBUTION_ID, REPL_VIEW_ID, CONTEXT_BREAKPOINTS_EXIST, EDITOR_CONTRIBUTION_ID, CONTEXT_DEBUGGERS_AVAILABLE,
2121
} from 'vs/workbench/contrib/debug/common/debug';
2222
import { StartAction, AddFunctionBreakpointAction, ConfigureAction, DisableAllBreakpointsAction, EnableAllBreakpointsAction, RemoveAllBreakpointsAction, RunAction, ReapplyBreakpointsAction, SelectAndStartAction } from 'vs/workbench/contrib/debug/browser/debugActions';
2323
import { DebugToolBar } from 'vs/workbench/contrib/debug/browser/debugToolBar';
@@ -56,16 +56,15 @@ import { DebugEditorContribution } from 'vs/workbench/contrib/debug/browser/debu
5656
const registry = Registry.as<IWorkbenchActionRegistry>(WorkbenchActionRegistryExtensions.WorkbenchActions);
5757
const debugCategory = nls.localize('debugCategory', "Debug");
5858
const runCategroy = nls.localize('runCategory', "Run");
59-
// register service
6059
registerWorkbenchContributions();
6160
registerColors();
6261
registerCommandsAndActions();
6362
registerDebugMenu();
6463
registerEditorActions();
6564
registerCommands();
6665
registerDebugPanel();
67-
registry.registerWorkbenchAction(SyncActionDescriptor.from(StartAction, { primary: KeyCode.F5 }, CONTEXT_IN_DEBUG_MODE.toNegated()), 'Debug: Start Debugging', debugCategory);
68-
registry.registerWorkbenchAction(SyncActionDescriptor.from(RunAction, { primary: KeyMod.CtrlCmd | KeyCode.F5, mac: { primary: KeyMod.WinCtrl | KeyCode.F5 } }), 'Run: Start Without Debugging', runCategroy);
66+
registry.registerWorkbenchAction(SyncActionDescriptor.from(StartAction, { primary: KeyCode.F5 }, CONTEXT_IN_DEBUG_MODE.toNegated()), 'Debug: Start Debugging', debugCategory, CONTEXT_DEBUGGERS_AVAILABLE);
67+
registry.registerWorkbenchAction(SyncActionDescriptor.from(RunAction, { primary: KeyMod.CtrlCmd | KeyCode.F5, mac: { primary: KeyMod.WinCtrl | KeyCode.F5 } }), 'Run: Start Without Debugging', runCategroy, CONTEXT_DEBUGGERS_AVAILABLE);
6968

7069
registerSingleton(IDebugService, DebugService, true);
7170
registerDebugView();
@@ -102,18 +101,18 @@ function regsiterEditorContributions(): void {
102101

103102
function registerCommandsAndActions(): void {
104103

105-
registry.registerWorkbenchAction(SyncActionDescriptor.from(ConfigureAction), 'Debug: Open launch.json', debugCategory);
106-
registry.registerWorkbenchAction(SyncActionDescriptor.from(AddFunctionBreakpointAction), 'Debug: Add Function Breakpoint', debugCategory);
107-
registry.registerWorkbenchAction(SyncActionDescriptor.from(ReapplyBreakpointsAction), 'Debug: Reapply All Breakpoints', debugCategory);
108-
registry.registerWorkbenchAction(SyncActionDescriptor.from(RemoveAllBreakpointsAction), 'Debug: Remove All Breakpoints', debugCategory);
109-
registry.registerWorkbenchAction(SyncActionDescriptor.from(EnableAllBreakpointsAction), 'Debug: Enable All Breakpoints', debugCategory);
110-
registry.registerWorkbenchAction(SyncActionDescriptor.from(DisableAllBreakpointsAction), 'Debug: Disable All Breakpoints', debugCategory);
111-
registry.registerWorkbenchAction(SyncActionDescriptor.from(SelectAndStartAction), 'Debug: Select and Start Debugging', debugCategory);
112-
registry.registerWorkbenchAction(SyncActionDescriptor.from(ClearReplAction), 'Debug: Clear Console', debugCategory);
104+
registry.registerWorkbenchAction(SyncActionDescriptor.from(ConfigureAction), 'Debug: Open launch.json', debugCategory, CONTEXT_DEBUGGERS_AVAILABLE);
105+
registry.registerWorkbenchAction(SyncActionDescriptor.from(AddFunctionBreakpointAction), 'Debug: Add Function Breakpoint', debugCategory, CONTEXT_DEBUGGERS_AVAILABLE);
106+
registry.registerWorkbenchAction(SyncActionDescriptor.from(ReapplyBreakpointsAction), 'Debug: Reapply All Breakpoints', debugCategory, CONTEXT_DEBUGGERS_AVAILABLE);
107+
registry.registerWorkbenchAction(SyncActionDescriptor.from(RemoveAllBreakpointsAction), 'Debug: Remove All Breakpoints', debugCategory, CONTEXT_DEBUGGERS_AVAILABLE);
108+
registry.registerWorkbenchAction(SyncActionDescriptor.from(EnableAllBreakpointsAction), 'Debug: Enable All Breakpoints', debugCategory, CONTEXT_DEBUGGERS_AVAILABLE);
109+
registry.registerWorkbenchAction(SyncActionDescriptor.from(DisableAllBreakpointsAction), 'Debug: Disable All Breakpoints', debugCategory, CONTEXT_DEBUGGERS_AVAILABLE);
110+
registry.registerWorkbenchAction(SyncActionDescriptor.from(SelectAndStartAction), 'Debug: Select and Start Debugging', debugCategory, CONTEXT_DEBUGGERS_AVAILABLE);
111+
registry.registerWorkbenchAction(SyncActionDescriptor.from(ClearReplAction), 'Debug: Clear Console', debugCategory, CONTEXT_DEBUGGERS_AVAILABLE);
113112

114113
const registerDebugCommandPaletteItem = (id: string, title: string, when?: ContextKeyExpression, precondition?: ContextKeyExpression) => {
115114
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
116-
when,
115+
when: ContextKeyExpr.and(CONTEXT_DEBUGGERS_AVAILABLE, when),
117116
command: {
118117
id,
119118
title: `Debug: ${title}`,
@@ -198,7 +197,7 @@ function registerCommandsAndActions(): void {
198197
title,
199198
icon: { dark: iconUri }
200199
},
201-
when,
200+
when: ContextKeyExpr.and(CONTEXT_DEBUGGERS_AVAILABLE, when),
202201
group: '9_debug',
203202
order
204203
});
@@ -449,10 +448,11 @@ function registerDebugPanel(): void {
449448
containerIcon: Codicon.debugConsole.classNames,
450449
canToggleVisibility: false,
451450
canMoveView: true,
451+
when: CONTEXT_DEBUGGERS_AVAILABLE,
452452
ctorDescriptor: new SyncDescriptor(Repl),
453453
}], VIEW_CONTAINER);
454454

455-
registry.registerWorkbenchAction(SyncActionDescriptor.from(OpenDebugConsoleAction, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_Y }), 'View: Debug Console', nls.localize('view', "View"));
455+
registry.registerWorkbenchAction(SyncActionDescriptor.from(OpenDebugConsoleAction, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_Y }), 'View: Debug Console', nls.localize('view', "View"), CONTEXT_DEBUGGERS_AVAILABLE);
456456
}
457457

458458
function registerDebugView(): void {

src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { IFileService } from 'vs/platform/files/common/files';
2121
import { IWorkspaceContextService, IWorkspaceFolder, WorkbenchState, IWorkspaceFoldersChangeEvent } from 'vs/platform/workspace/common/workspace';
2222
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
2323
import { ICommandService } from 'vs/platform/commands/common/commands';
24-
import { IDebugConfigurationProvider, ICompound, IDebugConfiguration, IConfig, IGlobalConfig, IConfigurationManager, ILaunch, IDebugAdapterDescriptorFactory, IDebugAdapter, IDebugSession, IAdapterDescriptor, CONTEXT_DEBUG_CONFIGURATION_TYPE, IDebugAdapterFactory, IConfigPresentation } from 'vs/workbench/contrib/debug/common/debug';
24+
import { IDebugConfigurationProvider, ICompound, IDebugConfiguration, IConfig, IGlobalConfig, IConfigurationManager, ILaunch, IDebugAdapterDescriptorFactory, IDebugAdapter, IDebugSession, IAdapterDescriptor, CONTEXT_DEBUG_CONFIGURATION_TYPE, IDebugAdapterFactory, IConfigPresentation, CONTEXT_DEBUGGERS_AVAILABLE } from 'vs/workbench/contrib/debug/common/debug';
2525
import { Debugger } from 'vs/workbench/contrib/debug/common/debugger';
2626
import { IEditorService, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService';
2727
import { isCodeEditor } from 'vs/editor/browser/editorBrowser';
@@ -49,8 +49,6 @@ const DEBUG_SELECTED_ROOT = 'debug.selectedroot';
4949

5050
interface IDynamicPickItem { label: string, launch: ILaunch, config: IConfig }
5151

52-
export const debugAdapterRegisteredEmitter = new Emitter<void>();
53-
5452
export class ConfigurationManager implements IConfigurationManager {
5553
private debuggers: Debugger[];
5654
private breakpointModeIdsSet = new Set<string>();
@@ -64,6 +62,7 @@ export class ConfigurationManager implements IConfigurationManager {
6462
private adapterDescriptorFactories: IDebugAdapterDescriptorFactory[];
6563
private debugAdapterFactories = new Map<string, IDebugAdapterFactory>();
6664
private debugConfigurationTypeContext: IContextKey<string>;
65+
private debuggersAvailable: IContextKey<boolean>;
6766
private readonly _onDidRegisterDebugger = new Emitter<void>();
6867

6968
constructor(
@@ -87,6 +86,7 @@ export class ConfigurationManager implements IConfigurationManager {
8786
const previousSelectedRoot = this.storageService.get(DEBUG_SELECTED_ROOT, StorageScope.WORKSPACE);
8887
const previousSelectedLaunch = this.launches.find(l => l.uri.toString() === previousSelectedRoot);
8988
this.debugConfigurationTypeContext = CONTEXT_DEBUG_CONFIGURATION_TYPE.bindTo(contextKeyService);
89+
this.debuggersAvailable = CONTEXT_DEBUGGERS_AVAILABLE.bindTo(contextKeyService);
9090
if (previousSelectedLaunch && previousSelectedLaunch.getConfigurationNames().length) {
9191
this.selectConfiguration(previousSelectedLaunch, this.storageService.get(DEBUG_SELECTED_CONFIG_NAME_KEY, StorageScope.WORKSPACE));
9292
} else if (this.launches.length > 0) {
@@ -97,11 +97,8 @@ export class ConfigurationManager implements IConfigurationManager {
9797
// debuggers
9898

9999
registerDebugAdapterFactory(debugTypes: string[], debugAdapterLauncher: IDebugAdapterFactory): IDisposable {
100-
const firstTimeRegistration = debugTypes.length && this.debugAdapterFactories.size === 0;
101100
debugTypes.forEach(debugType => this.debugAdapterFactories.set(debugType, debugAdapterLauncher));
102-
if (firstTimeRegistration) {
103-
debugAdapterRegisteredEmitter.fire();
104-
}
101+
this.debuggersAvailable.set(this.debugAdapterFactories.size > 0);
105102

106103
return {
107104
dispose: () => {

src/vs/workbench/contrib/debug/browser/debugEditorActions.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Range } from 'vs/editor/common/core/range';
99
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
1010
import { ServicesAccessor, registerEditorAction, EditorAction, IActionOptions } from 'vs/editor/browser/editorExtensions';
1111
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
12-
import { IDebugService, CONTEXT_IN_DEBUG_MODE, CONTEXT_DEBUG_STATE, State, IDebugEditorContribution, EDITOR_CONTRIBUTION_ID, BreakpointWidgetContext, IBreakpoint, BREAKPOINT_EDITOR_CONTRIBUTION_ID, IBreakpointEditorContribution, REPL_VIEW_ID, CONTEXT_STEP_INTO_TARGETS_SUPPORTED, WATCH_VIEW_ID } from 'vs/workbench/contrib/debug/common/debug';
12+
import { IDebugService, CONTEXT_IN_DEBUG_MODE, CONTEXT_DEBUG_STATE, State, IDebugEditorContribution, EDITOR_CONTRIBUTION_ID, BreakpointWidgetContext, IBreakpoint, BREAKPOINT_EDITOR_CONTRIBUTION_ID, IBreakpointEditorContribution, REPL_VIEW_ID, CONTEXT_STEP_INTO_TARGETS_SUPPORTED, WATCH_VIEW_ID, CONTEXT_DEBUGGERS_AVAILABLE } from 'vs/workbench/contrib/debug/common/debug';
1313
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
1414
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
1515
import { openBreakpointSource } from 'vs/workbench/contrib/debug/browser/breakpointsView';
@@ -27,7 +27,7 @@ class ToggleBreakpointAction extends EditorAction {
2727
id: TOGGLE_BREAKPOINT_ID,
2828
label: nls.localize('toggleBreakpointAction', "Debug: Toggle Breakpoint"),
2929
alias: 'Debug: Toggle Breakpoint',
30-
precondition: undefined,
30+
precondition: CONTEXT_DEBUGGERS_AVAILABLE,
3131
kbOpts: {
3232
kbExpr: EditorContextKeys.editorTextFocus,
3333
primary: KeyCode.F9,
@@ -66,7 +66,7 @@ class ConditionalBreakpointAction extends EditorAction {
6666
id: TOGGLE_CONDITIONAL_BREAKPOINT_ID,
6767
label: nls.localize('conditionalBreakpointEditorAction', "Debug: Add Conditional Breakpoint..."),
6868
alias: 'Debug: Add Conditional Breakpoint...',
69-
precondition: undefined
69+
precondition: CONTEXT_DEBUGGERS_AVAILABLE
7070
});
7171
}
7272

@@ -88,7 +88,7 @@ class LogPointAction extends EditorAction {
8888
id: ADD_LOG_POINT_ID,
8989
label: nls.localize('logPointEditorAction', "Debug: Add Logpoint..."),
9090
alias: 'Debug: Add Logpoint...',
91-
precondition: undefined
91+
precondition: CONTEXT_DEBUGGERS_AVAILABLE
9292
});
9393
}
9494

@@ -339,7 +339,7 @@ class GoToNextBreakpointAction extends GoToBreakpointAction {
339339
id: 'editor.debug.action.goToNextBreakpoint',
340340
label: nls.localize('goToNextBreakpoint', "Debug: Go To Next Breakpoint"),
341341
alias: 'Debug: Go To Next Breakpoint',
342-
precondition: undefined
342+
precondition: CONTEXT_DEBUGGERS_AVAILABLE
343343
});
344344
}
345345
}
@@ -350,7 +350,7 @@ class GoToPreviousBreakpointAction extends GoToBreakpointAction {
350350
id: 'editor.debug.action.goToPreviousBreakpoint',
351351
label: nls.localize('goToPreviousBreakpoint', "Debug: Go To Previous Breakpoint"),
352352
alias: 'Debug: Go To Previous Breakpoint',
353-
precondition: undefined
353+
precondition: CONTEXT_DEBUGGERS_AVAILABLE
354354
});
355355
}
356356
}

src/vs/workbench/contrib/debug/browser/welcomeView.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
88
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
99
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
1010
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
11-
import { IContextKeyService, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey';
11+
import { IContextKeyService, RawContextKey, IContextKey, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
1212
import { localize } from 'vs/nls';
1313
import { StartAction, ConfigureAction, SelectAndStartAction } from 'vs/workbench/contrib/debug/browser/debugActions';
14-
import { IDebugService } from 'vs/workbench/contrib/debug/common/debug';
14+
import { IDebugService, CONTEXT_DEBUGGERS_AVAILABLE } from 'vs/workbench/contrib/debug/common/debug';
1515
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
1616
import { ViewPane } from 'vs/workbench/browser/parts/views/viewPaneContainer';
1717
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
@@ -109,30 +109,32 @@ const viewsRegistry = Registry.as<IViewsRegistry>(Extensions.ViewsRegistry);
109109
viewsRegistry.registerViewWelcomeContent(WelcomeView.ID, {
110110
content: localize({ key: 'openAFileWhichCanBeDebugged', comment: ['Please do not translate the word "commmand", it is part of our internal syntax which must not change'] },
111111
"[Open a file](command:{0}) which can be debugged or run.", isMacintosh ? OpenFileFolderAction.ID : OpenFileAction.ID),
112-
when: CONTEXT_DEBUGGER_INTERESTED_IN_ACTIVE_EDITOR.toNegated()
112+
when: ContextKeyExpr.and(CONTEXT_DEBUGGERS_AVAILABLE, CONTEXT_DEBUGGER_INTERESTED_IN_ACTIVE_EDITOR.toNegated())
113113
});
114114

115115
let debugKeybindingLabel = '';
116116
viewsRegistry.registerViewWelcomeContent(WelcomeView.ID, {
117117
content: localize({ key: 'runAndDebugAction', comment: ['Please do not translate the word "commmand", it is part of our internal syntax which must not change'] },
118118
"[Run and Debug{0}](command:{1})", debugKeybindingLabel, StartAction.ID),
119-
preconditions: [CONTEXT_DEBUGGER_INTERESTED_IN_ACTIVE_EDITOR]
119+
preconditions: [CONTEXT_DEBUGGER_INTERESTED_IN_ACTIVE_EDITOR],
120+
when: CONTEXT_DEBUGGERS_AVAILABLE
120121
});
121122

122123
viewsRegistry.registerViewWelcomeContent(WelcomeView.ID, {
123124
content: localize({ key: 'detectThenRunAndDebug', comment: ['Please do not translate the word "commmand", it is part of our internal syntax which must not change'] },
124125
"[Show](command:{0}) all automatic debug configurations.", SelectAndStartAction.ID),
125-
priority: ViewContentPriority.Lowest
126+
priority: ViewContentPriority.Lowest,
127+
when: CONTEXT_DEBUGGERS_AVAILABLE
126128
});
127129

128130
viewsRegistry.registerViewWelcomeContent(WelcomeView.ID, {
129131
content: localize({ key: 'customizeRunAndDebug', comment: ['Please do not translate the word "commmand", it is part of our internal syntax which must not change'] },
130132
"To customize Run and Debug [create a launch.json file](command:{0}).", ConfigureAction.ID),
131-
when: WorkbenchStateContext.notEqualsTo('empty')
133+
when: ContextKeyExpr.and(CONTEXT_DEBUGGERS_AVAILABLE, WorkbenchStateContext.notEqualsTo('empty'))
132134
});
133135

134136
viewsRegistry.registerViewWelcomeContent(WelcomeView.ID, {
135137
content: localize({ key: 'customizeRunAndDebugOpenFolder', comment: ['Please do not translate the word "commmand", it is part of our internal syntax which must not change'] },
136138
"To customize Run and Debug, [open a folder](command:{0}) and create a launch.json file.", isMacintosh ? OpenFileFolderAction.ID : OpenFolderAction.ID),
137-
when: WorkbenchStateContext.isEqualTo('empty')
139+
when: ContextKeyExpr.and(CONTEXT_DEBUGGERS_AVAILABLE, WorkbenchStateContext.isEqualTo('empty'))
138140
});

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export const CONTEXT_RESTART_FRAME_SUPPORTED = new RawContextKey<boolean>('resta
5959
export const CONTEXT_JUMP_TO_CURSOR_SUPPORTED = new RawContextKey<boolean>('jumpToCursorSupported', false);
6060
export const CONTEXT_STEP_INTO_TARGETS_SUPPORTED = new RawContextKey<boolean>('stepIntoTargetsSupported', false);
6161
export const CONTEXT_BREAKPOINTS_EXIST = new RawContextKey<boolean>('breakpointsExist', false);
62+
export const CONTEXT_DEBUGGERS_AVAILABLE = new RawContextKey<boolean>('debuggersAvailable', false);
6263

6364
export const EDITOR_CONTRIBUTION_ID = 'editor.contrib.debug';
6465
export const BREAKPOINT_EDITOR_CONTRIBUTION_ID = 'editor.contrib.breakpoint';

0 commit comments

Comments
 (0)