angular-docs-cn/packages/language-service/ivy/test
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
..
legacy fix(language-service): recognize incomplete pipe bindings with whitespace (#40346) 2021-01-27 10:44:40 -08:00
BUILD.bazel test(language-service): introduce new virtual testing environment (#39594) 2020-11-17 11:59:56 -08:00
adapters_spec.ts fix(language-service): LSParseConfigHost.resolve should not concat abs paths (#40242) 2021-01-06 10:54:40 -08:00
compiler_spec.ts docs: remove duplicated the (#40434) 2021-01-14 11:33:57 -08:00
completions_spec.ts fix(language-service): recognize incomplete pipe bindings with whitespace (#40346) 2021-01-27 10:44:40 -08:00
definitions_spec.ts fix(language-service): fix go to definition for template variables and references (#40455) 2021-01-19 13:03:14 -08:00
diagnostic_spec.ts fix(compiler-cli): report non-template diagnostics (#40331) 2021-01-13 10:55:04 -08:00
env.ts feat(language-service): view template typecheck block (#39974) 2021-01-21 14:05:29 -08:00
gettcb_spec.ts feat(language-service): view template typecheck block (#39974) 2021-01-21 14:05:29 -08:00
mock_host.ts test(language-service): introduce new virtual testing environment (#39594) 2020-11-17 11:59:56 -08:00
quick_info_spec.ts refactor(compiler-cli): Enable pipe information when checkTypeOfPipes=false (#39555) 2020-12-11 16:19:15 -08:00
references_spec.ts refactor(language-service): do not mutate the original template node span (#40484) 2021-01-20 16:59:54 -08:00
test_utils.ts fix(language-service): fix go to definition for template variables and references (#40455) 2021-01-19 13:03:14 -08:00
type_definitions_spec.ts feat(language-service): initial implementation for `findRenameLocations` (#40140) 2021-01-14 16:24:39 -08:00