提交 49bdd4fd 编写于 作者: D Daniel Imms

Add confirmOnExit terminal setting

上级 184797a6
......@@ -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)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册