Enable globs on tasks otherwise fallback to default - fixes #88106 (#141230)

* use glob on tasks otherwise fallback to default

* add support for test commands also

* try to find one globbed task otherwise fallback to defaults

* - get relativePath (but fallback to absolute if outside of workspace)
- bring back json schema

* Refactor and reduce duplicate code

* remove glob, make isDefault a string or boolean

* update taskConfig

* - rebase
- type updates
- splitPerGroupType should check explicitly for true on isDefault
- hygiene check

* Remove task glob from API

* Task group DTO updates

* Make sure globs run ahead of default task if there's multiple globs matching

* Style and name changes

* More naming and code re-use

* Glob doesn't work when only 1 glob match

Co-authored-by: Alex Ross <alros@microsoft.com>
This commit is contained in:
Jason Williams
2022-05-03 08:56:24 +01:00
committed by GitHub
parent 9807017327
commit e19f09713b
7 changed files with 136 additions and 91 deletions

View File

@@ -29,7 +29,7 @@ import { ExtHostContext, MainThreadTaskShape, ExtHostTaskShape, MainContext } fr
import {
TaskDefinitionDTO, TaskExecutionDTO, ProcessExecutionOptionsDTO, TaskPresentationOptionsDTO,
ProcessExecutionDTO, ShellExecutionDTO, ShellExecutionOptionsDTO, CustomExecutionDTO, TaskDTO, TaskSourceDTO, TaskHandleDTO, TaskFilterDTO, TaskProcessStartedDTO, TaskProcessEndedDTO, TaskSystemInfoDTO,
RunOptionsDTO
RunOptionsDTO, TaskGroupDTO
} from 'vs/workbench/api/common/shared/tasks';
import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver';
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
@@ -320,7 +320,7 @@ namespace TaskDTO {
hasDefinedMatchers: ContributedTask.is(task) ? task.hasDefinedMatchers : false,
runOptions: RunOptionsDTO.from(task.runOptions),
};
result.group = TaskGroup.from(task.configurationProperties.group);
result.group = TaskGroupDTO.from(task.configurationProperties.group);
if (task.configurationProperties.detail) {
result.detail = task.configurationProperties.detail;
@@ -389,6 +389,18 @@ namespace TaskDTO {
}
}
namespace TaskGroupDTO {
export function from(value: string | TaskGroup | undefined): TaskGroupDTO | undefined {
if (value === undefined) {
return undefined;
}
return {
_id: (typeof value === 'string') ? value : value._id,
isDefault: (typeof value === 'string') ? false : ((typeof value.isDefault === 'string') ? false : value.isDefault)
};
}
}
namespace TaskFilterDTO {
export function from(value: TaskFilter): TaskFilterDTO {
return value;

View File

@@ -320,7 +320,7 @@ export namespace TaskDTO {
result.group = types.TaskGroup.from(value.group._id);
if (result.group && value.group.isDefault) {
result.group = new types.TaskGroup(result.group.id, result.group.label);
if (value.group.isDefault) {
if (value.group.isDefault === true) {
result.group.isDefault = value.group.isDefault;
}
}