• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Eclipse JavaScript formatter?

 
Garrett Smith
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Sunil Vasudevan
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to configure your keys under Eclipse preferences window.

In preferences window, Under General, check the Keys option.
 
Garrett Smith
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe I'm asking on the wrong forum. I don't know any ajax forums for this sort of thing.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34669
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Garrett,
You are in the correct forum. We have an HTML/JavaScript/AJAX forum, but it doesn't cover tools.

From looking at the
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34669
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic