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

prevent task / extension activation deadlock #176298

Merged
merged 3 commits into from Mar 7, 2023
Merged
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
13 changes: 9 additions & 4 deletions src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts
Expand Up @@ -82,6 +82,7 @@ import { IPreferencesService } from 'vs/workbench/services/preferences/common/pr
import { TerminalExitReason } from 'vs/platform/terminal/common/terminal';
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { timeout } from 'vs/base/common/async';

const QUICKOPEN_HISTORY_LIMIT_CONFIG = 'task.quickOpen.history';
const PROBLEM_MATCHER_NEVER_CONFIG = 'task.problemMatchers.neverPrompt';
Expand Down Expand Up @@ -574,10 +575,14 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
// We need to first wait for extensions to be registered because we might read
// the `TaskDefinitionRegistry` in case `type` is `undefined`
await this._extensionService.whenInstalledExtensionsRegistered();

await Promise.all(
this._getActivationEvents(type).map(activationEvent => this._extensionService.activateByEvent(activationEvent))
);
// Wait for the first of either to resolve
await Promise.race([
// Create a promise that resolves when all activation promises resolve
Promise.all(
this._getActivationEvents(type).map(activationEvent => this._extensionService.activateByEvent(activationEvent))
),
timeout(5000).then(() => console.warn('Timed out activating extensions for task providers'))
]);
}

private _updateSetup(setup?: [IWorkspaceFolder[], IWorkspaceFolder[], ExecutionEngine, JsonSchemaVersion, IWorkspace | undefined]): void {
Expand Down