Jump to content

Recommended Posts

Posted (edited)

A couple of questions about the /gd  and /gds options in the Tidy.exe utility:

I've just installed the beta version of Tidy.exe (21.316.1639.14) to see if it fixes an issue I was seeing with Tidy messing with the case of comments at the end of #directive lines before I asked about it. (For the record, it does :thumbsup:.)

In my script, I have 

#Tidy_Parameters=/gd /gds

to generate the nifty scriptname_tidy.text file and then immediately open it in Notepad. But what I'm noticing is that the text file report it generates shows the script before it's been Tidy'd, not after. Wouldn't it be better to generate the documentation file after the Tidy'ing process has been done so that the document shows the finished result?

Also, I'm curious about the listing of variables at the bottom of the report. There's a column there for 'Dim' which looks like it may have been intended to show whether the listed variable was declared as Global, Local, or Constant, and whether the variable is unused. The note immediately preceding the variable listing says

#### indicates that this specific variable only occurs one time in the script.
---- indicates that this specific variable isn't declared with Dim/Local/Global/Const.

But in my listing I get ----- for every variable, even though I have

Opt("MustDeclareVars", 1)

 in the script and every variable is explicitly declared. And I have a variable declared that I never actually used anywhere in the script so I expected I'd see #### for it, but it just shows up as ----- in the DIm column too.

Am I wrong about the intent of this column or is this just something that's currently not working in Tidy?

Oh, and is there a reason why the report created with /gd isn't automatically opened with /gds if Tidy didn't find anything to change? Tidy still creates the report again, even if it made no changes, so it should still auto-open the text file if the /gds parameter is specified.

Edited by TimRude
  • TimRude changed the title to Tidy.exe /gd /gds
  • Developers
Posted

Funny to see how every now and then somebody pops up and actually uses stuff build ages ago and which I clearly broke somewhere along the line. :) 
I have made some changes in the current Tidy Beta version to fix the use of the Tidied source and the declaration of the Variables.

9 hours ago, TimRude said:

Oh, and is there a reason why the report created with /gd isn't automatically opened with /gds if Tidy didn't find anything to change? Tidy still creates the report again, even if it made no changes, so it should still auto-open the text file if the /gds parameter is specified.

I choose not to show anything when nothing was changed by Tidy as it all should be still the same as the last time it was shown. 

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.
  :)

Posted
9 hours ago, Jos said:

I choose not to show anything when nothing was changed by Tidy as it all should be still the same as the last time it was shown. 

Except that it very well might not be the same. It could be that the user modified the script (maybe substantially) since the last Tidy, but did so in a way that there was nothing that Tidy needed to clean up. Especially with the function and variable auto-completion features in SciTE, it's not difficult to write a bunch of code that already is Tidy-compliant. So in that case, the resulting Tidy report is very different from the last Tidy run, but isn't shown since Tidy didn't make any changes.

I think if the user supplies the /gds command line parameter, that should be honored regardless of whether Tidy tweaked anything or not. If the user doesn't want to see a report after a Tidy, they just don't include the /gds command line parameter.

Posted

One other odd little quirk of the Tidy reports:

When there's a comment line inside a function, and that line is indented in the source code using tabs, when it's carried over to the report it gets indented with both spaces and tabs, pushing it to far to the right and out of alignment with the surrounding source code. In the report, the only instance of tab codes is for these comment lines, and if the tabs were simply omitted from the report everything would like up properly with just the existing spaces that are there.

Here's an example:

            Local $aData = _WinAPI_EnumDisplaySettings($sDevice, $ENUM_CURRENT_SETTINGS)
            ; this API does not participate in DPI virtualization. Output given is always in terms of physical pixels.
            If @error = 0 Then

This snippet of source code is inside a function and each of these 3 lines are indented 3 tabs over from the left. Tidy leaves it correctly indented like this in the source code in SciTE.

But when this same chunk of source code gets listed in the Tidy report text file, it gets listed like this:

00499  |  |  |    Local $aData = _WinAPI_EnumDisplaySettings($sDevice, $ENUM_CURRENT_SETTINGS)
00500  |  |  |                ; this API does not participate in DPI virtualization. Output given is always in terms of physical pixels.
00501  |  |  |  +-If @error = 0 Then

(And actually, in Notepad with it's 8-space tab-stops, it gets pushed to the right even further than it appears here.)

Here's a screenshot of these same 3 report lines in PSPad, where you can see the spaces as · and the tab characters as »

PSPad.png

  • Developers
Posted
14 hours ago, TimRude said:

Except that it very well might not be the same.

True...  so /gds will now always show the doc file. :) 

13 hours ago, TimRude said:

One other odd little quirk of the Tidy reports:

Should be fixed in the latest Beta. 

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.
  :)

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
  • Recently Browsing   0 members

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