From da78fabdb8e206dc0c07ba94add14fa10767a601 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 28 Nov 2018 15:03:41 -0800 Subject: [PATCH] --showConfig files list condition was inverted from what it needed to be (#28693) (#28717) * --showConfig files list condition was inverted from what it needed to be * Make no assumptions about file list normalization * accept updated, correct, baseline --- src/compiler/commandLineParser.ts | 14 +++++++------- .../Show TSConfig with files options/tsconfig.json | 7 ++++++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index e80c1c639b7..8ca93fdab80 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -1673,13 +1673,13 @@ namespace ts { const files = map( filter( configParseResult.fileNames, - !configParseResult.configFileSpecs ? _ => false : matchesSpecs( + (!configParseResult.configFileSpecs || !configParseResult.configFileSpecs.validatedIncludeSpecs) ? _ => true : matchesSpecs( configFileName, configParseResult.configFileSpecs.validatedIncludeSpecs, configParseResult.configFileSpecs.validatedExcludeSpecs ) ), - f => getRelativePathFromFile(getNormalizedAbsolutePath(configFileName, host.getCurrentDirectory()), f, getCanonicalFileName) + f => getRelativePathFromFile(getNormalizedAbsolutePath(configFileName, host.getCurrentDirectory()), getNormalizedAbsolutePath(f, host.getCurrentDirectory()), getCanonicalFileName) ); const optionMap = serializeCompilerOptions(configParseResult.options, { configFilePath: getNormalizedAbsolutePath(configFileName, host.getCurrentDirectory()), useCaseSensitiveFileNames: host.useCaseSensitiveFileNames }); const config = { @@ -1713,20 +1713,20 @@ namespace ts { } function matchesSpecs(path: string, includeSpecs: ReadonlyArray | undefined, excludeSpecs: ReadonlyArray | undefined): (path: string) => boolean { - if (!includeSpecs) return _ => false; + if (!includeSpecs) return _ => true; const patterns = getFileMatcherPatterns(path, excludeSpecs, includeSpecs, sys.useCaseSensitiveFileNames, sys.getCurrentDirectory()); const excludeRe = patterns.excludePattern && getRegexFromPattern(patterns.excludePattern, sys.useCaseSensitiveFileNames); const includeRe = patterns.includeFilePattern && getRegexFromPattern(patterns.includeFilePattern, sys.useCaseSensitiveFileNames); if (includeRe) { if (excludeRe) { - return path => includeRe.test(path) && !excludeRe.test(path); + return path => !(includeRe.test(path) && !excludeRe.test(path)); } - return path => includeRe.test(path); + return path => !includeRe.test(path); } if (excludeRe) { - return path => !excludeRe.test(path); + return path => excludeRe.test(path); } - return _ => false; + return _ => true; } function getCustomTypeMapOfCommandLineOption(optionDefinition: CommandLineOption): Map | undefined { diff --git a/tests/baselines/reference/showConfig/Show TSConfig with files options/tsconfig.json b/tests/baselines/reference/showConfig/Show TSConfig with files options/tsconfig.json index cd727e8ccdc..2b2c1385bab 100644 --- a/tests/baselines/reference/showConfig/Show TSConfig with files options/tsconfig.json +++ b/tests/baselines/reference/showConfig/Show TSConfig with files options/tsconfig.json @@ -1,3 +1,8 @@ { - "compilerOptions": {} + "compilerOptions": {}, + "files": [ + "./file0.st", + "./file1.ts", + "./file2.ts" + ] }