fix(language-service): include compilerOptions.rootDir in rootDirs #40243
Conversation
750eff0
to
5b6f2da
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
josephperrott
approved these changes
Dec 23, 2020
LGTM
atscott
approved these changes
Jan 5, 2021
|
Would be really nice to include this PR in the next patch release of NG11 as currently the language service is mostly broken for my multiproject setup. I'm a bit scared to continue like that for one more week :) |
AndrewKushnir
approved these changes
Jan 6, 2021
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
When resolving references, the Ivy compiler has a few strategies it could use.
For relative path, one of strategies is
RelativePathStrategy. This strategyrelies on
compilerOptions.rootDirandcompilerOptions.rootDirsto performthe resolution, but language service only passes
rootDirsto the compiler,and not
rootDir.In reality,
rootDiris very different fromrootDirseven though theysound the same.
According to the official TS documentation,
For now, we keep the behavior between compiler and language service consistent,
but we will revisit the notion of
rootDirand how it is used later.Fix angular/vscode-ng-language-service#1039
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
The text was updated successfully, but these errors were encountered: