Default webStorm is supported editorConfig plug-in, then we need to customize the configuration of how to do editorConfig in webStorm in?
Step one: Open webStrome > File > settings
;
Step two: Find Editor > Code Style
and click on it in the following there will be a Enable EditorConfig support
(start-up support EditorConfig's), point it in front of the check box to select it;
Step Three: There is a box in the back of the Export
button, which is derived editorConfig profile; we tap it, and then identified; this time in your project already has a .editorConfig
profile up;
[*]
charset=utf-8
end_of_line=crlf
insert_final_newline=false
indent_style=space
indent_size=4
[{.eslintrc,.babelrc,.stylelintrc,*.json,*.jsb3,*.jsb2,*.bowerrc}]
indent_style=space
indent_size=2
[*.scss]
indent_style=space
indent_size=2
[{.analysis_options,*.yml,*.yaml}]
indent_style=space
indent_size=2
We have put this webStorm in editorConfig configured, now indentation is four spaces, turning it into two spaces, and then open a file by js shift+ctrl+f
while formatting, file js code will press the two spaces to indent, then state plug-in startup success!