Add support for extraFileExtensions on WatchCompilerHost (#37726)

To support typescript-eslint/typescript-eslint#1813
This commit is contained in:
Sheetal Nandi
2020-04-01 11:13:21 -07:00
committed by GitHub
parent 0e48e68ed1
commit 0b38a9a2b0
10 changed files with 151 additions and 41 deletions

View File

@@ -566,45 +566,43 @@ namespace ts {
}
function createWatchOfConfigFile(
sys: System,
system: System,
cb: ExecuteCommandLineCallbacks,
reportDiagnostic: DiagnosticReporter,
configParseResult: ParsedCommandLine,
optionsToExtend: CompilerOptions,
watchOptionsToExtend: WatchOptions | undefined,
) {
const watchCompilerHost = createWatchCompilerHostOfConfigFile(
configParseResult.options.configFilePath!,
const watchCompilerHost = createWatchCompilerHostOfConfigFile({
configFileName: configParseResult.options.configFilePath!,
optionsToExtend,
watchOptionsToExtend,
sys,
/*createProgram*/ undefined,
system,
reportDiagnostic,
createWatchStatusReporter(sys, configParseResult.options)
); // TODO: GH#18217
updateWatchCompilationHost(sys, cb, watchCompilerHost);
reportWatchStatus: createWatchStatusReporter(system, configParseResult.options)
});
updateWatchCompilationHost(system, cb, watchCompilerHost);
watchCompilerHost.configFileParsingResult = configParseResult;
return createWatchProgram(watchCompilerHost);
}
function createWatchOfFilesAndCompilerOptions(
sys: System,
system: System,
cb: ExecuteCommandLineCallbacks,
reportDiagnostic: DiagnosticReporter,
rootFiles: string[],
options: CompilerOptions,
watchOptions: WatchOptions | undefined,
) {
const watchCompilerHost = createWatchCompilerHostOfFilesAndCompilerOptions(
const watchCompilerHost = createWatchCompilerHostOfFilesAndCompilerOptions({
rootFiles,
options,
watchOptions,
sys,
/*createProgram*/ undefined,
system,
reportDiagnostic,
createWatchStatusReporter(sys, options)
);
updateWatchCompilationHost(sys, cb, watchCompilerHost);
reportWatchStatus: createWatchStatusReporter(system, options)
});
updateWatchCompilationHost(system, cb, watchCompilerHost);
return createWatchProgram(watchCompilerHost);
}