@@ -47,7 +47,7 @@ import { ITextFileService } from 'vs/workbench/services/textfile/common/textfile
47
47
import { ITerminalGroupService , ITerminalService } from 'vs/workbench/contrib/terminal/browser/terminal' ;
48
48
import { ITerminalProfileResolverService } from 'vs/workbench/contrib/terminal/common/terminal' ;
49
49
50
- import { ConfiguringTask , ContributedTask , CustomTask , ExecutionEngine , InMemoryTask , ITaskEvent , ITaskIdentifier , ITaskSet , JsonSchemaVersion , KeyedTaskIdentifier , RuntimeType , Task , TaskDefinition , TaskEventKind , TaskGroup , TaskRunSource , TaskSettingId , TaskSorter , TaskSourceKind , TasksSchemaProperties , TASK_RUNNING_STATE , USER_TASKS_GROUP_KEY } from 'vs/workbench/contrib/tasks/common/tasks' ;
50
+ import { ConfiguringTask , ContributedTask , CustomTask , ExecutionEngine , InMemoryTask , ITaskEvent , ITaskIdentifier , ITaskSet , JsonSchemaVersion , KeyedTaskIdentifier , RuntimeType , Task , TASK_RUNNING_STATE , TaskDefinition , TaskEventKind , TaskGroup , TaskRunSource , TaskSettingId , TaskSorter , TaskSourceKind , TasksSchemaProperties , USER_TASKS_GROUP_KEY } from 'vs/workbench/contrib/tasks/common/tasks' ;
51
51
import { CustomExecutionSupportedContext , ICustomizationProperties , IProblemMatcherRunOptions , ITaskFilter , ITaskProvider , ITaskService , IWorkspaceFolderTaskResult , ProcessExecutionSupportedContext , ServerlessWebContext , ShellExecutionSupportedContext , TaskCommandsRegistered , TaskExecutionSupportedContext } from 'vs/workbench/contrib/tasks/common/taskService' ;
52
52
import { ITaskExecuteResult , ITaskResolver , ITaskSummary , ITaskSystem , ITaskSystemInfo , ITaskTerminateResponse , TaskError , TaskErrors , TaskExecuteKind } from 'vs/workbench/contrib/tasks/common/taskSystem' ;
53
53
import { getTemplates as getTaskTemplates } from 'vs/workbench/contrib/tasks/common/taskTemplates' ;
@@ -60,15 +60,18 @@ import { IQuickInputService, IQuickPick, IQuickPickItem, IQuickPickSeparator, Qu
60
60
import { IContextKey , IContextKeyService } from 'vs/platform/contextkey/common/contextkey' ;
61
61
import { TaskDefinitionRegistry } from 'vs/workbench/contrib/tasks/common/taskDefinitionRegistry' ;
62
62
63
+ import { raceTimeout } from 'vs/base/common/async' ;
63
64
import { CancellationToken , CancellationTokenSource } from 'vs/base/common/cancellation' ;
64
65
import { once } from 'vs/base/common/functional' ;
65
66
import { toFormattedString } from 'vs/base/common/jsonFormatter' ;
66
67
import { Schemas } from 'vs/base/common/network' ;
68
+ import { ThemeIcon } from 'vs/base/common/themables' ;
67
69
import { IResolvedTextEditorModel , ITextModelService } from 'vs/editor/common/services/resolverService' ;
68
70
import { TextEditorSelectionRevealType } from 'vs/platform/editor/common/editor' ;
71
+ import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
69
72
import { ILogService } from 'vs/platform/log/common/log' ;
73
+ import { TerminalExitReason } from 'vs/platform/terminal/common/terminal' ;
70
74
import { IThemeService } from 'vs/platform/theme/common/themeService' ;
71
- import { ThemeIcon } from 'vs/base/common/themables' ;
72
75
import { IWorkspaceTrustManagementService , IWorkspaceTrustRequestService } from 'vs/platform/workspace/common/workspaceTrust' ;
73
76
import { VirtualWorkspaceContext } from 'vs/workbench/common/contextkeys' ;
74
77
import { EditorResourceAccessor , SaveReason } from 'vs/workbench/common/editor' ;
@@ -79,10 +82,7 @@ import { ILifecycleService, ShutdownReason, StartupKind } from 'vs/workbench/ser
79
82
import { IPaneCompositePartService } from 'vs/workbench/services/panecomposite/browser/panecomposite' ;
80
83
import { IPathService } from 'vs/workbench/services/path/common/pathService' ;
81
84
import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences' ;
82
- import { TerminalExitReason } from 'vs/platform/terminal/common/terminal' ;
83
85
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService' ;
84
- import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
85
- import { raceTimeout } from 'vs/base/common/async' ;
86
86
87
87
const QUICKOPEN_HISTORY_LIMIT_CONFIG = 'task.quickOpen.history' ;
88
88
const PROBLEM_MATCHER_NEVER_CONFIG = 'task.problemMatchers.neverPrompt' ;
@@ -223,8 +223,10 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
223
223
224
224
protected _outputChannel : IOutputChannel ;
225
225
protected readonly _onDidStateChange : Emitter < ITaskEvent > ;
226
- private _waitForSupportedExecutions : Promise < void > ;
226
+ private _waitForOneSupportedExecution : Promise < void > ;
227
+ private _waitForAllSupportedExecutions : Promise < void > ;
227
228
private _onDidRegisterSupportedExecutions : Emitter < void > = new Emitter ( ) ;
229
+ private _onDidRegisterAllSupportedExecutions : Emitter < void > = new Emitter ( ) ;
228
230
private _onDidChangeTaskSystemInfo : Emitter < void > = new Emitter ( ) ;
229
231
private _willRestart : boolean = false ;
230
232
public onDidChangeTaskSystemInfo : Event < void > = this . _onDidChangeTaskSystemInfo . event ;
@@ -333,9 +335,12 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
333
335
this . _setPersistentTask ( e . __task ) ;
334
336
}
335
337
} ) ) ;
336
- this . _waitForSupportedExecutions = new Promise ( resolve => {
338
+ this . _waitForOneSupportedExecution = new Promise ( resolve => {
337
339
once ( this . _onDidRegisterSupportedExecutions . event ) ( ( ) => resolve ( ) ) ;
338
340
} ) ;
341
+ this . _waitForAllSupportedExecutions = new Promise ( resolve => {
342
+ once ( this . _onDidRegisterAllSupportedExecutions . event ) ( ( ) => resolve ( ) ) ;
343
+ } ) ;
339
344
if ( this . _terminalService . getReconnectedTerminals ( 'Task' ) ?. length ) {
340
345
this . _attemptTaskReconnection ( ) ;
341
346
} else {
@@ -365,6 +370,9 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
365
370
// update tasks so an incomplete list isn't returned when getWorkspaceTasks is called
366
371
this . _workspaceTasksPromise = undefined ;
367
372
this . _onDidRegisterSupportedExecutions . fire ( ) ;
373
+ if ( custom && shell && process ) {
374
+ this . _onDidRegisterAllSupportedExecutions . fire ( ) ;
375
+ }
368
376
}
369
377
370
378
private _attemptTaskReconnection ( ) : void {
@@ -2201,7 +2209,12 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
2201
2209
if ( ! ( await this . _trust ( ) ) ) {
2202
2210
return new Map ( ) ;
2203
2211
}
2204
- await this . _waitForSupportedExecutions ;
2212
+ await this . _waitForOneSupportedExecution ;
2213
+ if ( runSource === TaskRunSource . Reconnect ) {
2214
+ await raceTimeout ( this . _waitForAllSupportedExecutions , 2000 , ( ) => {
2215
+ this . _logService . warn ( 'Timed out waiting for all supported executions for task reconnection' ) ;
2216
+ } ) ;
2217
+ }
2205
2218
await this . _whenTaskSystemReady ;
2206
2219
if ( this . _workspaceTasksPromise ) {
2207
2220
return this . _workspaceTasksPromise ;
@@ -2878,7 +2891,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
2878
2891
/**
2879
2892
*
2880
2893
* @param tasks - The tasks which need to be filtered
2881
- * @param taskGlobsInList - This tells splitPerGroupType to filter out globbed tasks (into defaults)
2894
+ * @param tasksInList - This tells splitPerGroupType to filter out globbed tasks (into defaults)
2882
2895
* @returns
2883
2896
*/
2884
2897
private _getDefaultTasks ( tasks : Task [ ] , taskGlobsInList : boolean = false ) : Task [ ] {
0 commit comments