angular-cn/packages/language-service/ivy
Alex Rickabaugh 0823622202 fix(compiler-cli): track poisoned scopes with a flag (#39923)
To avoid overwhelming a user with secondary diagnostics that derive from a
"root cause" error, the compiler has the notion of a "poisoned" NgModule.
An NgModule becomes poisoned when its declaration contains semantic errors:
declarations which are not components or pipes, imports which are not other
NgModules, etc. An NgModule also becomes poisoned if it imports or exports
another poisoned NgModule.

Previously, the compiler tracked this poisoned status as an alternate state
for each scope. Either a correct scope could be produced, or the entire
scope would be set to a sentinel error value. This meant that the compiler
would not track any information about a scope that was determined to be in
error.

This method presents several issues:

1. The compiler is unable to support the language service and return results
when a component or its module scope is poisoned.

This is fine for compilation, since diagnostics will be produced showing the
error(s), but the language service needs to still work for incorrect code.

2. `getComponentScopes()` does not return components with a poisoned scope,
which interferes with resource tracking of incremental builds.

If the component isn't included in that list, then the NgModule for it will
not have its dependencies properly tracked, and this can cause future
incremental build steps to produce incorrect results.

This commit changes the tracking of poisoned module scopes to use a flag on
the scope itself, rather than a sentinel value that replaces the scope. This
means that the scope itself will still be tracked, even if it contains
semantic errors. A test is added to the language service which verifies that
poisoned scopes can still be used in template type-checking.

PR Close #39923
2020-12-03 13:42:13 -08:00
..
test fix(compiler-cli): track poisoned scopes with a flag (#39923) 2020-12-03 13:42:13 -08:00
BUILD.bazel refactor(compiler-cli): provide a host to readConfiguration (#39619) 2020-11-17 14:45:09 -08:00
adapters.ts refactor(language-service): language_service_adapter -> adapters (#39619) 2020-11-17 14:45:09 -08:00
compiler_factory.ts fix(compiler-cli): track poisoned scopes with a flag (#39923) 2020-12-03 13:42:13 -08:00
definitions.ts refactor(compiler-cli): Add additional shim locations to reference and variable symbols (#39715) 2020-11-19 12:15:21 -08:00
display_parts.ts refactor(compiler-cli): Add additional shim locations to reference and variable symbols (#39715) 2020-11-19 12:15:21 -08:00
language_service.ts feat(language-service): Add "find references" capability to Ivy integrated LS (#39768) 2020-12-02 12:54:21 -08:00
quick_info.ts refactor(compiler-cli): Add additional shim locations to reference and variable symbols (#39715) 2020-11-19 12:15:21 -08:00
references.ts refactor(compiler-cli): expose TTC method to determine if file is tracked shim (#39768) 2020-12-02 12:54:22 -08:00
template_target.ts feat(language-service): Add "find references" capability to Ivy integrated LS (#39768) 2020-12-02 12:54:21 -08:00
ts_plugin.ts feat(language-service): Add "find references" capability to Ivy integrated LS (#39768) 2020-12-02 12:54:21 -08:00
ts_utils.ts refactor(language-service): Use compiler APIs in Ivy to get definitions for external resources (#39476) 2020-11-06 09:17:33 -08:00
utils.ts feat(language-service): Add "find references" capability to Ivy integrated LS (#39768) 2020-12-02 12:54:21 -08:00