Skip to content

Angular auto-imports disappear depending on the trigger character #962

@SafariKnight

Description

@SafariKnight

When working in an Angular project, auto-import suggestions from @angular/core (like for @Component) are not consistently provided. The suggestions appear to depend on the character that triggers the completion menu.

For example, when writing @Component, if completion is triggered by typing @ then the auto-import suggestion is missing, if it's triggered by writing C, it's present

Normally most completion engines solve this by sending a completions request on @ then doing it again on C (blink.cmp on neovim doesn't, which is how I found this)

To reproduce

  1. Trigger on @ (No auto-imports)
  • Type @ on a new line
  • Completion window opens
  • No auto-import suggestions for @Component from @angular/core or anything under @angular (assuming the completion engine doesn't send a completion items request again)
  1. Trigger on 'C' (Auto-imports are present)
  • Type @ on a new line
  • Close the completion window
  • Type C after the @ to open the completion window and send a request for the completion items again
  • Auto-import suggests for @Component are present and anything under @angular is also present

typescript-language-server 4.3.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions