-
Notifications
You must be signed in to change notification settings - Fork 26.3k
refactor(language-service): resolve module specifier for a directive … #62100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
refactor(language-service): resolve module specifier for a directive … #62100
Conversation
importOn.getSourceFile(), | ||
potentialImport.symbolName, | ||
declarationName, | ||
directiveModuleSpecifier?.moduleSpecifier ?? potentialImport.moduleSpecifier, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's my mistake; the potentialImport
can include multiple different module specifiers that export the directive and cannot be overridden directly. The code moves to the PotentialDirectiveModuleSpecifierResolverImpl
.
bf83885
to
36a8919
Compare
…exported by multiple different files When providing the code action for the directive that is exported by multiple modules in different files, the directive must save all the TS completion entry data for every module to compute the module specifier. When providing a completion item, because the LS only supports displaying one directive at a time, the first one will be picked.
36a8919
to
8e754a9
Compare
/** | ||
* Try to compute the module specifier after applying the paths from tsconfig or package.json export rules. | ||
* | ||
* Try to reuse the module specifier if the import in the `importOn` can export the `toImport` node. | ||
* | ||
* If a module specifier cannot be resolved, return undefined, and the Angular compiler will apply its own rules. | ||
* | ||
* There is one exception here. For example |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just comment out the main change in comparison to the previous version here. Even if an exception occurs, it will revert to the Angular compiler and keep the same behavior as before.
…exported by multiple different files
When providing the code action for the directive that is exported by multiple modules in different files, the directive must save all the TS completion entry data for every module to compute the module specifier.
When providing a completion item, because the LS only supports displaying one directive at a time, the first one will be picked.
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