Skip to content

Commit 7839742

Browse files
authored
check if values are true not just undefined (microsoft#155348)
1 parent cad5e06 commit 7839742

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,9 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
293293
}));
294294
this._taskRunningState = TASK_RUNNING_STATE.bindTo(_contextKeyService);
295295
this._onDidStateChange = this._register(new Emitter());
296-
this._registerCommands();
296+
this._registerCommands().then(() => {
297+
TaskCommandsRegistered.bindTo(this._contextKeyService).set(true);
298+
});
297299
this._configurationResolverService.contributeVariable('defaultBuildTask', async (): Promise<string | undefined> => {
298300
let tasks = await this._getTasksForGroup(TaskGroup.Build);
299301
if (tasks.length > 0) {
@@ -491,7 +493,6 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
491493
this._openTaskFile(resource, TaskSourceKind.WorkspaceFile);
492494
}
493495
});
494-
TaskCommandsRegistered.bindTo(this._contextKeyService).set(true);
495496
}
496497

497498
private get workspaceFolders(): IWorkspaceFolder[] {
@@ -2173,7 +2174,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
21732174
}
21742175

21752176
private get _jsonTasksSupported(): boolean {
2176-
return !!ShellExecutionSupportedContext.getValue(this._contextKeyService) && !!ProcessExecutionSupportedContext.getValue(this._contextKeyService);
2177+
return ShellExecutionSupportedContext.getValue(this._contextKeyService) === true && ProcessExecutionSupportedContext.getValue(this._contextKeyService) === true && !Platform.isWeb;
21772178
}
21782179

21792180
private _computeWorkspaceFolderTasks(workspaceFolder: IWorkspaceFolder, runSource: TaskRunSource = TaskRunSource.User): Promise<IWorkspaceFolderTaskResult> {

src/vs/workbench/contrib/tasks/browser/task.contribution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import { TaskDefinitionRegistry } from 'vs/workbench/contrib/tasks/common/taskDe
4040
import { TerminalMenuBarGroup } from 'vs/workbench/contrib/terminal/browser/terminalMenus';
4141
import { isString } from 'vs/base/common/types';
4242

43-
const SHOW_TASKS_COMMANDS_CONTEXT = ContextKeyExpr.or(ShellExecutionSupportedContext, ProcessExecutionSupportedContext);
43+
const SHOW_TASKS_COMMANDS_CONTEXT = ContextKeyExpr.and(ShellExecutionSupportedContext, ProcessExecutionSupportedContext, TaskCommandsRegistered);
4444

4545
const workbenchRegistry = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench);
4646
workbenchRegistry.registerWorkbenchContribution(RunAutomaticTasks, LifecyclePhase.Eventually);

0 commit comments

Comments
 (0)