3

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:

  • I get this: import { RefreshService } from 'src/app/services/refresh.service';
  • I want this: import { RefreshService } from "../../services/refresh.service";

Thanks!

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

Comments

2

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

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.