parent
7efdaa5e8e
commit
05519998ae
|
@ -95,6 +95,10 @@ export class TerminalService extends Disposable implements ITerminalService {
|
|||
get instances(): ITerminalInstance[] {
|
||||
return this._terminalGroupService.instances.concat(this._terminalEditorService.instances).concat(this._backgroundedTerminalInstances);
|
||||
}
|
||||
/** Gets all non-background terminals. */
|
||||
get foregroundInstances(): ITerminalInstance[] {
|
||||
return this._terminalGroupService.instances.concat(this._terminalEditorService.instances);
|
||||
}
|
||||
get detachedInstances(): Iterable<IDetachedTerminalInstance> {
|
||||
return this._detachedXterms;
|
||||
}
|
||||
|
@ -417,7 +421,6 @@ export class TerminalService extends Disposable implements ITerminalService {
|
|||
if (instance.target !== TerminalLocation.Editor &&
|
||||
instance.hasChildProcesses &&
|
||||
(this._terminalConfigurationService.config.confirmOnKill === 'panel' || this._terminalConfigurationService.config.confirmOnKill === 'always')) {
|
||||
|
||||
const veto = await this._showTerminalCloseConfirmation(true);
|
||||
if (veto) {
|
||||
return;
|
||||
|
@ -904,10 +907,11 @@ export class TerminalService extends Disposable implements ITerminalService {
|
|||
|
||||
protected async _showTerminalCloseConfirmation(singleTerminal?: boolean): Promise<boolean> {
|
||||
let message: string;
|
||||
if (this.instances.length === 1 || singleTerminal) {
|
||||
const foregroundInstances = this.foregroundInstances;
|
||||
if (foregroundInstances.length === 1 || singleTerminal) {
|
||||
message = nls.localize('terminalService.terminalCloseConfirmationSingular', "Do you want to terminate the active terminal session?");
|
||||
} else {
|
||||
message = nls.localize('terminalService.terminalCloseConfirmationPlural', "Do you want to terminate the {0} active terminal sessions?", this.instances.length);
|
||||
message = nls.localize('terminalService.terminalCloseConfirmationPlural', "Do you want to terminate the {0} active terminal sessions?", foregroundInstances.length);
|
||||
}
|
||||
const { confirmed } = await this._dialogService.confirm({
|
||||
type: 'warning',
|
||||
|
|
|
@ -366,7 +366,7 @@ const terminalConfiguration: IConfigurationNode = {
|
|||
default: 'never'
|
||||
},
|
||||
[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 changed when they have child processes. Note that child process detection may not work well for shells like Git Bash which don't run their processes as child processes of the shell."),
|
||||
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 changed when they have child processes. Note that child process detection may not work well for shells like Git Bash which don't run their processes as child processes of the shell. Background terminals like those launched by some extensions will not trigger the confirmation."),
|
||||
type: 'string',
|
||||
enum: ['never', 'editor', 'panel', 'always'],
|
||||
enumDescriptions: [
|
||||
|
|
Loading…
Reference in New Issue