mirror of
https://github.com/Microsoft/vscode
synced 2024-09-18 01:58:27 +00:00
Merge pull request #117100 from NotWearingPants/feature/debug-save-before-run-setting
add debug.saveBeforeRun setting
This commit is contained in:
commit
ed3eb3fdf2
|
@ -489,6 +489,16 @@ function registerConfiguration(): void {
|
|||
type: 'boolean',
|
||||
description: nls.localize({ comment: ['This is the description for a setting'], key: 'showInlineBreakpointCandidates' }, "Controls whether inline breakpoints candidate decorations should be shown in the editor while debugging."),
|
||||
default: true
|
||||
},
|
||||
'debug.saveBeforeStart': {
|
||||
description: nls.localize('debug.saveBeforeStart', "Controls what editors to save before starting a debug session."),
|
||||
enum: ['allEditorsInActiveGroup', 'nonUntitledEditorsInActiveGroup', 'none'],
|
||||
enumDescriptions: [
|
||||
nls.localize('debug.saveBeforeStart.allEditorsInActiveGroup', "Save all editors in the active group before starting a debug session."),
|
||||
nls.localize('debug.saveBeforeStart.nonUntitledEditorsInActiveGroup', "Save all editors in the active group except untitled ones before starting a debug session."),
|
||||
nls.localize('debug.saveBeforeStart.none', "Don't save any editors before starting a debug session."),
|
||||
],
|
||||
default: 'allEditorsInActiveGroup'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -279,11 +279,17 @@ export class DebugService implements IDebugService {
|
|||
// make sure to save all files and that the configuration is up to date
|
||||
await this.extensionService.activateByEvent('onDebug');
|
||||
if (!options?.parentSession) {
|
||||
await this.editorService.saveAll();
|
||||
const activeEditor = this.editorService.activeEditorPane;
|
||||
if (activeEditor) {
|
||||
// Make sure to save the active editor in case it is in untitled file it wont be saved as part of saveAll #111850
|
||||
await this.editorService.save({ editor: activeEditor.input, groupId: activeEditor.group.id });
|
||||
const saveBeforeStartConfig: string = this.configurationService.getValue('debug.saveBeforeStart');
|
||||
|
||||
if (saveBeforeStartConfig !== 'none') {
|
||||
await this.editorService.saveAll();
|
||||
if (saveBeforeStartConfig === 'allEditorsInActiveGroup') {
|
||||
const activeEditor = this.editorService.activeEditorPane;
|
||||
if (activeEditor) {
|
||||
// Make sure to save the active editor in case it is in untitled file it wont be saved as part of saveAll #111850
|
||||
await this.editorService.save({ editor: activeEditor.input, groupId: activeEditor.group.id });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
await this.configurationService.reloadConfiguration(launch ? launch.workspace : undefined);
|
||||
|
|
Loading…
Reference in a new issue