mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-26 10:16:01 +01:00
Add confirmOnExit terminal setting
This commit is contained in:
@@ -58,7 +58,8 @@ export interface ITerminalConfiguration {
|
||||
setLocaleVariables: boolean,
|
||||
scrollback: number,
|
||||
commandsToSkipShell: string[],
|
||||
cwd: string
|
||||
cwd: string,
|
||||
confirmOnExit: boolean
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -72,6 +73,7 @@ export interface ITerminalConfigHelper {
|
||||
getCommandsToSkipShell(): string[];
|
||||
getScrollback(): number;
|
||||
getCwd(): string;
|
||||
getConfirmOnExit(): boolean;
|
||||
}
|
||||
|
||||
export interface ITerminalFont {
|
||||
|
||||
@@ -64,6 +64,10 @@ export abstract class TerminalService implements ITerminalService {
|
||||
public abstract setContainers(panelContainer: HTMLElement, terminalContainer: HTMLElement): void;
|
||||
|
||||
private _onWillShutdown(): boolean {
|
||||
if (!this.configHelper.getConfirmOnExit()) {
|
||||
// Don't veto if configured to skip confirmation
|
||||
return false;
|
||||
}
|
||||
if (this.terminalInstances.length === 0) {
|
||||
// No terminal instances, don't veto
|
||||
return false;
|
||||
|
||||
@@ -129,6 +129,11 @@ configurationRegistry.registerConfiguration({
|
||||
'type': 'string',
|
||||
'default': undefined
|
||||
},
|
||||
'terminal.integrated.confirmOnExit': {
|
||||
'description': nls.localize('terminal.integrated.confirmOnExit', "Whether to confirm on exit if there are active terminal sessions."),
|
||||
'type': 'boolean',
|
||||
'default': false
|
||||
},
|
||||
'terminal.integrated.commandsToSkipShell': {
|
||||
'description': nls.localize('terminal.integrated.commandsToSkipShell', "A set of command IDs whose keybindings will not be sent to the shell and instead always be handled by Code. This allows the use of keybindings that would normally be consumed by the shell to act the same as when the terminal is not focused, for example ctrl+p to launch Quick Open."),
|
||||
'type': 'array',
|
||||
@@ -174,7 +179,6 @@ configurationRegistry.registerConfiguration({
|
||||
debugActions.PauseAction.ID,
|
||||
OpenNextRecentlyUsedEditorInGroupAction.ID,
|
||||
OpenPreviousRecentlyUsedEditorInGroupAction.ID
|
||||
|
||||
].sort()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,6 +194,11 @@ export class TerminalConfigHelper implements ITerminalConfigHelper {
|
||||
return config.terminal.integrated.cwd;
|
||||
}
|
||||
|
||||
public getConfirmOnExit(): boolean {
|
||||
const config = this._configurationService.getConfiguration<ITerminalConfiguration>();
|
||||
return config.terminal.integrated.confirmOnExit;
|
||||
}
|
||||
|
||||
private _toInteger(source: any, minimum?: number): number {
|
||||
let r = parseInt(source, 10);
|
||||
if (isNaN(r)) {
|
||||
|
||||
Reference in New Issue
Block a user