taskConfiguration.ts ×41

Frontier kind: Code frontier

unlabeled · c_7cec916fd5cd

52 tests · 21096 LOC · 80 files · introduces 0 tests · 121 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
43 ranges121 lines · 3 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2415 ranges21096 lines · 80 files · Browse complete extent
All tests (intent)
52 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.

3 files ranked by introduced lines: 121 introduced LOC across 43 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/tasks/common/taskConfiguration.ts 117 introduced LOC · 41 ranges

Open complete file

1194
1195 export function namedFrom(this: void, declares: ProblemMatcherConfig.INamedProblemMatcher[] | undefined, context: IParseContext): IStringDictionary<INamedProblemMatcher> {
1196 > const result: IStringDictionary<INamedProblemMatcher> = Object.create(null); taskConfiguration.ts
1197 >
1198 > if (!Array.isArray(declares)) {
1199 > return result;
1200 > }
1201 (<ProblemMatcherConfig.INamedProblemMatcher[]>declares).forEach((value) => {
1202 const namedProblemMatcher = (new ProblemMatcherParser(context.problemReporter)).parse(value);
1208 });
1209 return result;
1211
1212 export function fromWithOsConfig(this: void, external: IConfigurationProperties & { [key: string]: unknown }, context: IParseContext): TaskConfigurationValueWithErrors<ProblemMatcher[]> {
1878
1879 export function from(config: IExternalTaskRunnerConfiguration, context: IParseContext): IGlobals {
1880 > let result = fromBase(config, context); taskConfiguration.ts
1881 > let osGlobals: IGlobals | undefined = undefined;
1882 > if (config.windows && context.platform === Platform.Windows) {
1883 osGlobals = fromBase(config.windows, context);
1884 > } else if (config.osx && context.platform === Platform.Mac) { taskConfiguration.ts
1885 osGlobals = fromBase(config.osx, context);
1886 > } else if (config.linux && context.platform === Platform.Linux) { taskConfiguration.ts
1887 osGlobals = fromBase(config.linux, context);
1888 }
1889 > if (osGlobals) { taskConfiguration.ts
1890 result = Globals.assignProperties(result, osGlobals);
1891 }
1892 > const command = CommandConfiguration.from(config, context); taskConfiguration.ts
1893 > if (command) {
1894 result.command = command;
1895 }
1896 > Globals.fillDefaults(result, context); taskConfiguration.ts
1897 > Globals.freeze(result);
1898 > return result;
1899 > }
1900
1901 export function fromBase(this: void, config: IBaseTaskRunnerConfiguration, context: IParseContext): IGlobals {
1902 > const result: IGlobals = {}; taskConfiguration.ts
1903 > if (config.suppressTaskName !== undefined) {
1904 result.suppressTaskName = !!config.suppressTaskName;
1905 }
1906 > if (config.promptOnClose !== undefined) { taskConfiguration.ts
1907 result.promptOnClose = !!config.promptOnClose;
1908 }
1909 > if (config.problemMatcher) { taskConfiguration.ts
1910 result.problemMatcher = ProblemMatcherConverter.from(config.problemMatcher, context).value;
1911 }
1912 > return result; taskConfiguration.ts
1913 > }
1914
1915 export function isEmpty(value: IGlobals): boolean {
1930
1931 export function fillDefaults(value: IGlobals, context: IParseContext): void {
1932 > if (!value) { taskConfiguration.ts
1933 return;
1934 }
1935 > CommandConfiguration.fillDefaults(value.command, context); taskConfiguration.ts
1936 > if (value.suppressTaskName === undefined) {
1937 value.suppressTaskName = (context.schemaVersion === Tasks.JsonSchemaVersion.V2_0_0);
1938 }
1939 > if (value.promptOnClose === undefined) { taskConfiguration.ts
1940 value.promptOnClose = true;
1941 }
1943
1944 export function freeze(value: IGlobals): void {
1945 > Object.freeze(value); taskConfiguration.ts
1946 > if (value.command) {
1947 CommandConfiguration.freeze(value.command);
1948 }
1950 }
1951
1953
1954 export function from(config: IExternalTaskRunnerConfiguration): Tasks.ExecutionEngine {
1955 > const runner = config.runner || config._runner; taskConfiguration.ts
1956 > let result: Tasks.ExecutionEngine | undefined;
1957 > if (runner) {
1958 switch (runner) {
1959 case 'terminal':
1965 }
1966 }
1967 > const schemaVersion = JsonSchemaVersion.from(config); taskConfiguration.ts
1968 > if (schemaVersion === Tasks.JsonSchemaVersion.V0_1_0) {
1969 return result || Tasks.ExecutionEngine.Process;
1970 > } else if (schemaVersion === Tasks.JsonSchemaVersion.V2_0_0) { taskConfiguration.ts
1971 return Tasks.ExecutionEngine.Terminal;
1972 } else {
1973 throw new Error('Shouldn\'t happen.');
1974 }
1976 }
1977
1981
1982 export function from(config: IExternalTaskRunnerConfiguration): Tasks.JsonSchemaVersion {
1983 > const version = config.version; taskConfiguration.ts
1984 > if (!version) {
1985 return _default;
1986 }
1987 > switch (version) { taskConfiguration.ts
1988 > case '0.1.0':
1989 return Tasks.JsonSchemaVersion.V0_1_0;
1990 > case '2.0.0': taskConfiguration.ts
1991 return Tasks.JsonSchemaVersion.V2_0_0;
1992 > default: taskConfiguration.ts
1993 return _default;
1995 > }
1996 }
1997
2026
2027 public start(): void {
2028 > this.last = this.current; taskConfiguration.ts
2029 > this.current = Object.create(null);
2030 > }
2031
2032 public getUUID(identifier: string): string {
2063
2064 public finish(): void {
2065 > this.last = undefined; taskConfiguration.ts
2066 > }
2067 }
2068
2082
2083 constructor(workspaceFolder: IWorkspaceFolder, workspace: IWorkspace | undefined, platform: Platform, problemReporter: IProblemReporter, uuidMap: UUIDMap) {
2084 > this.workspaceFolder = workspaceFolder; taskConfiguration.ts
2085 > this.workspace = workspace;
2086 > this.platform = platform;
2087 > this.problemReporter = problemReporter;
2088 > this.uuidMap = uuidMap;
2089 > }
2090
2091 public run(fileConfig: IExternalTaskRunnerConfiguration, source: TaskConfigSource, contextKeyService: IContextKeyService): IParseResult {
2092 > const engine = ExecutionEngine.from(fileConfig); taskConfiguration.ts
2093 > const schemaVersion = JsonSchemaVersion.from(fileConfig);
2094 > const context: IParseContext = {
2095 > workspaceFolder: this.workspaceFolder,
2096 > workspace: this.workspace,
2097 > problemReporter: this.problemReporter,
2098 > uuidMap: this.uuidMap,
2099 > namedProblemMatchers: {},
2100 > engine,
2101 > schemaVersion,
2102 > platform: this.platform,
2103 > taskLoadIssues: [],
2104 > contextKeyService
2105 > };
2106 > const taskParseResult = this.createTaskRunnerConfiguration(fileConfig, context, source);
2107 > return {
2108 > validationStatus: this.problemReporter.status,
2109 > custom: taskParseResult.custom,
2110 > configured: taskParseResult.configured,
2111 > engine
2112 > };
2113 > }
2114
2115 private createTaskRunnerConfiguration(fileConfig: IExternalTaskRunnerConfiguration, context: IParseContext, source: TaskConfigSource): ITaskParseResult {
2116 > const globals = Globals.from(fileConfig, context); taskConfiguration.ts
2117 > if (this.problemReporter.status.isFatal()) {
2118 return { custom: [], configured: [] };
2119 }
2120 > context.namedProblemMatchers = ProblemMatcherConverter.namedFrom(fileConfig.declares, context); taskConfiguration.ts
2121 > let globalTasks: Tasks.CustomTask[] | undefined = undefined;
2122 > let externalGlobalTasks: Array<IConfiguringTask | ICustomTask> | undefined = undefined;
2123 > if (fileConfig.windows && context.platform === Platform.Windows) {
2124 globalTasks = TaskParser.from(fileConfig.windows.tasks, globals, context, source).custom;
2125 externalGlobalTasks = fileConfig.windows.tasks;
2126 > } else if (fileConfig.osx && context.platform === Platform.Mac) { taskConfiguration.ts
2127 globalTasks = TaskParser.from(fileConfig.osx.tasks, globals, context, source).custom;
2128 externalGlobalTasks = fileConfig.osx.tasks;
2129 > } else if (fileConfig.linux && context.platform === Platform.Linux) { taskConfiguration.ts
2130 globalTasks = TaskParser.from(fileConfig.linux.tasks, globals, context, source).custom;
2131 externalGlobalTasks = fileConfig.linux.tasks;
2132 }
2133 > if (context.schemaVersion === Tasks.JsonSchemaVersion.V2_0_0 && globalTasks && globalTasks.length > 0 && externalGlobalTasks && externalGlobalTasks.length > 0) { taskConfiguration.ts
2134 const taskContent: string[] = [];
2135 for (const task of externalGlobalTasks) {
2142 );
2143 }
2145 > let result: ITaskParseResult = { custom: [], configured: [] };
2146 > if (fileConfig.tasks) {
2147 result = TaskParser.from(fileConfig.tasks, globals, context, source);
2148 }
2149 > if (globalTasks) { taskConfiguration.ts
2150 result.custom = TaskParser.assignTasks(result.custom, globalTasks);
2151 }
2153 > if ((!result.custom || result.custom.length === 0) && (globals.command && globals.command.name)) {
2154 const matchers: ProblemMatcher[] = ProblemMatcherConverter.from(fileConfig.problemMatcher, context).value ?? [];
2155 const isBackground = fileConfig.isBackground ? !!fileConfig.isBackground : fileConfig.isWatching ? !!fileConfig.isWatching : undefined;
2186 result.custom = [task];
2187 }
2188 > result.custom = result.custom || []; taskConfiguration.ts
2189 > result.configured = result.configured || [];
2190 > return result;
2191 > }
2192 }
2193
2195 const recentUuidMaps: Map<TaskConfigSource, Map<string, UUIDMap>> = new Map();
2196 export function parse(workspaceFolder: IWorkspaceFolder, workspace: IWorkspace | undefined, platform: Platform, configuration: IExternalTaskRunnerConfiguration, logger: IProblemReporter, source: TaskConfigSource, contextKeyService: IContextKeyService, isRecents: boolean = false): IParseResult {
2197 > const recentOrOtherMaps = isRecents ? recentUuidMaps : uuidMaps; taskConfiguration.ts
2198 > let selectedUuidMaps = recentOrOtherMaps.get(source);
2199 > if (!selectedUuidMaps) {
2200 > recentOrOtherMaps.set(source, new Map());
2201 > selectedUuidMaps = recentOrOtherMaps.get(source)!;
2202 > }
2203 > let uuidMap = selectedUuidMaps.get(workspaceFolder.uri.toString());
2204 > if (!uuidMap) {
2205 > uuidMap = new UUIDMap();
2206 > selectedUuidMaps.set(workspaceFolder.uri.toString(), uuidMap);
2207 > }
2208 > try {
2209 > uuidMap.start();
2210 > return (new ConfigurationParser(workspaceFolder, workspace, platform, logger, uuidMap)).run(configuration, source, contextKeyService);
2211 > } finally {
2212 > uuidMap.finish();
2213 > }
2214 > }
2215
2216
src/vs/base/common/parsers.ts 2 introduced LOC · 1 range

Open complete file

34
35 public isFatal(): boolean {
36 > return this._state === ValidationState.Fatal; parsers.ts
37 > }
38 }
39
src/vs/workbench/contrib/tasks/common/tasks.ts 2 introduced LOC · 1 range

Open complete file

760 this.hasDefinedMatchers = hasDefinedMatchers;
761 if (command) {
762 > this.command = command; tasks.ts
763 > }
764 }
765