kol
kol

Reputation: 28678

Automatic TypeScript `import` formatting in Visual Studio Code

I'm working on an Angular 9 project in Visual Studio Code. When I type the name of an existing TypeScript class, I press Ctrl + . to import it automatically. How can I configure the auto-import functionality to use double quotes and relative paths instead of single quotes and absolute paths?

Example:

Thanks!

Upvotes: 3

Views: 3519

Answers (2)

kol
kol

Reputation: 28678

The following two lines had to be added to .vscode/settings.json:

"typescript.preferences.importModuleSpecifier": "relative",
"typescript.preferences.quoteStyle": "double"

Upvotes: 2

PrakashT
PrakashT

Reputation: 901

OPen visual studio and open File -> preferences->settings and search auto import see image select extension TypeScript and change drop down option(Quote style) auto to double.

Upvotes: 3

Related Questions