Skip to content

@angular/material no import suggestions #29009

Closed
@christopher-kiss

Description

@christopher-kiss

Expected behavior:
When typing in angular material imports, I should receive auto import suggestions and a light bulb.

Actual behavior:
Not receiving any import suggestions or light bulb.

Steps to reproduce:
Start a new angular project
ng new mat-test --style=scss --routing

Add angular material
ng add @angular/material

Y to hammerjs
Y to animations

Open app.module.ts

In the imports array, start typing MatButtonModule, notice there is no suggestions.

image

If I add the import correctly import { MatButtonModule } from '@angular/material/button'; which in the similiar issue below suggested would fix this, it actually does not.

I start typing MatSidenavModule in the imports array and it again fails to pick up this import.

image

Related Issues:
#28773

There are two comments of interest in this issue, one mentions adding an import from the module will resolve this as ts will then start searching there. This does no work, as demonstrated above by adding a module from button, the other modules do not work.

The other comment mentions that this works correctly in TS 3.2.1. I fail to see how this works correctly, or maybe the solution to this has not been explained?

I've tested this in Typescript 3.3.0-dev, 3.2.2 and 3.1.6, same behaviour in all 3.
Using VS Code 1.30.0

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 7.1.3
Node: 10.14.1
OS: win32 x64
Angular: 7.1.3
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.11.3
@angular-devkit/build-angular     0.11.3
@angular-devkit/build-optimizer   0.11.3
@angular-devkit/build-webpack     0.11.3
@angular-devkit/core              7.1.3
@angular-devkit/schematics        7.1.3
@angular/cdk                      7.1.1
@angular/material                 7.1.1
@ngtools/webpack                  7.1.3
@schematics/angular               7.1.3
@schematics/update                0.11.3
rxjs                              6.3.3
typescript                        3.1.6
webpack                           4.23.1

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