How to make Webstorm "Reformatting Source Code" to change double quotes to single quotes?

JavascriptIdeWebstorm

Javascript Problem Overview


When I push cmd + alt + l Webstorm doing some reformating to beautify my JavaScript sources. Ho to make Webstorm automatically change double quotes to single quotes in my sources?

Javascript Solutions


Solution 1 - Javascript

In Webstorm 2017.1, do the following:

  1. Go to File -> Settings | Preferences
  2. Choose Editor -> Code Style -> TypeScript
  3. Select 'Punctuation' tab
  4. Change: Use 'double' quotes to Use 'single' quotes. (Additionally, you can change 'in new code' to 'always')

Webstorm auto-import change to use double quotes instead of single quotes

Solution 2 - Javascript

there is no way to change this on auto-formatting in WebStorm 11; you can only use intentions here (hit Alt+Enter on quoted string, choose 'Replace double-quoted string with single-quoted string'. Note that in WebStorm 12 -2016.x it's possible to control the auto-generated quotes style (used for auto-imports, etc.) - Settings | Editor | Code Style | JavaScript | Other, Generated code/Quote marks.

Since 2017.1.*, it is Settings | Editor | Code Style | JavaScript | Punctuation, Use <quote style> quotes in <new code/always>

Solution 3 - Javascript

This looks to be fixed with the 2016.2 release - there's now an option in the Editor --> Code Style settings where you can choose single/double quotes.

See https://blog.jetbrains.com/webstorm/2016/07/webstorm-2016-2-drag-files-into-html-and-quotes-style/

Solution 4 - Javascript

Please see the answer of https://stackoverflow.com/a/42909782/2000468.

this answer is for an older version。

see the picture that let you set it quickly.

webstorm 2016.3.3

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionVlad AnkudinovView Question on Stackoverflow
Solution 1 - JavascriptEduardo VazquezView Answer on Stackoverflow
Solution 2 - JavascriptlenaView Answer on Stackoverflow
Solution 3 - JavascriptAussieFlemView Answer on Stackoverflow
Solution 4 - JavascriptXin MengView Answer on Stackoverflow