Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skip task terminals when startup kind is not reload #157560

Merged
merged 2 commits into from Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -329,7 +329,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
this._register(this.onDidStateChange(e => {
if (this._willRestart) {
const key = e.__task?.getRecentlyUsedKey();
if (e.kind === TaskEventKind.Terminated && key) {
if (e.kind === TaskEventKind.End && key) {
this.removePersistentTask(key);
}
}
Expand Down
12 changes: 7 additions & 5 deletions src/vs/workbench/contrib/terminal/browser/terminalService.ts
Expand Up @@ -43,7 +43,7 @@ import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editor
import { ACTIVE_GROUP, IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { ILifecycleService, ShutdownReason, WillShutdownEvent } from 'vs/workbench/services/lifecycle/common/lifecycle';
import { ILifecycleService, ShutdownReason, StartupKind, WillShutdownEvent } from 'vs/workbench/services/lifecycle/common/lifecycle';
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';

export class TerminalService implements ITerminalService {
Expand Down Expand Up @@ -153,7 +153,7 @@ export class TerminalService implements ITerminalService {

constructor(
@IContextKeyService private _contextKeyService: IContextKeyService,
@ILifecycleService lifecycleService: ILifecycleService,
@ILifecycleService private readonly _lifecycleService: ILifecycleService,
@ILogService private readonly _logService: ILogService,
@IDialogService private _dialogService: IDialogService,
@IInstantiationService private _instantiationService: IInstantiationService,
Expand Down Expand Up @@ -212,8 +212,8 @@ export class TerminalService implements ITerminalService {
this._terminalEditorActive.set(!!instance?.target && instance.target === TerminalLocation.Editor);
});

lifecycleService.onBeforeShutdown(async e => e.veto(this._onBeforeShutdown(e.reason), 'veto.terminal'));
lifecycleService.onWillShutdown(e => this._onWillShutdown(e));
_lifecycleService.onBeforeShutdown(async e => e.veto(this._onBeforeShutdown(e.reason), 'veto.terminal'));
_lifecycleService.onWillShutdown(e => this._onWillShutdown(e));

// Create async as the class depends on `this`
timeout(0).then(() => this._instantiationService.createInstance(TerminalEditorStyle, document.head));
Expand Down Expand Up @@ -427,6 +427,9 @@ export class TerminalService implements ITerminalService {
let terminalInstance: ITerminalInstance | undefined;
let group: ITerminalGroup | undefined;
for (const terminalLayout of terminalLayouts) {
if (this._lifecycleService.startupKind !== StartupKind.ReloadedWindow && terminalLayout.terminal?.type === 'Task') {
continue;
}
if (!terminalInstance) {
// create group and terminal
terminalInstance = await this.createTerminal({
Expand Down Expand Up @@ -625,7 +628,6 @@ export class TerminalService implements ITerminalService {
return;
}


// Force dispose of all terminal instances
const shouldPersistTerminalsForEvent = this._shouldReviveProcesses(e.reason);
for (const instance of this.instances) {
Expand Down