-
Notifications
You must be signed in to change notification settings - Fork 25.5k
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
fix(language-service): [Ivy] create compiler only when program changes #39231
Conversation
84fe55a
to
d76750d
Compare
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.
Much nicer API 🎉
}); | ||
|
||
function getLastKnownProgram(ngLS: LanguageService): ts.Program { | ||
const program = ngLS['compilerFactory']['lastKnownProgram']; |
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.
If it's needed for testing, maybe we should mark compilerFactory
with /** @internal */
instead of accessing the private property?
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.
I think marking it as @internal
only affects the .d.ts
emit, and it's actually discouraged (they removed it from TS documentation). Is this commonly used in other Angular packages?
d76750d
to
7c4f799
Compare
This commit fixes a bug in which a new Ivy Compiler is created every time language service receives a new request. This is not needed if the `ts.Program` has not changed. A new class `CompilerFactory` is created to manage Compiler lifecycle and keep track of template changes so that it knows when to override them. With this change, we no longer need the method `getModifiedResourceFile()` on the adapter. Instead, we call `overrideComponentTemplate` on the template type checker. This commit also changes the incremental build strategy from `PatchedIncrementalBuildStrategy` to `TrackedIncrementalBuildStrategy`.
7c4f799
to
3c56cdd
Compare
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. |
This commit fixes a bug in which a new Ivy Compiler is created every time
language service receives a new request. This is not needed if the
ts.Program
has not changed.A new class
CompilerFactory
is created to manage Compiler lifecycle andkeep track of template changes so that it knows when to override them.
With this change, we no longer need the method
getModifiedResourceFile()
on the adapter. Instead, we call
overrideComponentTemplate
on thetemplate type checker.
This commit also changes the incremental build strategy from
PatchedIncrementalBuildStrategy
toTrackedIncrementalBuildStrategy
.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