Stop WebStorm from indenting non-Javascript script tags
Hi!
I'm playing with OMeta-JS and wants to have my OMeta script inside a script tag with type="text/x-ometajs".
But whenever I reindent my file WebStorm destroys the indentation I made by hand despite the contents are not Javascript/HTML/CSS.
Example, before file reformat:
<script type="text/x-ometa-js" id="ometasrc">
ometa M {
number = digit+:x -> parseInt(x.join(""),10),
exp = '(' exp:e ')' -> ["paren", e]
| number:n -> ["no paren", n]
}
M.matchAll("(123)", "exp")
</script>
After reformat:
<script type="text/x-ometa-js" id="ometasrc">
ometa M {
number = digit+:x -> parseInt(x.join(""),10),
exp = '(' exp:e ')' -> ["paren", e]
| number:n -> ["no paren", n]
}
M.matchAll("(123)", "exp")
</script>
Is there a way to tell WebStorm to not touch the contents it don't understand?
Regards, Flow
Please sign in to leave a comment.
Add script tag name to list of tags with preserved whitespace inside formatter settings (Settings|CodeStyle|HTML|Keep whitespace inside)
Yes, that worked. Strangely it still reindents my plain Javascript-only scripts, but leaves the scripts with non-Javascript types alone. Why isn't this the default? Hmmm.
-over 6 years later-, still applicable...
Thanks for the fix! (or at least guiding to the right tab inside code style; as I had a similar but different issue)