mirror of
https://github.com/microsoft/vscode.git
synced 2026-08-27 21:09:31 +01:00
fix #187876
This commit is contained in:
@@ -229,6 +229,8 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||
private _onDidChangeTaskSystemInfo: Emitter<void> = new Emitter();
|
||||
private _willRestart: boolean = false;
|
||||
public onDidChangeTaskSystemInfo: Event<void> = this._onDidChangeTaskSystemInfo.event;
|
||||
private _onDidReconnectToTasks: Emitter<void> = new Emitter();
|
||||
public onDidReconnectToTasks: Event<void> = this._onDidReconnectToTasks.event;
|
||||
|
||||
constructor(
|
||||
@IConfigurationService private readonly _configurationService: IConfigurationService,
|
||||
@@ -384,6 +386,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||
}
|
||||
this.getWorkspaceTasks(TaskRunSource.Reconnect).then(async () => {
|
||||
this._tasksReconnected = await this._reconnectTasks();
|
||||
this._onDidReconnectToTasks.fire();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1862,6 +1865,11 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||
}
|
||||
if (executeResult.kind === TaskExecuteKind.Active) {
|
||||
const active = executeResult.active;
|
||||
if (active && active.same && runSource === TaskRunSource.FolderOpen) {
|
||||
// ignore, the task is already active, likely from being reconnected.
|
||||
this._logService.debug('Ignoring task that is already active', executeResult.task);
|
||||
return executeResult.promise;
|
||||
}
|
||||
if (active && active.same) {
|
||||
if (this._taskSystem?.isTaskVisible(executeResult.task)) {
|
||||
const message = nls.localize('TaskSystem.activeSame.noBackground', 'The task \'{0}\' is already active.', executeResult.task.getQualifiedLabel());
|
||||
|
||||
@@ -28,9 +28,11 @@ export class RunAutomaticTasks extends Disposable implements IWorkbenchContribut
|
||||
@IWorkspaceTrustManagementService private readonly _workspaceTrustManagementService: IWorkspaceTrustManagementService,
|
||||
@ILogService private readonly _logService: ILogService) {
|
||||
super();
|
||||
if (this._workspaceTrustManagementService.isWorkspaceTrusted()) {
|
||||
this._tryRunTasks();
|
||||
}
|
||||
this._taskService.onDidReconnectToTasks((() => {
|
||||
if (this._workspaceTrustManagementService.isWorkspaceTrusted()) {
|
||||
this._tryRunTasks();
|
||||
}
|
||||
}));
|
||||
this._register(this._workspaceTrustManagementService.onDidChangeTrust(async trusted => {
|
||||
if (trusted) {
|
||||
await this._tryRunTasks();
|
||||
|
||||
@@ -64,6 +64,7 @@ export interface IWorkspaceFolderTaskResult extends IWorkspaceTaskResult {
|
||||
export interface ITaskService {
|
||||
readonly _serviceBrand: undefined;
|
||||
onDidStateChange: Event<ITaskEvent>;
|
||||
onDidReconnectToTasks: Event<void>;
|
||||
supportsMultipleTaskExecutions: boolean;
|
||||
|
||||
configureAction(): Action;
|
||||
|
||||
Reference in New Issue
Block a user