Xojo IDE Reformat Code Script

  1. ‹ Older
  2. 8 months ago

    Julian S

    31 Oct 2018 Pre-Release Testers, Xojo Pro UK

    Fix: Corrected Me.a+=b and Self.a+=b (and all variants there of)

  3. 3 months ago

    Julian S

    Apr 4 Pre-Release Testers, Xojo Pro UK
    Edited 3 months ago

    Current 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

    Visit https://github.com/JulianSamphire/ReformatCode to download and/or watch the video for more information.

    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:

    https://github.com/JulianSamphire/ReformatCode#getting-started

    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.

  4. Jean-Yves P

    Apr 5 Pre-Release Testers, Xojo Pro Europe (France, Besançon)

    has this been corrected in this update ?
    https://forum.xojo.com/51048-bad-autocompletion-when-standardize-code-is-checked
    thanks.

  5. Julian S

    Apr 5 Pre-Release Testers, Xojo Pro UK

    Unfortunately not, this is an issue with the IDE with regards to how it moves the text around during a Shift+Enter in conjunction with the reformat code script system, the fix is out of my control as it also happens with the simple script that xojo provide on the Custom Code Reformatting documentation page.

    I brought this up in a private note on Feedback Case #51228 in June 2018 but it wasn't fixed. I'll make another ticket with it in because its still not working correctly even in the upcoming 2019r1 release.

  6. Jean-Yves P

    Apr 5 Pre-Release Testers, Xojo Pro Europe (France, Besançon)

    Thanks, Julian, for bringing us this reformat script.
    who knows may be one day Xojo will correct this IDE bad behavior, and then it will be perfect !

  7. scott b

    Apr 5 Pre-Release Testers, Xojo Pro local coffee shop

    @Julian S I'll make another ticket

    if you give us teh feedback number, some of us might join it so it might raise high enough that someone sees the case.

  8. Andre K

    Apr 5 Pre-Release Testers
    Edited 3 months ago

    In the latest beta, the first line of the macro's (comment line) is not visible, therefor there isn't any explanation to see while the list with the possible choises pops up. This is tried in Windows 10.

    Still a very usefull addition to the IDE!

  9. Julian S

    Apr 6 Pre-Release Testers, Xojo Pro UK

    @scott b if you give us teh feedback number, some of us might join it so it might raise high enough that someone sees the case.

    Feedback Case #55398

  10. Jean-Yves P

    Apr 6 Pre-Release Testers, Xojo Pro Europe (France, Besançon)

    rank 550th ... :(

  11. Robin L

    Apr 6 Xojo Inc Europe (Germany, Rehlingen)

    Seen and pushed to development team :)

  12. 3 weeks ago

    Julian S

    Jun 1 Pre-Release Testers, Xojo Pro Answer UK
    Edited 3 weeks ago

    I've just updated the Reformat Code Script to include some useful new features.

    Current 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

    New features

    • 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:

    https://github.com/JulianSamphire/ReformatCode#getting-started

    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.

  13. Massimo V

    Jun 3 Pre-Release Testers, Xojo Pro Europe (Germany, Würzburg)

    I tested the new script and for a line like this:

    lines.Append log("test")

    is changed like this

    lines.AppendLog("test")

    ugh!

  14. Julian S

    Jun 3 Pre-Release Testers, Xojo Pro UK

    Doh sorry! I missed out one line of code in my refactor, fixed and updated on git, thanks Massimo!

    I've added that test to my long list.

  15. Julian S

    Jun 3 Pre-Release Testers, Xojo Pro UK
    • Fixed bug with no parentheses calls (thanks Massimo)
    • Implemented a work around for a bug in the IDE regarding empty lines
    • Now deal will hex values that include a trailing L
  16. Massimo V

    Jun 4 Pre-Release Testers, Xojo Pro Europe (Germany, Würzburg)

    Thanks Julian, works now.

  17. David C

    Jun 7 Pre-Release Testers, Xojo Pro Derby, ITM

    I am having an issue with this script and the DownTo keyword, where it is removing the space before it ie

    for tempInt As Integer = myArray.Ubound DownTo 0
    …
    next

    becomes

    for tempInt As Integer = myArray.UboundDownTo 0
    …
    next

    Can someone else confirm this?

    I cannot find anywhere in the Script to disable this activity and I'm not sure if the Ubound or the DownTo is causing it.

  18. Julian S

    Jun 7 Pre-Release Testers, Xojo Pro UK

    I thought this might happen as I did a major refactor of one of the areas that caught all types of tokens.

    To temporarily turn this off, uncheck reformatting in Options>Coding>Apply standardize format after ending line

    Give me a few minutes and I'll have a fix up on github.

  19. Julian S

    Jun 7 Pre-Release Testers, Xojo Pro UK

    Hmm it doesn't happen here, are you sure you have the latest version?

  20. Julian S

    Jun 7 Pre-Release Testers, Xojo Pro UK
    Edited 3 weeks ago

    If you download the latest version from git I've just added a way to view the version number of the currently installed script.

    If you are on the latest version, typing this into the code

    reformat_code_script_version

    then moving onto the next line should show this message

    Reformat Code Script Version v0.14

    This means you're using the latest version and the problem you mention above shouldn't happen, could you let me know if it does/doesn't as I can't seem to replicate it?

    Thanks

  21. 2 weeks ago

    David C

    Jun 9 Pre-Release Testers, Xojo Pro Derby, ITM

    I was on version 12, so the issue is resolved now I have upgraded to version 14. Sorry for the inconvenience caused.

or Sign Up to reply!