aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Eclipse JavaScript formatter? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Eclipse JavaScript formatter?" Watch "Eclipse JavaScript formatter?" New topic
Author

Eclipse JavaScript formatter?

Garrett Smith
Ranch Hand

Joined: Jun 27, 2002
Posts: 401
I want to have a formatter for javascript set up. How can I set up a formatter so that when I use:

ctrl + shift + f

...it formats my code?

I am using JSEclipse in Eclipse.

Garrett


comp.lang.javascript FAQ: http://jibbering.com/faq/
Sunil Vasudevan
Ranch Hand

Joined: Mar 05, 2007
Posts: 107
You need to configure your keys under Eclipse preferences window.

In preferences window, Under General, check the Keys option.


Sunil.V<br />SCJP2, SCWCD1.4, SCBCD1.3
Garrett Smith
Ranch Hand

Joined: Jun 27, 2002
Posts: 401
I'm not sure I understand how to set up the formatting options for JS.

I want to use tabs, not spaces and set up a general formatter.

Example:
I want to replace

with
Garrett Smith
Ranch Hand

Joined: Jun 27, 2002
Posts: 401
Maybe I'm asking on the wrong forum. I don't know any ajax forums for this sort of thing.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30537
    
150

Garrett,
You are in the correct forum. We have an HTML/JavaScript/AJAX forum, but it doesn't cover tools.

From looking at the


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30537
    
150

Garrett,
You are in the correct forum. We have an HTML/JavaScript/AJAX forum, but it doesn't cover tools.

From looking at the JSEclipse documentation, it looks like it doesn't support code formatting. Are you expecting to get this functionality from Eclipse or the plugin?
Garrett Smith
Ranch Hand

Joined: Jun 27, 2002
Posts: 401
I don't care how, just as long as it's easy for the other guys on my team to use it.

There is no coding convention here and I'm trying to make a code convention easy to integrate into our process. Harder for them = more resentment to me.

I've looked into JavaScript reporter but it falls short.

JSEclipse does not seem to have any code formatter yet.

It looks like at this point in time there is no option at all.
Garrett Smith
Ranch Hand

Joined: Jun 27, 2002
Posts: 401
I found NX Format, a js code formatter.

It looked promising, so I tried the online trial to see how it works. They don't have a d/l version for trial.

https://www.nx-gentech.com/nxg/nxf/onlineTrial.do


Unfortunately, the online edition had an error.

I used the form to contact support but it looks like the form is broken. Can't select a product, but "product" select list is empty!

So I'm still wondering how to format my JS.

Anyone???
Dan Grindstaff
Ranch Hand

Joined: Sep 24, 2006
Posts: 138
I tried downloading and installing this as a plug in to eclipse and it works fine. 30 day free trial. The stand alone program (run.bat) will allow you to browse but wants a .properties file. Not sure what that is about.
 
 
subject: Eclipse JavaScript formatter?