I’ve just updated the Reformat Code Script to include some useful new features.
-Pad the inside of parentheses with a space. So a(b,c) will become a( b,c )
-Pad the outside of parentheses with a space. So a(b,c) will become a (b,c)
-Pad empty parentheses with a space. So a() will become a( )
-Remove empty parentheses. So a() will become a
-Pad commas. So a(b,c) will become a(b, c)
-Pad operators. So a=b+c will become a = b + c
-Pad inline ifs so a=if(b=1,0,1) will become a=if (b=1,0,1)
-Pad before a line continuation mark (underscore)
-Aid with some common transpositions i.e. endif will become End If
-Comment replacement e.g. ’ will become // or vice versa
-Pad comments before and after the comment mark
-Code replacement, a++ (a=a+1), a+=1 (a=a+1), if a!=1 (if a<>1) etc.
-Macros, quickly insert pre-defined text with autocomplete description
-Automatic calculation of windows declare types, convert types as you type
-An error checking feature that will notify you if the line has: mismatched parentheses, missing opening parenthesis, missing closing parenthesis, mismatched quotes
-Parentheses checking across line continuations in pasted code (less error message spam)
-Automatic conversion of hex values
-Automatic conversion of #define to const
-Automatic conversion of MSDN code blocks to declares
Visit https://github.com/JulianSamphire/ReformatCode to download and/or watch the video for more information.
Original features video - https://youtu.be/IAVjh-xiO0w
Latest features update video - https://youtu.be/-JPjQ4Gn1bM
If you have any questions, feature requests or bug reports please post them below.
If something is formatting incorrectly for you, please post what you typed and what you expected to see on separate lines, thanks.
I would only suggest using this in version 2018r1 or later as there may be some issues with previous versions that have had bug fixes in later releases.
Still not working for you?
If the reformat code script doesn’t seem to activate for you, please follow these steps closely:
Make sure that the “ReformatCode.xojo_script” file is named exactly that and it’s inside the Script folder of the current version of Xojo that you’re using.
After restarting the IDE, if nothing happens make sure you have “Apply standardize format after ending line” turned on under Options->Coding in the IDE.
Failing all that, please post a message to this thread asking for some help.