提交 5ebee3da 编写于 作者: I isidor

debug: preserveFocus when automatically opening launch.json

fixes #56984
上级 ffe5da33
......@@ -113,7 +113,7 @@ export class ConfigureAction extends AbstractDebugAction {
configurationManager.selectConfiguration(configurationManager.getLaunches()[0]);
}
return configurationManager.selectedConfiguration.launch.openConfigFile(sideBySide);
return configurationManager.selectedConfiguration.launch.openConfigFile(sideBySide, false);
}
}
......
......@@ -186,7 +186,7 @@ export function registerCommands(): void {
}
const launch = manager.getLaunches().filter(l => l.uri.toString() === launchUri).pop() || manager.selectedConfiguration.launch;
return launch.openConfigFile(false).done(({ editor, created }) => {
return launch.openConfigFile(false, false).done(({ editor, created }) => {
if (editor && !created) {
const codeEditor = <ICodeEditor>editor.getControl();
if (codeEditor) {
......
......@@ -574,7 +574,7 @@ export interface ILaunch {
/**
* Opens the launch.json file. Creates if it does not exist.
*/
openConfigFile(sideBySide: boolean, type?: string): TPromise<{ editor: IEditor, created: boolean }>;
openConfigFile(sideBySide: boolean, preserveFocus: boolean, type?: string): TPromise<{ editor: IEditor, created: boolean }>;
}
// Debug service interfaces
......
......@@ -442,7 +442,7 @@ class Launch implements ILaunch {
return config.configurations.filter(config => config && config.name === name).shift();
}
public openConfigFile(sideBySide: boolean, type?: string): TPromise<{ editor: IEditor, created: boolean }> {
public openConfigFile(sideBySide: boolean, preserveFocus: boolean, type?: string): TPromise<{ editor: IEditor, created: boolean }> {
const resource = this.uri;
let created = false;
......@@ -487,6 +487,7 @@ class Launch implements ILaunch {
resource,
options: {
selection,
preserveFocus,
pinned: created,
revealIfVisible: true
},
......@@ -521,8 +522,11 @@ class WorkspaceLaunch extends Launch implements ILaunch {
return this.configurationService.inspect<IGlobalConfig>('launch').workspace;
}
openConfigFile(sideBySide: boolean, type?: string): TPromise<{ editor: IEditor, created: boolean }> {
return this.editorService.openEditor({ resource: this.contextService.getWorkspace().configuration }).then(editor => ({ editor, created: false }));
openConfigFile(sideBySide: boolean, preserveFocus: boolean, type?: string): TPromise<{ editor: IEditor, created: boolean }> {
return this.editorService.openEditor({
resource: this.contextService.getWorkspace().configuration,
options: { preserveFocus }
}, sideBySide ? SIDE_GROUP : ACTIVE_GROUP).then(editor => ({ editor, created: false }));
}
}
......@@ -555,7 +559,7 @@ class UserLaunch extends Launch implements ILaunch {
return this.configurationService.inspect<IGlobalConfig>('launch').user;
}
openConfigFile(sideBySide: boolean, type?: string): TPromise<{ editor: IEditor, created: boolean }> {
return this.preferencesService.openGlobalSettings().then(editor => ({ editor, created: false }));
openConfigFile(sideBySide: boolean, preserveFocus: boolean, type?: string): TPromise<{ editor: IEditor, created: boolean }> {
return this.preferencesService.openGlobalSettings(false, { preserveFocus }).then(editor => ({ editor, created: false }));
}
}
......@@ -557,7 +557,7 @@ export class DebugService implements IDebugService {
}
if (launch && type) {
return launch.openConfigFile(false, type).done(undefined, errors.onUnexpectedError);
return launch.openConfigFile(false, true, type).done(undefined, errors.onUnexpectedError);
}
})
).then(() => undefined);
......@@ -628,7 +628,7 @@ export class DebugService implements IDebugService {
return this.showError(nls.localize('noFolderWorkspaceDebugError', "The active file can not be debugged. Make sure it is saved on disk and that you have a debug extension installed for that file type."));
}
return launch && launch.openConfigFile(false).then(editor => void 0);
return launch && launch.openConfigFile(false, true).then(editor => void 0);
})
).then(() => {
this.initializing = false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册