Tanvirgeek
Tanvirgeek

Reputation: 712

VSCode auto import, components suggestion not working in React, VSCode version 1.57.0, MacOS

I am switching to React from SwiftUI, where I am expecting auto import of components which should be default in VSCode, According to my research. Unfortunately when I type the components, VSCode is not suggesting me the components. I have to manually type the component name also manually import the components, which is very slow and require too much effort.

How can I get auto completion of components and auto import in VSCode 1.57.0?

Upvotes: 5

Views: 16800

Answers (2)

Code on the Rocks
Code on the Rocks

Reputation: 17804

There are a few things that need to be set up for this to work properly. You can see the official setup instructions for MUI Typescript here.

  1. npm install @mui/material
  2. tsconfig.json
{
  "compilerOptions": {
    "lib": ["es6", "dom"],
    "noImplicitAny": true,
    "noImplicitThis": true,
    "strictNullChecks": true
  }
}
  1. (If necessary) Restart VS code

At this point, you should be able to see Material components suggested when you hit cmd+space: enter image description here

Upvotes: 1

Ryuichi
Ryuichi

Reputation: 111

I had exactly the same issue with version 1.57.

Adding "security.workspace.trust.enabled": false to settings.json resolved the issue for me.

Upvotes: 11

Related Questions