diff options
author | Daniel Imms <2193314+Tyriar@users.noreply.github.com> | 2022-07-19 15:04:22 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-19 15:04:22 +0300 |
commit | 54694499a05e470711387732ac7cf55c224bc3ba (patch) | |
tree | db35fd270b3a2b3cc0ca0cc354ead80d37913e20 /src | |
parent | a5412dc9d82c41b8c6e482b9f800a046cecc4bbd (diff) | |
parent | 8846ac54887deb74afdb262cbdaecdd12b824f98 (diff) |
Merge pull request #155524 from microsoft/tyriar/155336
Check if execution values are true, delay registered ctx key
Diffstat (limited to 'src')
-rw-r--r-- | src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts | 7 | ||||
-rw-r--r-- | src/vs/workbench/contrib/tasks/browser/task.contribution.ts | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts b/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts index 4bfc497f05a..c123a941880 100644 --- a/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts +++ b/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts @@ -293,7 +293,9 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer })); this._taskRunningState = TASK_RUNNING_STATE.bindTo(_contextKeyService); this._onDidStateChange = this._register(new Emitter()); - this._registerCommands(); + this._registerCommands().then(() => { + TaskCommandsRegistered.bindTo(this._contextKeyService).set(true); + }); this._configurationResolverService.contributeVariable('defaultBuildTask', async (): Promise<string | undefined> => { let tasks = await this._getTasksForGroup(TaskGroup.Build); if (tasks.length > 0) { @@ -491,7 +493,6 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer this._openTaskFile(resource, TaskSourceKind.WorkspaceFile); } }); - TaskCommandsRegistered.bindTo(this._contextKeyService).set(true); } private get workspaceFolders(): IWorkspaceFolder[] { @@ -2173,7 +2174,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer } private get _jsonTasksSupported(): boolean { - return !!ShellExecutionSupportedContext.getValue(this._contextKeyService) && !!ProcessExecutionSupportedContext.getValue(this._contextKeyService); + return ShellExecutionSupportedContext.getValue(this._contextKeyService) === true && ProcessExecutionSupportedContext.getValue(this._contextKeyService) === true; } private _computeWorkspaceFolderTasks(workspaceFolder: IWorkspaceFolder, runSource: TaskRunSource = TaskRunSource.User): Promise<IWorkspaceFolderTaskResult> { diff --git a/src/vs/workbench/contrib/tasks/browser/task.contribution.ts b/src/vs/workbench/contrib/tasks/browser/task.contribution.ts index 3b7aa6162af..9b5df9014e5 100644 --- a/src/vs/workbench/contrib/tasks/browser/task.contribution.ts +++ b/src/vs/workbench/contrib/tasks/browser/task.contribution.ts @@ -40,7 +40,7 @@ import { TaskDefinitionRegistry } from 'vs/workbench/contrib/tasks/common/taskDe import { TerminalMenuBarGroup } from 'vs/workbench/contrib/terminal/browser/terminalMenus'; import { isString } from 'vs/base/common/types'; -const SHOW_TASKS_COMMANDS_CONTEXT = ContextKeyExpr.or(ShellExecutionSupportedContext, ProcessExecutionSupportedContext); +const SHOW_TASKS_COMMANDS_CONTEXT = ContextKeyExpr.and(ShellExecutionSupportedContext, ProcessExecutionSupportedContext); const workbenchRegistry = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench); workbenchRegistry.registerWorkbenchContribution(RunAutomaticTasks, LifecyclePhase.Eventually); |