When using VSCode with Angular, I write my import statement list this:
import { AppComponent } from './app.component';
The VSCode Quick Fix adds them like this:
import { WelcomeComponent } from "app/home/welcome.component";
Is there a way to change the VS Code Quick Fix with a VS Code setting to use single instead of double quotes?
If your project has a .editorconfig
file, try adding the following line:
[*]
...
quote_type = single
I've found that the .editorconfig
file seems to override any settings for vscode, prettier, tslint, etc. and it seems to default to something other than single quotes.
Deleting the file can work as well if you don't need it.
More info on editorconfig.
You can use the Prettier Extension with the following settings (global/workspace).
"prettier.singleQuote": true
This works nice and simply...
Open settings in VSCode, e.g. Command + ',' and then filter for "typescript":
Look for "quote style" and change:
Check your tslint.json
for the quotemark
part.
If it's setted to use doublequote
by
"quotemark": [
true,
"double" < ------mention here
]
then there will be warning at your typescript
file while using singlequote
. And this will lead VS Code's quick-fix(show fix option for me) to change singlequote
to doublequote
.
So the solution should be change double
to single
.
"quotemark": [
true,
"single" < ------change here
]
Press Ctrl + , for settings.
Then search for prettier. Find the setting Prettier: Single Quote
Set that to true.
You can set that in user settings or work space setting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With