mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-20 00:04:14 +08:00
Adopt appExit -> onExit naming
This commit is contained in:
parent
1af3873a37
commit
d71cb023e7
@ -38,9 +38,9 @@ export class BackupMainService implements IBackupMainService {
|
||||
|
||||
public getWorkspaceBackupPaths(): string[] {
|
||||
const config = this.configurationService.getConfiguration<IFilesConfiguration>();
|
||||
if (config && config.files && config.files.hotExit === HotExitConfiguration.APP_EXIT_AND_WINDOW_CLOSE) {
|
||||
if (config && config.files && config.files.hotExit === HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE) {
|
||||
// Only non-folder windows are restored on main process launch when
|
||||
// hot exit is configured as appExitAndWindowClose.
|
||||
// hot exit is configured as onExitAndWindowClose.
|
||||
return [];
|
||||
}
|
||||
return this.backups.folderWorkspaces.slice(0); // return a copy
|
||||
|
||||
@ -492,8 +492,8 @@ export const AutoSaveConfiguration = {
|
||||
|
||||
export const HotExitConfiguration = {
|
||||
OFF: 'off',
|
||||
APP_EXIT: 'appExit',
|
||||
APP_EXIT_AND_WINDOW_CLOSE: 'appExitAndWindowClose'
|
||||
ON_EXIT: 'onExit',
|
||||
ON_EXIT_AND_WINDOW_CLOSE: 'onExitAndWindowClose'
|
||||
};
|
||||
|
||||
export const CONTENT_CHANGE_EVENT_BUFFER_DELAY = 1000;
|
||||
|
||||
@ -245,9 +245,9 @@ configurationRegistry.registerConfiguration({
|
||||
},
|
||||
'files.hotExit': {
|
||||
'type': 'string',
|
||||
'enum': [HotExitConfiguration.OFF, HotExitConfiguration.APP_EXIT, HotExitConfiguration.APP_EXIT_AND_WINDOW_CLOSE],
|
||||
'default': HotExitConfiguration.APP_EXIT,
|
||||
'description': nls.localize('hotExit', "Whether hot exit is enabled which allows changes to unsaved files to be remembered between sessions, hiding the prompt t save when exiting the editor. Selecting \"{0}\" means that hot exit will only be triggered when the application is closed (workbench.action.quit command via command pallete, keybinding of menu) and ALL windows with backups will be restored upon next launch. Selecting \"{1}\" will trigger hot exit when any FOLDER window is closed, only NON-FOLDER windows will be restored when the application is restarted (not FOLDER workspaces).", HotExitConfiguration.APP_EXIT, HotExitConfiguration.APP_EXIT_AND_WINDOW_CLOSE)
|
||||
'enum': [HotExitConfiguration.OFF, HotExitConfiguration.ON_EXIT, HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE],
|
||||
'default': HotExitConfiguration.ON_EXIT,
|
||||
'description': nls.localize('hotExit', "Whether hot exit is enabled which allows changes to unsaved files to be remembered between sessions, hiding the prompt t save when exiting the editor. Selecting \"{0}\" means that hot exit will only be triggered when the application is closed (workbench.action.quit command via command pallete, keybinding of menu) and ALL windows with backups will be restored upon next launch. Selecting \"{1}\" will trigger hot exit when any FOLDER window is closed, only NON-FOLDER windows will be restored when the application is restarted (not FOLDER workspaces).", HotExitConfiguration.ON_EXIT, HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -186,8 +186,8 @@ export abstract class TextFileService implements ITextFileService {
|
||||
let doBackup: boolean;
|
||||
switch (reason) {
|
||||
case ShutdownReason.CLOSE:
|
||||
if (this.contextService.hasWorkspace() && this.configuredHotExit === HotExitConfiguration.APP_EXIT_AND_WINDOW_CLOSE) {
|
||||
doBackup = true; // backup if a folder is open and appExitAndWindowClose is configured
|
||||
if (this.contextService.hasWorkspace() && this.configuredHotExit === HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE) {
|
||||
doBackup = true; // backup if a folder is open and onExitAndWindowClose is configured
|
||||
} else if (windowCount > 1 || platform.isMacintosh) {
|
||||
doBackup = false; // do not backup if a window is closed that does not cause quitting of the application
|
||||
} else {
|
||||
@ -355,12 +355,12 @@ export abstract class TextFileService implements ITextFileService {
|
||||
}
|
||||
|
||||
// Hot exit
|
||||
const hotExitMode = configuration && configuration.files ? configuration.files.hotExit : HotExitConfiguration.APP_EXIT;
|
||||
const hotExitMode = configuration && configuration.files ? configuration.files.hotExit : HotExitConfiguration.ON_EXIT;
|
||||
// Handle the legacy case where hot exit was a boolean
|
||||
if (<any>hotExitMode === false) {
|
||||
this.configuredHotExit = HotExitConfiguration.OFF;
|
||||
} else if (<any>hotExitMode === true) {
|
||||
this.configuredHotExit = HotExitConfiguration.APP_EXIT;
|
||||
this.configuredHotExit = HotExitConfiguration.ON_EXIT;
|
||||
} else {
|
||||
this.configuredHotExit = hotExitMode;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user