Jump to content

Tidy issues


Recommended Posts

I realize Tidy isn't actually a part of AutoIT, but not sure where to post issues/questions. I'm seeing 2 issues I'd like to ask about.

1) When I turn Proper Case on (Proper=1) and turn Delimiter processing off (Delim=0), I still get some spacing changes around delimiters. If I turn Proper Case off then delimiter spacing is ignored as expected, but it won't seem to ignore delimiter processing if Proper Case processing is on.

2) Skip_CommentBlock exhibits some strange, or at least unexpected, behavior. When I set Skip_CommentBlock=0, the lines between a #cs and a #ce are indented, and other lines in my source are not affected. However, if I set Skip_CommentBlock=1, the lines between #cs and #ce are not indented (as expected) but other sections of my code are affected that should not be. For example:

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Becomes

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd

And other code lines are also unindented. I've noticed that in all the cases where code is unindented, they happen to fall between two lines of code that are commented. For example,

;$RegSaver = RegRead("HKCU64\Control Panel\Desktop", "SCRNSAVE.EXE")
    $RegSaver   = RegRead("HKCU\Control Panel\Desktop", "SCRNSAVE.EXE")
    $RegSaverActive = RegRead("HKCU\Control Panel\Desktop", "ScreenSaveActive")
    ;HKEY_CURRENT_USER\Control Panel\Desktop\

Becomes

;$RegSaver = RegRead("HKCU64\Control Panel\Desktop", "SCRNSAVE.EXE")
$RegSaver   = RegRead("HKCU\Control Panel\Desktop", "SCRNSAVE.EXE")
$RegSaverActive = RegRead("HKCU\Control Panel\Desktop", "ScreenSaveActive")
    ;HKEY_CURRENT_USER\Control Panel\Desktop\

It seems as if Tidy is noticing that there is a commented line, then some uncommented lines, then another commented line - and it's assuming this is a comment block that needs to be unindented. Maybe this is intended behavior, but it's not what I was expecting. I would have thought comment blocks would only be between #cs and #ce, and NOT just all lines that happen to fall between two lines that have been commented out.

Any help or suggestions would be appreciated - Thanks

Edited by jayterry
Link to comment
Share on other sites

  • Developers

could you provide me with a few scripfiles to demonstrate the issues you listed so I know for sure I am testing correctly?

Just PM/Email them to me.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Thanks for the quick reply Jos. I'm not too familiar with this board software, and I didn't see how to attach a file to a PM or email send via the board. So I'm just attaching it to this message. I've provided a small program that I was using to setup Tidy. It's not pretty or neat, but just something I was using as a code sample to test the Tidy functionality. I also included my Tidy.ini, in case you wanted to see it.

In particular, note the effect of the skip_commentblock setting on the #cs/#ce area at the top, the while-wend message loop (when it's uncommented), and the uncommented lines in the 3 func blocks.

As for the delimiter processing - when proper=0, nothing around delimiters is changed at all. When proper=1 and delim=1, it works as intended. But when proper=1 and delim=0, there are still some minor changes around delimiters. It looks like it doesn't do full delimiter processing, but still a few spaces are added or removed in various places. I haven't figured out a pattern to it yet, but the point is that when delim=0 no spacing should change at all.

One other, very minor, thing that I didn't mention before. It sure would be nice to not have to use short filenames. I'm specifically thinking of the path to the diff program. I haven't tried it yet, but I'm wondering if the short name restriction applies to the backup directory also? Anyway, that's certainly not a big deal, just something for the wish list.

Thanks

TidyTest.zip

Link to comment
Share on other sites

  • Developers

I had a look at your example and found one issue with a space added after a literal string.

Uploaded a test version of tidy to the Beta SciTE directory so you can try it.

Your test script is quite big and its pretty difficult to understand were you see the issues.

This one I found but am not sure about your second point.

Could you give me something short and sweet that demonstrates that issue?

I have theseted with this line in the script to set the tidy parameters:

#tidy_parameters= /sci=9 /Delim=0 /rel=2 /Skip_CommentBlock

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Got it. Tried it. Looks good. Thanks very much for the update.

Sorry for the big sample file. I know better than that, just wasn't thinking.

One other thing I could mention - very, very minor. It seems that when AutoIt3Wrapper writes the directives back into the source file, not all are in proper case. So when Proper is turned on in Tidy, it causes a Tidy correction every time and keeps from ever having a perfectly clean Tidy run (i.e., " Tidy had to make no changes because I wrote such a perfectly formatted program :blink:). The two that I happened to have in my test source were AutoIt3Wrapper_icon and _AU3Check (there may be others). Obviously this is not significant at all, just something you might consider in a future update of AutoIt3Wrapper.

Thank You - Jay

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...