Skip to content

fix: unchanged files sometimes have no Angular information for string… #1453

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

Merged
merged 2 commits into from
Jul 28, 2021

Conversation

atscott
Copy link
Collaborator

@atscott atscott commented Jul 16, 2021

…s when first opened

The TextStorage in TS server calls useScriptVersionCacheIfValidOrOpen in many places
when dealing with a ScriptInfo. One of the conditions in that function
is to switch to version if the script is open. This change in version
results in an identity change for the SourceFile which is problematic
for the compiler because we store references to string literals for
inline templates, template URLs, and style URLs. These references will
not be valid if the SourceFile changed identity.

To ensure that the compiler is aware of the change, we mark the project
as dirty when a text document is opened. This will cause the project to
call updateGraph, determine that the file changed versions, and create
a new program. This is done so that the Angular compiler can reprocess
the file.

This also appears to be one of, if not the only issue, that's currently
causing the e2e tests to be flaky.

@google-cla google-cla bot added the cla: yes label Jul 16, 2021
@atscott atscott marked this pull request as draft July 16, 2021 20:21
@atscott atscott added the target: patch This PR is targeted for the next patch release label Jul 19, 2021
@atscott atscott marked this pull request as ready for review July 20, 2021 20:32
atscott added 2 commits July 28, 2021 15:48
…s when first opened

The `TextStorage` in TS server calls `useScriptVersionCacheIfValidOrOpen` in many places
when dealing with a `ScriptInfo`. One of the conditions in that function
is to switch to version _if the script is open_. This change in version
results in an identity change for the `SourceFile` which is problematic
for the compiler because we store references to string literals for
inline templates, template URLs, and style URLs. These references will
not be valid if the `SourceFile` changed identity.

To ensure that the compiler is aware of the change, we mark the project
as dirty when a text document is opened. This will cause the project to
call `updateGraph`, determine that the file changed versions, and create
a new program. This is done so that the Angular compiler can reprocess
the file.

This also appears to be one of, if not the only issue, that's currently
causing the e2e tests to be flaky.
* Fix test output so that it logs to console.
* Disable hover tests because they are flaky.
@atscott atscott added the action: merge Ready to merge label Jul 28, 2021
@atscott atscott merged commit a751e61 into angular:master Jul 28, 2021
atscott added a commit that referenced this pull request Jul 28, 2021
#1453)

* fix: unchanged files sometimes have no Angular information for strings when first opened

The `TextStorage` in TS server calls `useScriptVersionCacheIfValidOrOpen` in many places
when dealing with a `ScriptInfo`. One of the conditions in that function
is to switch to version _if the script is open_. This change in version
results in an identity change for the `SourceFile` which is problematic
for the compiler because we store references to string literals for
inline templates, template URLs, and style URLs. These references will
not be valid if the `SourceFile` changed identity.

To ensure that the compiler is aware of the change, we mark the project
as dirty when a text document is opened. This will cause the project to
call `updateGraph`, determine that the file changed versions, and create
a new program. This is done so that the Angular compiler can reprocess
the file.

This also appears to be one of, if not the only issue, that's currently
causing the e2e tests to be flaky.

* test: Stabalize e2e tests

* Fix test output so that it logs to console.
* Disable hover tests because they are flaky.

(cherry picked from commit a751e61)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Aug 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge Ready to merge cla: yes target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants