Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autoformat Javascript in Netbeans IDE

Are there any known Plugins or ways to properly autoformat Javascript in Netbeans IDE?

like image 651
mayrs Avatar asked Jun 19 '12 07:06

mayrs


People also ask

How do I change indentation in NetBeans?

Choose Tools | Options. Click Editor in the left panel and select the Indentation tab. Adjust the properties for the indentation engine to your taste.

Where is Javadoc in NetBeans?

Displaying JavadocFrom the menu bar, select Window > IDE Tools > Javadoc Documentation to open the Javadoc window, in which the documentation is refreshed automatically for the location of your cursor.

How do I Auto tab in NetBeans?

Shift + Alt + F indents the whole file. Save this answer. Show activity on this post. Select the lines you want to reformat (indenting), then hit Alt+Shift+F.


1 Answers

EDIT 9/15/2012

After looking into this further, I have found that the javascript module is being rewritten already(much needed). You can finally find formatting options for javascript. It's available in the netbeans nightly builds. Good luck all.

http://bits.netbeans.org/download/trunk/nightly/

I have released a pretty simple JS formatter that uses JSBeautify and runs in Rhino.

http://plugins.netbeans.org/plugin/43263/jsbeautify

You have to use an alternate key for now. I'm working on modifying the Javascript language in Netbeans to possibly release something better, later on(either as a plugin or patch). I'm still familiarizing myself with the way things are happening in Netbeans.

There have been talks for years to add more formatting options for Javascript in Netbeans. Nothing has surfaced. I'm going to propose that the Javascript language leverage JSBeautify(running in Rhino) to provide formatting, rather then implementing new features in Java. This simplifies the formatting process, plus the JSBeautify community is very large and it's actively developed.

like image 120
Drew H Avatar answered Sep 28 '22 05:09

Drew H