mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 20:33:45 -05:00
Fixes issues with reload because of output emit (#39030)
* If there is no changes to folder structure when watching directories recursively, send the updates to fileNames only Fixes #37994 * Ignore excluded directories from wild card watching * Testcase showing that renaming file with non sync directory watcher displays correct error in the end Testcase for #38684
This commit is contained in:
@@ -2943,7 +2943,13 @@ namespace ts {
|
||||
* @param extraFileExtensions optionaly file extra file extension information from host
|
||||
*/
|
||||
/* @internal */
|
||||
export function getFileNamesFromConfigSpecs(spec: ConfigFileSpecs, basePath: string, options: CompilerOptions, host: ParseConfigHost, extraFileExtensions: readonly FileExtensionInfo[] = []): ExpandResult {
|
||||
export function getFileNamesFromConfigSpecs(
|
||||
spec: ConfigFileSpecs,
|
||||
basePath: string,
|
||||
options: CompilerOptions,
|
||||
host: ParseConfigHost,
|
||||
extraFileExtensions: readonly FileExtensionInfo[] = emptyArray
|
||||
): ExpandResult {
|
||||
basePath = normalizePath(basePath);
|
||||
|
||||
const keyMapper = createGetCanonicalFileName(host.useCaseSensitiveFileNames);
|
||||
@@ -3030,6 +3036,33 @@ namespace ts {
|
||||
};
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function isExcludedFile(
|
||||
pathToCheck: string,
|
||||
spec: ConfigFileSpecs,
|
||||
basePath: string,
|
||||
useCaseSensitiveFileNames: boolean,
|
||||
currentDirectory: string
|
||||
): boolean {
|
||||
const { filesSpecs, validatedIncludeSpecs, validatedExcludeSpecs } = spec;
|
||||
if (!length(validatedIncludeSpecs) || !length(validatedExcludeSpecs)) return false;
|
||||
|
||||
basePath = normalizePath(basePath);
|
||||
|
||||
const keyMapper = createGetCanonicalFileName(useCaseSensitiveFileNames);
|
||||
if (filesSpecs) {
|
||||
for (const fileName of filesSpecs) {
|
||||
if (keyMapper(getNormalizedAbsolutePath(fileName, basePath)) === pathToCheck) return false;
|
||||
}
|
||||
}
|
||||
|
||||
const excludePattern = getRegularExpressionForWildcard(validatedExcludeSpecs, combinePaths(normalizePath(currentDirectory), basePath), "exclude");
|
||||
const excludeRegex = excludePattern && getRegexFromPattern(excludePattern, useCaseSensitiveFileNames);
|
||||
if (!excludeRegex) return false;
|
||||
if (excludeRegex.test(pathToCheck)) return true;
|
||||
return !hasExtension(pathToCheck) && excludeRegex.test(ensureTrailingDirectorySeparator(pathToCheck));
|
||||
}
|
||||
|
||||
function validateSpecs(specs: readonly string[], errors: Push<Diagnostic>, allowTrailingRecursion: boolean, jsonSourceFile: TsConfigSourceFile | undefined, specKey: string): readonly string[] {
|
||||
return specs.filter(spec => {
|
||||
const diag = specToDiagnostic(spec, allowTrailingRecursion);
|
||||
|
||||
Reference in New Issue
Block a user