@@ -7,7 +7,7 @@ import * as nls from 'vs/nls';
77import { Action } from 'vs/base/common/actions' ;
88import * as lifecycle from 'vs/base/common/lifecycle' ;
99import { TPromise } from 'vs/base/common/winjs.base' ;
10- import { ICodeEditor , isCodeEditor } from 'vs/editor/browser/editorBrowser' ;
10+ import { ICodeEditor } from 'vs/editor/browser/editorBrowser' ;
1111import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding' ;
1212import { ICommandService } from 'vs/platform/commands/common/commands' ;
1313import { IWorkspaceContextService , WorkbenchState } from 'vs/platform/workspace/common/workspace' ;
@@ -24,6 +24,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
2424import { CollapseAction } from 'vs/workbench/browser/viewlet' ;
2525import { ITree } from 'vs/base/parts/tree/browser/tree' ;
2626import { first } from 'vs/base/common/arrays' ;
27+ import { IHistoryService } from 'vs/workbench/services/history/common/history' ;
2728
2829export abstract class AbstractDebugAction extends Action {
2930
@@ -118,7 +119,7 @@ export class StartAction extends AbstractDebugAction {
118119 @IDebugService debugService : IDebugService ,
119120 @IKeybindingService keybindingService : IKeybindingService ,
120121 @IWorkspaceContextService private contextService : IWorkspaceContextService ,
121- @IWorkbenchEditorService private editorService : IWorkbenchEditorService
122+ @IHistoryService private historyService : IHistoryService
122123 ) {
123124 super ( id , label , 'debug-action start' , debugService , keybindingService ) ;
124125
@@ -131,14 +132,10 @@ export class StartAction extends AbstractDebugAction {
131132 const configurationManager = this . debugService . getConfigurationManager ( ) ;
132133 let launch = configurationManager . selectedConfiguration . launch ;
133134 if ( ! launch ) {
134- const activeEditor = this . editorService . getActiveEditor ( ) ;
135- const launches = configurationManager . getLaunches ( ) ;
136- if ( isCodeEditor ( activeEditor ) ) {
137- const resource = activeEditor . input . getResource ( ) ;
138- const root = this . contextService . getWorkspaceFolder ( resource ) ;
139- launch = configurationManager . getLaunch ( root . uri ) ;
140- }
135+ const rootUri = this . historyService . getLastActiveWorkspaceRoot ( ) ;
136+ launch = configurationManager . getLaunch ( rootUri ) ;
141137 if ( ! launch ) {
138+ const launches = configurationManager . getLaunches ( ) ;
142139 launch = first ( launches , l => ! ! l . getConfigurationNames ( ) . length , launches . length ? launches [ 0 ] : undefined ) ;
143140 }
144141
0 commit comments