问题
I'm using TypeScript style with single quotes, double quotes are used exclusively in HTML templates.
WebStorm/PhpStorm auto import adds import statements with double quotes and ruins the style. I guess this applies to all JetBrains products.
How can this behaviour be fixed?
回答1:
This behaviour is controlled by the following option:
Settings/PreferencesEditor | Code Style | TypeScript"Punctuation" tab | Generated code -> Quote marks
As of 2017.1 version it's on new Punctuation tab and options are named a bit differently:
回答2:
Also if you would like to add automatic space between curly braces when adding imports like so
import { MyComponent } from './my.component';
you may check in tab Spaces | Whithin | ES6 import/export braces
回答3:
In 2017-2019 this is how we do it:
- Go to settings
- Type
Code stylein search - Select
Typescript - Go to
Punctuationsection - Select
singlequotes
回答4:
Punctuation Tab did it. I also removed the semicolon at the end but now TSLint is missing it
回答5:
For Intellij 2016.3 version it's on Other Tab > Generated Code > Quote Marks
回答6:
1st Things need to check in your Tslint file
"quotemark": [
true,
"Double"
],
It's should be Double rather than Single because it's Failed TSLint Passed on Project Build.
Now go to your Setting | Editor | TypeScript | Punctuation
Select Single from the dropdown and Apply/Ok it.
Now Congrats your IntellijIDEA are applied Double Quotes on AutoImport.
来源:https://stackoverflow.com/questions/39779272/webstorm-phpstorm-double-quotes-in-typescript-auto-import