If you enabled smart_indent (enabled by default) and write code like this:
if (true) return 1<enter>
| <- caret here
This is a tiny enhancement request to this config -- don't auto-indent the next line of one-liners in JavaScript variants.
Some C-like languages would force you to write a ; after every statement, but in JavaScript it doesn't. Further more, it has such behavior: it will automatically insert a ; after the next expression right of return (must be same line). i.e. return\n1 is the same as return;\n1, which returns undefined.
Preferred solution
I hope sublime could add a special treatment to JavaScript variant languages, don't "smartly" indent a caret after an one-liner expression. i.e. as of the example above:
if (true) return 1<enter>
| <- caret here (expected)
Alternatives
I didn't find a way to configure smart-indent behavior, I believe it is hard to come up with a solution to handle many languages. So I hope sublime could add special treatment to a language, that's it.
Problem description
If you enabled
smart_indent
(enabled by default) and write code like this:This is a tiny enhancement request to this config -- don't auto-indent the next line of one-liners in JavaScript variants.
Some C-like languages would force you to write a
;
after every statement, but in JavaScript it doesn't. Further more, it has such behavior: it will automatically insert a;
after the next expression right ofreturn
(must be same line). i.e.return\n1
is the same asreturn;\n1
, which returnsundefined
.Preferred solution
I hope sublime could add a special treatment to JavaScript variant languages, don't "smartly" indent a caret after an one-liner expression. i.e. as of the example above:
Alternatives
I didn't find a way to configure smart-indent behavior, I believe it is hard to come up with a solution to handle many languages. So I hope sublime could add special treatment to a language, that's it.
Additional Information
https://stackoverflow.com/questions/2846283/what-are-the-rules-for-javascripts-automatic-semicolon-insertion-asi