Cache resolved project references and watch wild card directories from them to update them (#42929)

* Test for not watchiong referenced projects fileNames and invalidating it

* Add watching wild card directories and caching parsed command line for projects so that its shared

* Handle config file watching and commandline cache together

* Watch extended files for commndline cache instead of project

* Use extended config cache now that we are watching extended config files

* Structure for getParsedCommandLine from the LS

* Adding some more skeleton with todos

* getParsedCommandLine on WatchCompilerHost

* Tests for Watch, LS scenarios

* Handle getParsedCommandLine so we are looking at all things for referenced

* Cleanup and commenting

* Test for transitive references with tsc-watch

* Cache parsed command line even if host implements getParsedCommandLine

* Cleanup

* Cleanup

* Some tests to verify exclude from referenced project doesnt trigger the update

* Baseline when program is same

* Test for incremental scenario

* Tests for output from referenced project

* Comments
This commit is contained in:
Sheetal Nandi
2021-03-26 13:23:03 -07:00
committed by GitHub
parent a26acf4540
commit a545ab1ac2
39 changed files with 4649 additions and 586 deletions

View File

@@ -286,7 +286,8 @@ namespace ts {
fileName => getNormalizedAbsolutePath(fileName, currentDirectory)
);
if (configFileName) {
const configParseResult = parseConfigFileWithSystem(configFileName, commandLineOptions, commandLine.watchOptions, sys, reportDiagnostic)!; // TODO: GH#18217
const extendedConfigCache = new Map<string, ExtendedConfigCacheEntry>();
const configParseResult = parseConfigFileWithSystem(configFileName, commandLineOptions, extendedConfigCache, commandLine.watchOptions, sys, reportDiagnostic)!; // TODO: GH#18217
if (commandLineOptions.showConfig) {
if (configParseResult.errors.length !== 0) {
reportDiagnostic = updateReportDiagnostic(
@@ -315,6 +316,7 @@ namespace ts {
configParseResult,
commandLineOptions,
commandLine.watchOptions,
extendedConfigCache,
);
}
else if (isIncrementalCompilation(configParseResult.options)) {
@@ -618,6 +620,7 @@ namespace ts {
configParseResult: ParsedCommandLine,
optionsToExtend: CompilerOptions,
watchOptionsToExtend: WatchOptions | undefined,
extendedConfigCache: Map<ExtendedConfigCacheEntry>,
) {
const watchCompilerHost = createWatchCompilerHostOfConfigFile({
configFileName: configParseResult.options.configFilePath!,
@@ -629,6 +632,7 @@ namespace ts {
});
updateWatchCompilationHost(system, cb, watchCompilerHost);
watchCompilerHost.configFileParsingResult = configParseResult;
watchCompilerHost.extendedConfigCache = extendedConfigCache;
return createWatchProgram(watchCompilerHost);
}