javascript - How to make Webstorm keep indent of multi line string literals during reformat -


when creating directive angularjs keep templates string literals. templates span several lines, indent them way indent html file better readability.

here simple example

template: '<div>' +               '<div>' +                   '<input ngmodel="mytext" type"text">' +               '</div>' +               '<div>' +                   '<button ng-click="ok()">ok</button>' +                '</div>' +            '</div>', 

unfortunately whenever reformat code, webstorm removes hand crafted indents, template this:

template: '<div>' + '<div>' + '<input ngmodel="mytext" type"text">' + '</div>' + '<div>' + '<button ng-click="ok()">ok</button>' + '</div>' + '</div>', 

is there setting somewhere or trick make webstorm keep relative indents in multi line string literals during reformat? thanks.

you can enable special formatter control comments in preferences | editor | code style , use them in code prevent webstorm reformatting it:

// @formatter:off     template: '<div>' +               '<div>' +                   '<input ngmodel="mytext" type"text">' +               '</div>' +               '<div>' +                   '<button ng-click="ok()">ok</button>' +                '</div>' +            '</div>', // @formatter:on 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -