Skip to content

Commit

Permalink
check if values are true not just undefined (#155348)
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrogge authored Jul 16, 2022
1 parent cad5e06 commit 7839742
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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[] {
Expand Down Expand Up @@ -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 && !Platform.isWeb;
}

private _computeWorkspaceFolderTasks(workspaceFolder: IWorkspaceFolder, runSource: TaskRunSource = TaskRunSource.User): Promise<IWorkspaceFolderTaskResult> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, TaskCommandsRegistered);

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

0 comments on commit 7839742

Please sign in to comment.