angular-docs-cn/packages/language-service/ivy
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
..
test fix(language-service): Do not include $event parameter in reference results (#40158) 2021-01-05 10:07:20 -08:00
BUILD.bazel fix(language-service): include compilerOptions.rootDir in rootDirs (#40243) 2021-01-06 10:54:11 -08:00
adapters.ts fix(language-service): include compilerOptions.rootDir in rootDirs (#40243) 2021-01-06 10:54:11 -08:00
attribute_completions.ts feat(language-service): completions for structural directives (#40032) 2020-12-14 12:08:41 -08:00
compiler_factory.ts fix(compiler-cli): track poisoned scopes with a flag (#39923) 2020-12-03 13:42:13 -08:00
completions.ts feat(language-service): completions for structural directives (#40032) 2020-12-14 12:08:41 -08:00
definitions.ts refactor(language-service): add context to template target system (#40032) 2020-12-14 12:08:40 -08:00
display_parts.ts feat(language-service): complete attributes on elements (#40032) 2020-12-14 12:08:41 -08:00
language_service.ts feat(language-service): complete attributes on elements (#40032) 2020-12-14 12:08:41 -08:00
quick_info.ts refactor(compiler-cli): Enable pipe information when checkTypeOfPipes=false (#39555) 2020-12-11 16:19:15 -08:00
references.ts fix(language-service): Do not include $event parameter in reference results (#40158) 2021-01-05 10:07:20 -08:00
template_target.ts fix(language-service): shorthand syntax with variables (#40239) 2020-12-22 14:50:22 -08:00
ts_plugin.ts feat(language-service): implement autocompletion for global properties (Ivy) (#39250) 2020-12-04 10:19:45 -08:00
ts_utils.ts fix(language-service): Do not include $event parameter in reference results (#40158) 2021-01-05 10:07:20 -08:00
utils.ts fix(language-service): shorthand syntax with variables (#40239) 2020-12-22 14:50:22 -08:00