@@ -17,11 +17,11 @@ import { CallStackView } from 'vs/workbench/contrib/debug/browser/callStackView'
1717import { Extensions as WorkbenchExtensions , IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions' ;
1818import {
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 ,
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 ,
2121} from 'vs/workbench/contrib/debug/common/debug' ;
2222import { StartAction , AddFunctionBreakpointAction , ConfigureAction , DisableAllBreakpointsAction , EnableAllBreakpointsAction , RemoveAllBreakpointsAction , RunAction , ReapplyBreakpointsAction , SelectAndStartAction } from 'vs/workbench/contrib/debug/browser/debugActions' ;
2323import { DebugToolBar } from 'vs/workbench/contrib/debug/browser/debugToolBar' ;
24- import * as service from 'vs/workbench/contrib/debug/browser/debugService' ;
24+ import { DebugService } from 'vs/workbench/contrib/debug/browser/debugService' ;
2525import { registerCommands , ADD_CONFIGURATION_ID , TOGGLE_INLINE_BREAKPOINT_ID , COPY_STACK_TRACE_ID , REVERSE_CONTINUE_ID , STEP_BACK_ID , RESTART_SESSION_ID , TERMINATE_THREAD_ID , STEP_OVER_ID , STEP_INTO_ID , STEP_OUT_ID , PAUSE_ID , DISCONNECT_ID , STOP_ID , RESTART_FRAME_ID , CONTINUE_ID , FOCUS_REPL_ID , JUMP_TO_CURSOR_ID , RESTART_LABEL , STEP_INTO_LABEL , STEP_OVER_LABEL , STEP_OUT_LABEL , PAUSE_LABEL , DISCONNECT_LABEL , STOP_LABEL , CONTINUE_LABEL } from 'vs/workbench/contrib/debug/browser/debugCommands' ;
2626import { StatusBarColorProvider } from 'vs/workbench/contrib/debug/browser/statusbarColorProvider' ;
2727import { IViewsRegistry , Extensions as ViewExtensions , IViewContainersRegistry , ViewContainerLocation , ViewContainer } from 'vs/workbench/common/views' ;
@@ -51,22 +51,27 @@ import { DebugProgressContribution } from 'vs/workbench/contrib/debug/browser/de
5151import { DebugTitleContribution } from 'vs/workbench/contrib/debug/browser/debugTitle' ;
5252import { Codicon } from 'vs/base/common/codicons' ;
5353import { registerColors } from 'vs/workbench/contrib/debug/browser/debugColors' ;
54+ import { debugAdapterRegisteredEmitter } from 'vs/workbench/contrib/debug/browser/debugConfigurationManager' ;
55+ import { DebugEditorContribution } from 'vs/workbench/contrib/debug/browser/debugEditorContribution' ;
5456
5557const registry = Registry . as < IWorkbenchActionRegistry > ( WorkbenchActionRegistryExtensions . WorkbenchActions ) ;
5658// register service
57- registerSingleton ( IDebugService , service . DebugService , true ) ;
59+ debugAdapterRegisteredEmitter . event ( ( ) => {
60+ // Register these contributions lazily only once a debug adapter extension has been registered
61+ registerWorkbenchContributions ( ) ;
62+ registerColors ( ) ;
63+ registerCommands ( ) ;
64+ registerCommandsAndActions ( ) ;
65+ registerDebugMenu ( ) ;
66+ registerDebugPanel ( ) ;
67+ registerEditorActions ( ) ;
68+ } ) ;
69+ registerSingleton ( IDebugService , DebugService , true ) ;
5870registerDebugView ( ) ;
59-
60- registerColors ( ) ;
61- registerCommands ( ) ;
62- registerCommandsAndActions ( ) ;
63- registerContributions ( ) ;
64- registerDebugMenu ( ) ;
65- registerDebugPanel ( ) ;
6671registerConfiguration ( ) ;
67- registerEditorActions ( ) ;
72+ regsiterEditorContributions ( ) ;
6873
69- function registerContributions ( ) : void {
74+ function registerWorkbenchContributions ( ) : void {
7075 // Register Debug Workbench Contributions
7176 Registry . as < IWorkbenchContributionsRegistry > ( WorkbenchExtensions . Workbench ) . registerWorkbenchContribution ( DebugStatusContribution , LifecyclePhase . Eventually ) ;
7277 Registry . as < IWorkbenchContributionsRegistry > ( WorkbenchExtensions . Workbench ) . registerWorkbenchContribution ( DebugProgressContribution , LifecyclePhase . Eventually ) ;
@@ -77,10 +82,6 @@ function registerContributions(): void {
7782 Registry . as < IWorkbenchContributionsRegistry > ( WorkbenchExtensions . Workbench ) . registerWorkbenchContribution ( DebugContentProvider , LifecyclePhase . Eventually ) ;
7883 Registry . as < IWorkbenchContributionsRegistry > ( WorkbenchExtensions . Workbench ) . registerWorkbenchContribution ( StatusBarColorProvider , LifecyclePhase . Eventually ) ;
7984
80- // Editor contributions
81- registerEditorContribution ( 'editor.contrib.callStack' , CallStackEditorContribution ) ;
82- registerEditorContribution ( BREAKPOINT_EDITOR_CONTRIBUTION_ID , BreakpointEditorContribution ) ;
83-
8485 // Register Quick Access
8586 Registry . as < IQuickAccessRegistry > ( QuickAccessExtensions . Quickaccess ) . registerQuickAccessProvider ( {
8687 ctor : StartDebugQuickAccessProvider ,
@@ -89,6 +90,13 @@ function registerContributions(): void {
8990 placeholder : nls . localize ( 'startDebugPlaceholder' , "Type the name of a launch configuration to run." ) ,
9091 helpEntries : [ { description : nls . localize ( 'startDebuggingHelp' , "Start Debugging" ) , needsEditor : false } ]
9192 } ) ;
93+
94+ }
95+
96+ function regsiterEditorContributions ( ) : void {
97+ registerEditorContribution ( 'editor.contrib.callStack' , CallStackEditorContribution ) ;
98+ registerEditorContribution ( BREAKPOINT_EDITOR_CONTRIBUTION_ID , BreakpointEditorContribution ) ;
99+ registerEditorContribution ( EDITOR_CONTRIBUTION_ID , DebugEditorContribution ) ;
92100}
93101
94102function registerCommandsAndActions ( ) : void {
0 commit comments