Let's say you have an example.js
file open in SublimeText:
function foo(bar){a=1;b=2;for(var i=0;i<100;i++){console.log(i);};}
How to automatically have an indented code with SublimeText? such as:
function foo(bar) {
a=1;
b=2;
for (var i=0;i<100;i++) {
console.log(i);
};
}
I tried Edit > Line > Reindent or CTRL+SHIFT+P Reindent but it does nothing on this code. Why?
How is this possible without a third-party package requiring node.js installed (such as HTML-CSS-JS Prettify )?
Since you don't want a Node.js server running just for formatting, and because it works really well for me, I'd recommend checking out JsFormat
. I looked through the source , and the only .js
files I could find are for testing -- everything else, including the underlying jsbeautifier
library, is written in Python, so it'll run as a native plugin.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.