Document term config changes

This commit is contained in:
Daniel Imms 2021-07-15 05:07:27 -07:00
parent e6b92dece2
commit ecbfede5bc
4 changed files with 25 additions and 12 deletions

View file

@ -74,7 +74,7 @@ export class TerminalEditorInput extends EditorInput {
override isDirty(): boolean {
const confirmOnKill = this._configurationService.getValue<ConfirmOnKill>(TerminalSettingId.ConfirmOnKill);
if (confirmOnKill === 'editor' || confirmOnKill === 'editorAndPanel') {
if (confirmOnKill === 'editor' || confirmOnKill === 'always') {
return this._terminalInstance.hasChildProcesses;
}
return false;

View file

@ -315,7 +315,7 @@ export class TerminalService implements ITerminalService {
// Confirm on kill in the editor is handled by the editor input
if (instance.target !== TerminalLocation.Editor &&
instance.hasChildProcesses &&
(this.configHelper.config.confirmOnKill === 'panel' || this.configHelper.config.confirmOnKill === 'editorAndPanel')) {
(this.configHelper.config.confirmOnKill === 'panel' || this.configHelper.config.confirmOnKill === 'always')) {
const notConfirmed = await this._showTerminalCloseConfirmation(true);
if (notConfirmed) {
@ -487,12 +487,14 @@ export class TerminalService implements ITerminalService {
}
const shouldPersistTerminals = this._configHelper.config.enablePersistentSessions && reason === ShutdownReason.RELOAD;
const hasDirtyInstances = (
(this.configHelper.config.confirmOnExit === 'always' && this.instances.length > 0) ||
(this.configHelper.config.confirmOnExit === 'hasChildProcesses' && this.instances.some(e => e.hasChildProcesses))
);
if (!shouldPersistTerminals && hasDirtyInstances) {
return this._onBeforeShutdownAsync();
if (!shouldPersistTerminals) {
const hasDirtyInstances = (
(this.configHelper.config.confirmOnExit === 'always' && this.instances.length > 0) ||
(this.configHelper.config.confirmOnExit === 'hasChildProcesses' && this.instances.some(e => e.hasChildProcesses))
);
if (hasDirtyInstances) {
return this._onBeforeShutdownAsync();
}
}
this._isShuttingDown = true;

View file

@ -172,7 +172,7 @@ export interface ITerminalProfiles {
windows: { [key: string]: ITerminalProfileObject };
}
export type ConfirmOnKill = 'never' | 'editor' | 'panel' | 'editorAndPanel';
export type ConfirmOnKill = 'never' | 'always' | 'editor' | 'panel';
export type ConfirmOnExit = 'never' | 'always' | 'hasChildProcesses';
export interface ITerminalConfiguration {

View file

@ -266,15 +266,26 @@ const terminalConfiguration: IConfigurationNode = {
default: undefined
},
[TerminalSettingId.ConfirmOnExit]: {
description: localize('terminal.integrated.confirmOnExit', "Controls whether to confirm on exit if there are active terminal sessions."),
description: localize('terminal.integrated.confirmOnExit', "Controls whether to confirm when the window closes if there are active terminal sessions."),
type: 'string',
enum: ['never', 'always', 'hasChildProcesses'],
default: false
enumDescriptions: [
localize('terminal.integrated.confirmOnExit.never', "Never confirm."),
localize('terminal.integrated.confirmOnExit.always', "Always confirm if there are terminals."),
localize('terminal.integrated.confirmOnExit.hasChildProcesses', "Confirm if there are any terminals that has child processes."),
],
default: 'hasChildProcesses'
},
[TerminalSettingId.ConfirmOnKill]: {
description: localize('terminal.integrated.confirmOnKill', "Controls whether to confirm killing terminals when they have child processes. When set to editor, terminals in the editor area will be marked as dirty when they have child processes."),
type: 'string',
enum: ['never', 'editor', 'panel', 'editorAndPanel'],
enum: ['never', 'editor', 'panel', 'always'],
enumDescriptions: [
localize('terminal.integrated.confirmOnKill.never', "Never confirm."),
localize('terminal.integrated.confirmOnKill.editor', "Confirm if the terminal is in the editor."),
localize('terminal.integrated.confirmOnKill.panel', "Confirm if the terminal is in the panel."),
localize('terminal.integrated.confirmOnKill.always', "Confirm if the terminal is either in the editor or panel."),
],
default: 'editor'
},
[TerminalSettingId.EnableBell]: {