Commit Graph

11 Commits

Author SHA1 Message Date
ivanwonder 8110cf0ed2 fix(language-service): can't provide the Input and Output custom binding property name (#41005)
Now the language service always uses the name of the JavaScript property on the
component or directive instance for this input or output. This PR will use the right
binding property name.

PR Close #41005
2021-03-01 15:26:42 -08:00
Andrew Scott bc5c9ee234 refactor(language-service): Migrate completions_spec to new testing API (#40966)
refactor(language-service): Migrate completions_spec to new testing API

PR Close #40966
2021-02-24 08:54:34 -08:00
Alex Rickabaugh e3bd23c915 perf(language-service): update NgCompiler via resource-only path when able (#40585)
This commit changes the Language Service's "compiler factory" mechanism to
leverage the new resource-only update path for `NgCompiler`. When an
incoming change only affects a resource file like a component template or
stylesheet, going through the new API allows the Language Service to avoid
unnecessary incremental steps of the `NgCompiler` and return answers more
efficiently.

PR Close #40585
2021-02-02 16:24:56 -08:00
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
Andrew Scott 7d74853a1d fix(language-service): Support completions of two-way bindings (#40185)
This commit adds special handling to the completion builder by detecting
a two way binding context and ensuring that we filter out any `Input`s
that do not support two way binding.

PR Close #40185
2021-01-07 13:18:38 -08:00
Alex Rickabaugh 2a7443117b feat(language-service): completions for structural directives (#40032)
This comit adds support for autocompletion of attributes that create
structural directives. Such completions differ from those of normal
attributes, as the structural directive syntax creates a synthetic
<ng-template> node which has different attributes from the main element.

PR Close #40032
2020-12-14 12:08:41 -08:00
Alex Rickabaugh cbb6eae4a9 feat(language-service): autocomplete pipe binding expressions (#40032)
This commit adds autocompletion for pipe expressions, built on existing APIs
for checking which pipes are in scope.

PR Close #40032
2020-12-14 12:08:41 -08:00
Alex Rickabaugh 66378ed0ef feat(language-service): complete attributes on elements (#40032)
This commit adds attribute completion to the Language Service. It completes
from 3 sources:

1. inputs/outputs of directives currently present on the element
2. inputs/outputs/attributes of directives in scope for the element, that
   would become present if the input/output/attribute was added
3. DOM properties and attributes

We distinguish between completion of a property binding (`[foo|]`) and a
completion in an attribute context (`foo|`). For the latter, bindings to
the attribute are offered, as well as a property binding which adds the
square bracket notation.

To determine hypothetical matches (directives which would become present if
a binding is added), directives in scope are scanned and matched against a
hypothetical version of the element which has the attribute.

PR Close #40032
2020-12-14 12:08:41 -08:00
Alex Rickabaugh e42250f139 feat(language-service): autocompletion of element tags (#40032)
This commit expands the autocompletion capabilities of the language service
to include element tag names. It presents both DOM elements from the Angular
DOM schema as well as any components (or directives with element selectors)
that are in scope within the template as options for completion.

PR Close #40032
2020-12-14 12:08:40 -08:00
Alex Rickabaugh 93a83266f9 feat(language-service): autocompletion within expression contexts (#39727)
This commit adds support to the Language Service for autocompletion within
expression contexts. Specifically, this is auto completion of property reads
and method calls, both in normal and safe-navigational forms.

PR Close #39727
2020-12-10 11:09:53 -08:00
Alex Rickabaugh 28a0bcb424 feat(language-service): implement autocompletion for global properties (Ivy) (#39250)
This commit adds support in the Ivy Language Service for autocompletion in a
global context - e.g. a {{foo|}} completion.

Support is added both for the primary function `getCompletionsAtPosition` as
well as the detail functions `getCompletionEntryDetails` and
`getCompletionEntrySymbol`. These latter operations are not used yet as an
upstream change to the extension is required to advertise and support this
capability.

PR Close #39250
2020-12-04 10:19:45 -08:00