Skip to content

Commit c6736e1

Browse files
committed
Remove ability for terminal editors to be dirty
Fixes microsoft#154496
1 parent 1c51e8f commit c6736e1

File tree

1 file changed

+6
-25
lines changed

1 file changed

+6
-25
lines changed

src/vs/workbench/contrib/terminal/browser/terminalEditorInput.ts

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,20 @@ import { Emitter } from 'vs/base/common/event';
2525

2626
export class TerminalEditorInput extends EditorInput implements IEditorCloseHandler {
2727

28-
protected readonly _onDidRequestAttach = this._register(new Emitter<ITerminalInstance>());
29-
readonly onDidRequestAttach = this._onDidRequestAttach.event;
30-
3128
static readonly ID = 'workbench.editors.terminal';
3229

30+
override readonly closeHandler = this;
31+
3332
private _isDetached = false;
3433
private _isShuttingDown = false;
3534
private _isReverted = false;
3635
private _copyLaunchConfig?: IShellLaunchConfig;
3736
private _terminalEditorFocusContextKey: IContextKey<boolean>;
38-
3937
private _group: IEditorGroup | undefined;
4038

39+
protected readonly _onDidRequestAttach = this._register(new Emitter<ITerminalInstance>());
40+
readonly onDidRequestAttach = this._onDidRequestAttach.event;
41+
4142
setGroup(group: IEditorGroup | undefined) {
4243
this._group = group;
4344
}
@@ -64,13 +65,6 @@ export class TerminalEditorInput extends EditorInput implements IEditorCloseHand
6465
}
6566
this._terminalInstance = instance;
6667
this._setupInstanceListeners();
67-
68-
// Refresh dirty state when the confirm on kill setting is changed
69-
this._configurationService.onDidChangeConfiguration(e => {
70-
if (e.affectsConfiguration(TerminalSettingId.ConfirmOnKill)) {
71-
this._onDidChangeDirty.fire();
72-
}
73-
});
7468
}
7569

7670
override copy(): EditorInput {
@@ -95,7 +89,7 @@ export class TerminalEditorInput extends EditorInput implements IEditorCloseHand
9589
return this._isDetached ? undefined : this._terminalInstance;
9690
}
9791

98-
override isDirty(): boolean {
92+
showConfirm(): boolean {
9993
if (this._isReverted) {
10094
return false;
10195
}
@@ -106,12 +100,6 @@ export class TerminalEditorInput extends EditorInput implements IEditorCloseHand
106100
return false;
107101
}
108102

109-
override readonly closeHandler = this;
110-
111-
showConfirm(): boolean {
112-
return this.isDirty();
113-
}
114-
115103
async confirm(terminals?: ReadonlyArray<IEditorIdentifier>): Promise<ConfirmResult> {
116104
const { choice } = await this._dialogService.show(
117105
Severity.Warning,
@@ -154,12 +142,6 @@ export class TerminalEditorInput extends EditorInput implements IEditorCloseHand
154142

155143
this._terminalEditorFocusContextKey = TerminalContextKeys.editorFocus.bindTo(_contextKeyService);
156144

157-
// Refresh dirty state when the confirm on kill setting is changed
158-
this._configurationService.onDidChangeConfiguration(e => {
159-
if (e.affectsConfiguration(TerminalSettingId.ConfirmOnKill)) {
160-
this._onDidChangeDirty.fire();
161-
}
162-
});
163145
if (_terminalInstance) {
164146
this._setupInstanceListeners();
165147
}
@@ -184,7 +166,6 @@ export class TerminalEditorInput extends EditorInput implements IEditorCloseHand
184166
instance.onIconChanged(() => this._onDidChangeLabel.fire()),
185167
instance.onDidFocus(() => this._terminalEditorFocusContextKey.set(true)),
186168
instance.onDidBlur(() => this._terminalEditorFocusContextKey.reset()),
187-
instance.onDidChangeHasChildProcesses(() => this._onDidChangeDirty.fire()),
188169
instance.statusList.onDidChangePrimaryStatus(() => this._onDidChangeLabel.fire())
189170
];
190171

0 commit comments

Comments
 (0)