View unanswered posts | View active topics


Reply to topic  [ 65 posts ]  Go to page 1, 2, 3, 4, 5  Next
AutoFormat / Indent Plugin 
Author Message
Member

Joined: Thu Oct 02, 2008 11:01 am
Posts: 31
Post AutoFormat / Indent Plugin
Hey all,

I have started using FlashDeveleop quite recently and i'm was surprised with quility of this product. It's really great. Well done.
There was just a minor drawback, which as i seen on forum, is pretty common for users - lack of autoFormat feature.

So, yesterday (following a great samplePlugin code and other plugin codes) i managed to write a simple tool for this purpose. This is still very simple code, but it works for me. It is not really an AutoFormat tool, rather an AutoIndent one. It works well only with clean code, which needs indention, but hopefully i'll develop it further.

Installation
Simply place a dll in "FlashDevelop\Plugins" folder.

Notes
It defaults shortcut to Alt+Shift+F (NetBeans users should be happy). It works with selected text and if none is selected it will autoindent a whole document (it should be undoable, but be careful). It will follow the first line indention, so remember to set this one right. [first line means a first line of selection or file]
Perform import check defaults to true, thought it can be disabled in plugin setting panel. Remember it will be effective only while processing whole document.

Download
AutoFormat.dll [ver. 1.0.3.7]

UPDATE: I have updated code to recognize "case: ... break;" statements (link was updated)
UPDATE: It recognizes ASDoc syntax and will format ASDoc body with one leading space.
UPDATE: Recompiled to work with FD 3.0.3 RTM (link was updated) - sorry for the delay :oops:
UPDATE: Fixed some issues and added perform import check feature, which should remove all redundant package imports from class.
UPDATE: Fixed issue addressed by tigroux and added recognition of multiple var definitions var a:int,b:int, ... z:int;.
UPDATE: Fixed issue addressed by MathsIsFun (switch block recognition), trace info about removed imports from class, cursor shouldn't move after formatting whole document (though page might scroll a bit).
UPDATE: Fixed issue addressed by Girou and kudoshinichi (line comment recognition), added beta version of methodTrace functionality (it generates trace command with current method and it's parameters).

Hope you find it useful, report any bugs or requests through PM or forum.

Regards,
Jake


Last edited by jjeziorski on Fri Oct 23, 2009 9:28 pm, edited 12 times in total.



Thu Oct 02, 2008 11:26 am
Profile E-mail
Member

Joined: Thu Aug 21, 2008 10:13 pm
Posts: 119
Post Re: AutoFormat / Indent Plugin
Any chance we can get the code of this plugin under an open-source license such as MIT?
Also, what languages does it support? ActionScript, HaXe, XML...?


Thu Oct 02, 2008 12:51 pm
Profile E-mail
Member

Joined: Thu Oct 02, 2008 11:01 am
Posts: 31
Post Re: AutoFormat / Indent Plugin
Yeah, why not :wink: Once i'll develop it further i'd like to upload it to FlashDevelop plugin trunk (hope it would be possible).
It basically supports all curly braced languages. But good point it should support also XML.


Thu Oct 02, 2008 1:05 pm
Profile E-mail
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 7470
Location: Paris, France
Post Re: AutoFormat / Indent Plugin
jjeziorski wrote:
Yeah, why not :wink: Once i'll develop it further i'd like to upload it to FlashDevelop plugin trunk (hope it would be possible).
It basically supports all curly braced languages. But good point it should support also XML.

At least is must play nice with inline XML in AS3 (curly braces can be used inside the XML to insert AS expressions).


Thu Oct 02, 2008 3:51 pm
Profile WWW
Member

Joined: Thu Oct 02, 2008 11:01 am
Posts: 31
Post Re: AutoFormat / Indent Plugin
Could you please send me a sample syntax in AS context, it seems i'm not familiar with this XML usage.
Regards,
Jake


Thu Oct 02, 2008 6:52 pm
Profile E-mail
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 7470
Location: Paris, France
Post Re: AutoFormat / Indent Plugin
jjeziorski wrote:
Could you please send me a sample syntax in AS context, it seems i'm not familiar with this XML usage.
Regards,
Jake

http://www.senocular.com/flash/tutorial ... s3/?page=4


Thu Oct 02, 2008 7:08 pm
Profile WWW
Member

Joined: Tue Oct 07, 2008 6:03 pm
Posts: 7
Post Re: AutoFormat / Indent Plugin
Hi everyone, I'm interesting on the AutoFormat.dll, but unfortunately the link in filefactory.com (http://www.filefactory.com/file/ad1955/n/AutoFormat_dll) seems dead. do you have another one?
Thanks a lot
Sam


Tue Oct 07, 2008 6:07 pm
Profile E-mail
Member

Joined: Thu Oct 02, 2008 11:01 am
Posts: 31
Post Re: AutoFormat / Indent Plugin
OK, i've moved file to a new location try to download now.


Tue Oct 07, 2008 6:51 pm
Profile E-mail
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 7470
Location: Paris, France
Post Re: AutoFormat / Indent Plugin
jjeziorski wrote:
OK, i've moved file to a new location try to download now.

Some other FD users have created plugins hosted on code.google for instance - maybe they will be willing to share some room?


Tue Oct 07, 2008 7:01 pm
Profile WWW
Member

Joined: Mon Oct 13, 2008 2:03 pm
Posts: 3
Post Re: AutoFormat / Indent Plugin
Hi Jake - finally, an indentation plug-in for FD that I feel comfortable with.... cheers! But one (small) thing.... it doesn't appear to format ASDoc comments as I'd expect -

/**
* Before formatting
*/

/**
* After formatting
*/

Its a tiny but niggly thing. Is there any way to set preferences yet?


Mon Oct 13, 2008 2:07 pm
Profile E-mail
Member

Joined: Mon Oct 13, 2008 2:03 pm
Posts: 3
Post Re: AutoFormat / Indent Plugin
:oops: Appears the formatting didn't come out in my post, though you probably know what I'm referring too - the indent of one space before each asterisk on each line of the ASDoc body.


Mon Oct 13, 2008 2:11 pm
Profile E-mail
Member

Joined: Thu Oct 02, 2008 11:01 am
Posts: 31
Post Re: AutoFormat / Indent Plugin
OK, it was an easy one, so update new dll. Also it will add indention to blank (whitespace) lines as well.


Fri Oct 17, 2008 10:48 pm
Profile E-mail
Member

Joined: Thu Nov 27, 2008 2:01 pm
Posts: 3
Post Re: AutoFormat / Indent Plugin
First of all hello to the forum.

FD is great project and great help for us Actionscript coders.

Let's get to the point! Is it possible to remember the line where cursor was before autoformat - because, in large files, it's hard to find where I were before hitting ctrl+alt+f. This could be option in preferences.

Thanks.


Thu Nov 27, 2008 2:07 pm
Profile E-mail
Member

Joined: Mon Oct 13, 2008 2:03 pm
Posts: 3
Post Re: AutoFormat / Indent Plugin
Thanks jjeziorski - just noticed the update - much appreciated :wink:


Tue Dec 02, 2008 11:27 am
Profile E-mail
Member

Joined: Thu Apr 19, 2007 7:01 am
Posts: 5
Post Re: AutoFormat / Indent Plugin
this is a fantastic plugin. thanks for that.
only trouble is: it stopped working for me when i updated to FD 3 RC1.
any suggestions?


Tue Jan 27, 2009 9:25 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 65 posts ]  Go to page 1, 2, 3, 4, 5  Next

Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.