angular-docs-cn/packages/language-service/ivy/test/legacy
Alex Rickabaugh a8c5c8ed2d fix(language-service): recognize incomplete pipe bindings with whitespace (#40346)
The Language Service uses the source span of AST nodes to recognize which
node a user has selected, given their cursor position in a template. This is
used to trigger autocompletion.

The previous source span of BindingPipe nodes created a problem when:

1) the pipe binding had no identifier (incomplete or in-progress expression)
2) the user typed trailing whitespace after the pipe character ('|')

For example, the expression `{{foo | }}`. If the cursor preceded the '}' in
that expression, the Language Service was unable to detect that the user was
autocompleting the BindingPipe expression, since the span of the BindingPipe
ended after the '|'.

This commit changes the expression parser to expand the span of BindingPipe
expressions with a missing identifier, to include any trailing whitespace.
This allows the Language Service to correctly recognize this case as
targeting the BindingPipe and complete it successfully. The `nameSpan` of
the BindingPipe is also moved to be right-aligned with the end of any
whitespace present in the pipe binding expression.

This change allows for the disabled test in the Language Service for pipe
completion in this case to be re-enabled.

PR Close #40346
2021-01-27 10:44:40 -08:00
..
BUILD.bazel feat(language-service): Add diagnostics to suggest turning on strict mode (#40423) 2021-01-25 14:17:31 -08:00
adapters_spec.ts test(language-service): add renamed, deleted test file (#39742) 2020-11-18 11:11:14 -08:00
compiler_factory_spec.ts test(language-service): move existing tests to legacy directory (#39594) 2020-11-17 11:59:56 -08:00
daignostic_spec.ts test(language-service): convert ivy diagnostics tests from legacy (#39957) 2020-12-04 10:16:43 -08:00
definitions_spec.ts fix(language-service): Support 'go to definition' for two-way bindings (#40185) 2021-01-07 13:18:38 -08:00
language_service_spec.ts feat(language-service): Add diagnostics to suggest turning on strict mode (#40423) 2021-01-25 14:17:31 -08:00
mock_host.ts feat(language-service): Add diagnostics to suggest turning on strict mode (#40423) 2021-01-25 14:17:31 -08:00
mock_host_spec.ts test(language-service): move existing tests to legacy directory (#39594) 2020-11-17 11:59:56 -08:00
template_target_spec.ts fix(language-service): recognize incomplete pipe bindings with whitespace (#40346) 2021-01-27 10:44:40 -08:00
test_utils.ts test(language-service): move existing tests to legacy directory (#39594) 2020-11-17 11:59:56 -08:00
ts_plugin_spec.ts fix(language-service): return all typecheck files via getExternalFiles (#40162) 2021-01-06 11:34:15 -08:00
type_definitions_spec.ts refactor(compiler-cli): Return addEventListener symbol for native output bindings (#39312) 2020-12-08 16:18:24 -08:00