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?
In the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Editor | General | Auto Import. On the Auto Import page that opens, use the checkboxes in the TypeScript/JavaScript area to enable or disable import generation on code completion.
If we want to go a step further and sort the imports, we can go to Preferences / Settings | Editor | Code Style | JavaScript or TypeScript and select Sort imports by modules on the Imports tab.
The option “Do not import exactly from” allows you to tell the IDE that you don't want any imports that are from the specific path (e.g. @material-ui/core ) or path pattern (e.g. @material-ui/core/** ). The IDE will then use an alternative path if there is one.
This behaviour is controlled by the following option:
Settings/Preferences
Editor | 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:
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
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