taskConfiguration.ts ×45

Frontier kind: Code frontier

unlabeled · c_e9e1766c0fd7

54 tests · 20969 LOC · 80 files · introduces 0 tests · 110 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
48 ranges110 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2370 ranges20969 lines · 80 files · Browse complete extent
All tests (intent)
54 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 110 introduced LOC across 48 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/tasks/common/taskConfiguration.ts 102 introduced LOC · 45 ranges

Open complete file

659
660 // eslint-disable-next-line @typescript-eslint/no-explicit-any -- IMetaData array holds heterogeneous parser types
661 > function _fillDefaults<T>(this: void, target: T | undefined, defaults: T | undefined, properties: IMetaData<T, any>[], context: IParseContext): T | undefined { taskConfiguration.ts
662 > if (target && Object.isFrozen(target)) {
663 return target;
664 }
665 > if (target === undefined || target === null || defaults === undefined || defaults === null) { taskConfiguration.ts
666 > if (defaults !== undefined && defaults !== null) {
667 > return Objects.deepClone(defaults);
668 > } else {
669 return undefined;
670 }
672 for (const meta of properties) {
673 const property = meta.property;
886
887 export function fillDefaults(value: Tasks.CommandOptions | undefined, context: IParseContext): Tasks.CommandOptions | undefined {
888 > return _fillDefaults(value, defaults, properties, context); taskConfiguration.ts
889 > }
890
891 export function freeze(value: Tasks.CommandOptions): Readonly<Tasks.CommandOptions> | undefined {
904
905 export function from(this: void, config: IPresentationOptionsShape, context: IParseContext): Tasks.IPresentationOptions | undefined {
906 > let echo: boolean; taskConfiguration.ts
907 > let reveal: Tasks.RevealKind;
908 > let revealProblems: Tasks.RevealProblemKind;
909 > let focus: boolean;
910 > let panel: Tasks.PanelKind;
911 > let showReuseMessage: boolean;
912 > let clear: boolean;
913 > let group: string | undefined;
914 > let close: boolean | undefined;
915 > let preserveTerminalName: boolean | undefined;
916 > let hasProps = false;
917 > if (Types.isBoolean(config.echoCommand)) {
918 echo = config.echoCommand;
919 hasProps = true;
920 }
921 > if (Types.isString(config.showOutput)) { taskConfiguration.ts
922 reveal = Tasks.RevealKind.fromString(config.showOutput);
923 hasProps = true;
924 }
925 > const presentation = config.presentation || config.terminal; taskConfiguration.ts
926 > if (presentation) {
927 if (Types.isBoolean(presentation.echo)) {
928 echo = presentation.echo;
957 hasProps = true;
958 }
959 > if (!hasProps) { taskConfiguration.ts
960 return undefined;
961 }
962 return { echo: echo!, reveal: reveal!, revealProblems: revealProblems!, focus: focus!, panel: panel!, showReuseMessage: showReuseMessage!, clear: clear!, group, close: close, preserveTerminalName };
964
965 export function assignProperties(target: Tasks.IPresentationOptions, source: Tasks.IPresentationOptions | undefined): Tasks.IPresentationOptions | undefined {
972
973 export function fillDefaults(value: Tasks.IPresentationOptions, context: IParseContext): Tasks.IPresentationOptions | undefined {
974 > const defaultEcho = context.engine === Tasks.ExecutionEngine.Terminal ? true : false; taskConfiguration.ts
975 > return _fillDefaults(value, { echo: defaultEcho, reveal: Tasks.RevealKind.Always, revealProblems: Tasks.RevealProblemKind.Never, focus: false, panel: Tasks.PanelKind.Shared, showReuseMessage: true, clear: false, preserveTerminalName: false }, properties, context);
976 > }
977
978 export function freeze(value: Tasks.IPresentationOptions): Readonly<Tasks.IPresentationOptions> | undefined {
987 namespace ShellString {
988 export function from(this: void, value: CommandString | undefined): Tasks.CommandString | undefined {
989 > if (value === undefined || value === null) { taskConfiguration.ts
990 return undefined;
991 }
1026
1027 export function from(this: void, config: ICommandConfigurationShape, context: IParseContext): Tasks.ICommandConfiguration | undefined {
1028 > let result: Tasks.ICommandConfiguration = fromBase(config, context)!; taskConfiguration.ts
1029 >
1030 > let osConfig: Tasks.ICommandConfiguration | undefined = undefined;
1031 > if (config.windows && context.platform === Platform.Windows) {
1032 osConfig = fromBase(config.windows, context);
1033 > } else if (config.osx && context.platform === Platform.Mac) { taskConfiguration.ts
1034 osConfig = fromBase(config.osx, context);
1035 > } else if (config.linux && context.platform === Platform.Linux) { taskConfiguration.ts
1036 osConfig = fromBase(config.linux, context);
1037 }
1038 > if (osConfig) { taskConfiguration.ts
1039 result = assignProperties(result, osConfig, context.schemaVersion === Tasks.JsonSchemaVersion.V2_0_0);
1040 }
1041 > return isEmpty(result) ? undefined : result; taskConfiguration.ts
1042 > }
1043
1044 function fromBase(this: void, config: IBaseCommandConfigurationShape, context: IParseContext): Tasks.ICommandConfiguration | undefined {
1045 > const name: Tasks.CommandString | undefined = ShellString.from(config.command); taskConfiguration.ts
1046 > let runtime: Tasks.RuntimeType;
1047 > if (Types.isString(config.type)) {
1048 if (config.type === 'shell' || config.type === 'process') {
1049 runtime = Tasks.RuntimeType.fromString(config.type);
1050 }
1051 }
1052 > if (Types.isBoolean(config.isShellCommand) || ShellConfiguration.is(config.isShellCommand)) { taskConfiguration.ts
1053 runtime = Tasks.RuntimeType.Shell;
1054 > } else if (config.isShellCommand !== undefined) { taskConfiguration.ts
1055 runtime = !!config.isShellCommand ? Tasks.RuntimeType.Shell : Tasks.RuntimeType.Process;
1056 }
1058 > const result: Tasks.ICommandConfiguration = {
1059 > name: name,
1060 > runtime: runtime!,
1061 > presentation: PresentationOptions.from(config, context)!
1062 > };
1063 >
1064 > if (config.args !== undefined) {
1065 result.args = [];
1066 for (const arg of config.args) {
1078 }
1079 }
1080 > if (config.options !== undefined) { taskConfiguration.ts
1081 result.options = CommandOptions.from(config.options, context);
1082 if (result.options && result.options.shell === undefined && ShellConfiguration.is(config.isShellCommand)) {
1087 }
1088 }
1090 > if (Types.isString(config.taskSelector)) {
1091 result.taskSelector = config.taskSelector;
1092 }
1093 > if (Types.isBoolean(config.suppressTaskName)) { taskConfiguration.ts
1094 result.suppressTaskName = config.suppressTaskName;
1095 }
1097 > return isEmpty(result) ? undefined : result;
1098 > }
1099
1100 export function hasCommand(value: Tasks.ICommandConfiguration): boolean {
1101 > return value && !!value.name; taskConfiguration.ts
1102 > }
1103
1104 export function isEmpty(value: Tasks.ICommandConfiguration | undefined): boolean {
1105 > return _isEmpty(value, properties); taskConfiguration.ts
1106 > }
1107
1108 export function assignProperties(target: Tasks.ICommandConfiguration, source: Tasks.ICommandConfiguration, overwriteArgs: boolean): Tasks.ICommandConfiguration {
1134
1135 export function fillGlobals(target: Tasks.ICommandConfiguration, source: Tasks.ICommandConfiguration | undefined, taskName: string | undefined): Tasks.ICommandConfiguration {
1136 > if ((source === undefined) || isEmpty(source)) { taskConfiguration.ts
1137 return target;
1138 }
1142 presentation: undefined
1143 };
1144 > if (target.name === undefined) { taskConfiguration.ts
1145 fillProperty(target, source, 'name');
1146 fillProperty(target, source, 'taskSelector');
1165
1166 return target;
1168
1169 export function fillDefaults(value: Tasks.ICommandConfiguration | undefined, context: IParseContext): void {
1170 > if (!value || Object.isFrozen(value)) { taskConfiguration.ts
1171 return;
1172 }
1173 > if (value.name !== undefined && value.runtime === undefined) { taskConfiguration.ts
1174 value.runtime = Tasks.RuntimeType.Process;
1175 }
1176 > value.presentation = PresentationOptions.fillDefaults(value.presentation!, context)!; taskConfiguration.ts
1177 > if (!isEmpty(value)) {
1178 > value.options = CommandOptions.fillDefaults(value.options, context);
1179 > }
1180 > if (value.args === undefined) {
1181 value.args = EMPTY_ARRAY;
1182 }
1183 > if (value.suppressTaskName === undefined) { taskConfiguration.ts
1184 value.suppressTaskName = (context.schemaVersion === Tasks.JsonSchemaVersion.V2_0_0);
1185 }
1187
1188 export function freeze(value: Tasks.ICommandConfiguration): Readonly<Tasks.ICommandConfiguration> | undefined {
1647
1648 export function fillGlobals(task: Tasks.CustomTask, globals: IGlobals): void {
1649 > // We only merge a command from a global definition if there is no dependsOn taskConfiguration.ts
1650 > // or there is a dependsOn and a defined command.
1651 > if (CommandConfiguration.hasCommand(task.command) || task.configurationProperties.dependsOn === undefined) {
1652 > task.command = CommandConfiguration.fillGlobals(task.command, globals.command, task.configurationProperties.name);
1653 > }
1654 > if (task.configurationProperties.problemMatchers === undefined && globals.problemMatcher !== undefined) {
1655 task.configurationProperties.problemMatchers = Objects.deepClone(globals.problemMatcher);
1656 task.hasDefinedMatchers = true;
1657 }
1658 > // promptOnClose is inferred from isBackground if available taskConfiguration.ts
1659 > if (task.configurationProperties.promptOnClose === undefined && task.configurationProperties.isBackground === undefined && globals.promptOnClose !== undefined) {
1660 task.configurationProperties.promptOnClose = globals.promptOnClose;
1661 }
1663
1664 export function fillDefaults(task: Tasks.CustomTask, context: IParseContext): void {
1665 > CommandConfiguration.fillDefaults(task.command, context); taskConfiguration.ts
1666 > if (task.configurationProperties.promptOnClose === undefined) {
1667 task.configurationProperties.promptOnClose = task.configurationProperties.isBackground !== undefined ? !task.configurationProperties.isBackground : true;
1668 }
1669 > if (task.configurationProperties.isBackground === undefined) { taskConfiguration.ts
1670 task.configurationProperties.isBackground = false;
1671 }
1672 > if (task.configurationProperties.problemMatchers === undefined) { taskConfiguration.ts
1673 task.configurationProperties.problemMatchers = EMPTY_ARRAY;
1674 }
1676
1677 export function createCustomTask(contributedTask: Tasks.ContributedTask, configuredProps: Tasks.ConfiguringTask | Tasks.CustomTask): Tasks.CustomTask {
2031
2032 public getUUID(identifier: string): string {
2033 > const lastValue = this.last ? this.last[identifier] : undefined; taskConfiguration.ts
2034 > let result: string | undefined = undefined;
2035 > if (lastValue !== undefined) {
2036 if (Array.isArray(lastValue)) {
2037 result = lastValue.shift();
2044 }
2045 }
2046 > if (result === undefined) { taskConfiguration.ts
2047 > result = UUID.generateUuid();
2048 > }
2049 > const currentValue = this.current[identifier];
2050 > if (currentValue === undefined) {
2051 > this.current[identifier] = result;
2052 > } else {
2053 if (Array.isArray(currentValue)) {
2054 currentValue.push(result);
2059 }
2060 }
2061 > return result; taskConfiguration.ts
2062 > }
2063
2064 public finish(): void {
src/vs/workbench/contrib/tasks/common/tasks.ts 8 introduced LOC · 3 ranges

Open complete file

636 this._id = id;
637 if (label) {
638 > this._label = label; tasks.ts
639 > }
640 if (type) {
641 this.type = type;
755
756 public constructor(id: string, source: FileBasedTaskSource, label: string, type: string, command: ICommandConfiguration | undefined,
757 > hasDefinedMatchers: boolean, runOptions: IRunOptions, configurationProperties: IConfigurationProperties) { tasks.ts
758 > super(id, label, undefined, runOptions, configurationProperties, source);
759 > this._source = source;
760 > this.hasDefinedMatchers = hasDefinedMatchers;
761 > if (command) {
762 this.command = command;
763 }
764 > } tasks.ts
765
766 public override clone(): CustomTask {