Format Code - Xojo Script to nicely format your source

Thanks!

Currently the script works on one method at a time, manually triggered by the user. IDE scripting is powerful enough to iterate through each item, but it wouldn’t be pretty as when you set the location, the editor physically switches location. So, it would be as if you clicked on the first item in your project, ran Format Code, click on the next, etc… That is why I have not automated it further. Plus, I believe in minor working change, then commit, minor working change, then commit. I’m not so sure a major project reformat would be the best way to go, but I know that would be ones own preference.

[quote=186265:@Thomas Tempelmann]But my tool Arbed can do that. It provides iterators for getting to every method’s source code. Since it’s also based on RbScript, I wonder if you or someone else would like to make the script work with Arbed in order to have this work on an entire project with the click of a button?

I’d be happy to supply the author with a free complete Arbed license, of course, and any support he/she needs to get it working (I’d also be happy to add more functions if needed).[/quote]

I think I personally will pass, thanks for the offer though. Maybe someone else will pick it up, it is open source. I like staying within the IDE when developing.

One nice thing about Arbed is that you can also use it to review changes to a project rather easily. So, even when you’d let the script run over the entire project, the results can be reviewed afterwards (and individually reverted) much more efficiently than with the current IDE method.

I have a test version of Arbed ready that supports all the IDE Script functions that Jeremy’s script uses. Arbed can now also create a in-memory clone of an open project, and has a function to run such a script on every function in the project, or on every that’s inside a selected project item (or, even, in a multi-selection).
So, with all this, you could now use Jeremy’s script to run on your entire project or on a chosen set of classes, and then review the changes with Arbed’s own comparison feature, before you save the result if you’re happy with them.

Does anyone want to test this? If so, write me at tempelmann at gmail com.

… and tell me which OS you’re using (Mac/Win)