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
Post a Comment