angular-cn/packages/compiler-cli/src
Keen Yee Liau a62416c6e4 fix(language-service): include compilerOptions.rootDir in rootDirs (#40243)
When resolving references, the Ivy compiler has a few strategies it could use.

For relative path, one of strategies is [`RelativePathStrategy`](
https://github.com/angular/angular/blob/master/packages/compiler-cli/src/
ngtsc/imports/README.md#relativepathstrategy). This strategy
relies on `compilerOptions.rootDir` and `compilerOptions.rootDirs` to perform
the resolution, but language service only passes `rootDirs` to the compiler,
and not `rootDir`.

In reality, `rootDir` is very different from `rootDirs` even though they
sound the same.
According to the official [TS documentation][1],
> `rootDir` specifies the root directory of input files. Only use to control
> the output directory structure with --outDir.

> `rootDirs` is a list of root folders whose combined content represent the
> structure of the project at runtime. See [Module Resolution documentation](
> https://www.typescriptlang.org/docs/handbook/
> module-resolution.html#virtual-directories-with-rootdirs)
> for more details.

For now, we keep the behavior between compiler and language service consistent,
but we will revisit the notion of `rootDir` and how it is used later.

Fix angular/vscode-ng-language-service#1039

[1]: https://www.typescriptlang.org/docs/handbook/compiler-options.html

PR Close #40243
2021-01-06 10:54:11 -08:00
..
diagnostics build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
metadata refactor(compiler-cli): remove TypeScript 3.9 workarounds (#39586) 2020-11-06 15:26:51 -08:00
ngtsc fix(language-service): include compilerOptions.rootDir in rootDirs (#40243) 2021-01-06 10:54:11 -08:00
transformers feat(compiler): support tagged template literals in code generator (#39122) 2020-12-07 16:20:04 -08:00
extract_i18n.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
language_services.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
main.ts style(compiler-cli): remove unused constant (#38441) 2020-08-13 13:32:41 -07:00
perform_compile.ts refactor(language-service): language_service_adapter -> adapters (#39619) 2020-11-17 14:45:09 -08:00
perform_watch.ts build: support building with TypeScript 4.1 (#39571) 2020-11-25 11:10:01 -08:00
tooling.ts refactor(compiler-cli): skip class decorators in tooling constructor parameters transform (#37545) 2020-06-15 12:47:57 -07:00
typescript_support.ts feat(compiler-cli): add support for using TypeScript 4.1 (#39571) 2020-11-25 11:10:00 -08:00
version.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00