Skip to content

Commit

Permalink
use terminals from the editorService
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrogge committed Jun 15, 2022
1 parent a084f63 commit ae7a4ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import { Emitter } from 'vs/base/common/event';
import { Disposable, dispose, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri';
import { FindReplaceState } from 'vs/editor/contrib/find/browser/findState';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { EditorActivation } from 'vs/platform/editor/common/editor';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IShellLaunchConfig, TerminalLocation } from 'vs/platform/terminal/common/terminal';
import { IShellLaunchConfig, TerminalLocation, TerminalSettingId } from 'vs/platform/terminal/common/terminal';
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
import { IDeserializedTerminalEditorInput, ITerminalEditorService, ITerminalInstance, ITerminalInstanceService, TerminalEditorLocation } from 'vs/workbench/contrib/terminal/browser/terminal';
import { TerminalEditor } from 'vs/workbench/contrib/terminal/browser/terminalEditor';
Expand Down Expand Up @@ -52,7 +53,8 @@ export class TerminalEditorService extends Disposable implements ITerminalEditor
@IInstantiationService private readonly _instantiationService: IInstantiationService,
@ILifecycleService lifecycleService: ILifecycleService,
@IWorkbenchEnvironmentService private readonly _environmentService: IWorkbenchEnvironmentService,
@IContextKeyService contextKeyService: IContextKeyService
@IContextKeyService contextKeyService: IContextKeyService,
@IConfigurationService private readonly _configurationService: IConfigurationService
) {
super();
this._terminalEditorActive = TerminalContextKeys.terminalEditorActive.bindTo(contextKeyService);
Expand Down Expand Up @@ -93,6 +95,9 @@ export class TerminalEditorService extends Disposable implements ITerminalEditor
// Remove the terminal from the managed instances when the editor closes. This fires when
// dragging and dropping to another editor or closing the editor via cmd/ctrl+w.
this._register(this._editorService.onDidCloseEditor(e => {
if (this._isShuttingDown && this._configurationService.getValue(TerminalSettingId.PersistentSessionReviveProcess)) {
return;
}
const instance = e.editor instanceof TerminalEditorInput ? e.editor.terminalInstance : undefined;
if (instance) {
const instanceIndex = this.instances.findIndex(e => e === instance);
Expand Down
3 changes: 1 addition & 2 deletions src/vs/workbench/contrib/terminal/browser/terminalService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,7 @@ export class TerminalService implements ITerminalService {
seenPersistentProcessIds.push(term.terminal);
}
}
const otherInstances = this.instances.filter(instance => typeof instance.persistentProcessId === 'number' && instance.shouldPersist && seenPersistentProcessIds.indexOf(instance.persistentProcessId) === -1);
const editorTerminals = otherInstances.map((instance) => {
const editorTerminals = this._terminalEditorService.instances.map((instance) => {
return {
terminal: instance.persistentProcessId || 0
};
Expand Down

0 comments on commit ae7a4ba

Please sign in to comment.