has anyone integrated a JavaScript formatter with ace?

3,286 views
Skip to first unread message

Stephen Bannasch

unread,
Jun 13, 2011, 2:47:51 PM6/13/11
to ace-d...@googlegroups.com
I have users who would like to paste badly -formatted JavaScript into ACE and re-format the code.

Has anyone integrated a formatter that does this?

Matt Pardee

unread,
Jun 13, 2011, 2:58:09 PM6/13/11
to ace-d...@googlegroups.com
We did this with Cloud9, using JS Beautifier (http://jsbeautifier.org/). You can see this in use on the master and devel branches of cloud9 (https://github.com/ajaxorg/cloud9) and on the online version (c9.io).

I would say this is outside the realm of Ace specifically (except with Python perhaps) because it's not a function of interacting with the editor but of formatting the text as a whole. I make the distinction not to limit Ace's possibilities, but rather to differentiate it from the features of an IDE.

If you are looking to see how this is implemented in cloud9, please check out the code here:


Best,

Matt

On Jun 13, 2011, at 11:47 AM, Stephen Bannasch wrote:

I have users who would like to paste badly -formatted JavaScript into ACE and re-format the code.

Has anyone integrated a formatter that does this?

--
You received this message because you are subscribed to the Google Groups "Ajax.org Cloud9 Editor (Ace)" group.
To post to this group, send email to ace-d...@googlegroups.com.
To unsubscribe from this group, send email to ace-discuss...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ace-discuss?hl=en.


Adam Jimenez

unread,
May 29, 2013, 2:45:07 PM5/29/13
to ace-discuss
Using JS beautifier and the like adds unnecessary bloat when we can already make use of Ace's excellent tokeniser.

I've started working on an ace-based beautifier. See:

Maybe something like this could be added to Ace as a plugin similar to Emmet.

--
Best regards,
Adam Jimenez

ShiftEdit IDE | CMS systems

ShiftCreate Limited
http://www.shiftcreate.com
t. 020 8123 3766
m. 07969 689 484
skype: adamjjimenez
twitter: adamjimenez1

shiftcreate.com is the trading name of Shiftcreate Limited.
Registered in England Company No. 05862941 registered offices:
64a Southfields, Letchworth, Herts, SG6 4LZ 

Harutyun Amirjanyan

unread,
May 29, 2013, 3:38:13 PM5/29/13
to ace-d...@googlegroups.com
This is very cool!
In beautifyjs parser and printer are not separated which makes it hard
to understand and hard to modify.

Your code looks pretty nice and easy to configure.
It would be a great extension for ace

Adam Jimenez

unread,
May 31, 2013, 4:27:10 AM5/31/13
to ace-discuss
Awesome, I've moved the latest version to:

All contributions welcome.


--
You received this message because you are subscribed to the Google Groups "Ajax.org Cloud9 Editor (Ace)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ace-discuss...@googlegroups.com.

To post to this group, send email to ace-d...@googlegroups.com.

Harutyun Amirjanyan

unread,
Jun 16, 2013, 6:36:26 AM6/16/13
to ace-d...@googlegroups.com
Using jsfiddle is kind of awkward. Would be good to have it on github.
Where do you think this project should be in the future? Part of ace
or a separate project included as a submodule?

Adam Jimenez

unread,
Jun 17, 2013, 3:32:03 AM6/17/13
to ace-discuss
Part of Ace would be the most convenient.


--
You received this message because you are subscribed to the Google Groups "Ajax.org Cloud9 Editor (Ace)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ace-discuss...@googlegroups.com.
To post to this group, send email to ace-d...@googlegroups.com.

Harutyun Amirjanyan

unread,
Jul 20, 2013, 4:15:04 PM7/20/13
to ace-d...@googlegroups.com
On Mon, Jun 17, 2013 at 11:32 AM, Adam Jimenez <ad...@shiftcreate.com> wrote:
> Part of Ace would be the most convenient.


i agree, please when you have a time, cleanup it a bit and make a pull request.

Adam Jimenez

unread,
Jul 29, 2013, 6:38:05 AM7/29/13
to ace-discuss
Ok, it still needs a bit of work. Will create a pull when it's more reliable.


--
You received this message because you are subscribed to the Google Groups "Ajax.org Cloud9 Editor (Ace)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ace-discuss...@googlegroups.com.
To post to this group, send email to ace-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/ace-discuss.
For more options, visit https://groups.google.com/groups/opt_out.





--
Best regards,
Adam Jimenez

ShiftCreate Limited
Reply all
Reply to author
Forward
0 new messages