Skip to content
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

Structural directive autocompletion #40032

Closed
wants to merge 8 commits into from

Commits on Dec 12, 2020

  1. refactor(language-service): add context to template target system

    This commit extends the template targeting system, which determines the node
    being referenced given a template position, to return additional context if
    needed about the particular aspect of the node to which the position refers.
    For example, a position pointing to an element node may be pointing either
    to its tag name or to somewhere in the node body. This is the difference
    between `<div|>` and `<div foo | bar>`.
    alxhub committed Dec 12, 2020
    Configuration menu
    Copy the full SHA
    fea0ea9 View commit details
    Browse the repository at this point in the history
  2. feat(language-service): autocompletion of element tags

    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.
    alxhub committed Dec 12, 2020
    Configuration menu
    Copy the full SHA
    59415c8 View commit details
    Browse the repository at this point in the history
  3. refactor(compiler-cli): make TypeCheckingScopeRegistry a general ut…

    …ility
    
    The `annotations` package in the compiler previously contained a registry
    which tracks NgModule scopes for template type-checking, including unifying
    all type-checking metadata across class inheritance lines.
    
    This commit generalizes this utility and prepares it for use in the
    `TemplateTypeChecker` as well, to back APIs used by the language service.
    alxhub committed Dec 12, 2020
    Configuration menu
    Copy the full SHA
    75a9037 View commit details
    Browse the repository at this point in the history
  4. refactor(compiler-cli): introduce APIs to support directive autocompl…

    …etion
    
    This commit adds two new APIs to the `TemplateTypeChecker`:
    `getPotentialDomBindings` and `getDirectiveMetadata`. Together, these will
    support the Language Service in performing autocompletion of directive
    inputs/outputs.
    alxhub committed Dec 12, 2020
    Configuration menu
    Copy the full SHA
    535d52b View commit details
    Browse the repository at this point in the history
  5. feat(language-service): complete attributes on elements

    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.
    alxhub committed Dec 12, 2020
    Configuration menu
    Copy the full SHA
    8f81140 View commit details
    Browse the repository at this point in the history
  6. feat(language-service): autocomplete pipe binding expressions

    This commit adds autocompletion for pipe expressions, built on existing APIs
    for checking which pipes are in scope.
    alxhub committed Dec 12, 2020
    Configuration menu
    Copy the full SHA
    a8bc91c View commit details
    Browse the repository at this point in the history
  7. refactor(compiler-cli): identify structural directives

    This commit introduces an `isStructural` flag on directive metadata, which
    is `true` if the directive injects `TemplateRef` (and thus is at least
    theoretically usable as a structural directive). The flag is not used for
    anything currently, but will be utilized by the Language Service to offer
    better autocompletion results for structural directives.
    alxhub committed Dec 12, 2020
    Configuration menu
    Copy the full SHA
    468fa4b View commit details
    Browse the repository at this point in the history
  8. feat(language-service): completions for structural directives

    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.
    alxhub committed Dec 12, 2020
    Configuration menu
    Copy the full SHA
    4243377 View commit details
    Browse the repository at this point in the history