admin管理员组

文章数量:1332872

I am looking for a formatting/indetation tool for sublime text 2, which on ctrl+s turns the following code

if(a==2){b=a+2;}

to something like

if(a == 2) {
   b = a + 2;
}

I can't find anything useful. Please help.

I am looking for a formatting/indetation tool for sublime text 2, which on ctrl+s turns the following code

if(a==2){b=a+2;}

to something like

if(a == 2) {
   b = a + 2;
}

I can't find anything useful. Please help.

Share Improve this question asked May 17, 2016 at 18:25 Nitin AggarwalNitin Aggarwal 2151 gold badge3 silver badges10 bronze badges 0
Add a ment  | 

4 Answers 4

Reset to default 7

You can use JsFormat

JsFormat is a JavaScript formatting plugin. Behind the scenes, it uses the mand line formatter from jsbeautifier to format full or portions of JavaScript and JSON files.

Try Beautify or HTML/CSS/JS beautify

CoolFormat offers various bracket, indentation, whitespace, & formatting styles for the following langauges:

  • C, C++, C#, CSS, HTML, Java, JavaScript, JSON, Objective-C, PHP, SQL, XML

I have worked around an easy solution for my code indentation/formatting problem. I am using an online formatting tool JSBeautifier. I just copy my whole code and paste it in jsbeautifier and after it formats my code I copy my formatted code and paste it back to my js file.

本文标签: javascriptFormatting tool for sublime textStack Overflow