check if values are true not just undefined (#155348)

This commit is contained in:
Megan Rogge 2022-07-15 18:15:43 -07:00 committed by GitHub
parent cad5e069b6
commit 7839742867
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View file

@ -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 && !Platform.isWeb;
}
private _computeWorkspaceFolderTasks(workspaceFolder: IWorkspaceFolder, runSource: TaskRunSource = TaskRunSource.User): Promise<IWorkspaceFolderTaskResult> {

View file

@ -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);