Jump to content

Tidy major Update (2-Nov-2018)


Jos
 Share

Recommended Posts

  • Developers
1 minute ago, mLipok said:

I thought that Skip_commentblock option was related only to #cs #ce but not to normaly comment which starts with semicolon.

True, but those commentlines in your example are inside the CommentBlock. 

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

  • Developers

Updated Tidy v18.708.9999.13 to align the complete Commentblock with the code when Skip_Commentblock=1.

Before:

#Tidy_Parameters=/scb=1
Func _CommentedFunction()
While 1
#cs ; comment for #CE
For $i = 1 To 10
    ; any code
    ; any code
    ; any code
Next
#ce ; comment for #CE
WEnd
EndFunc

 After:

#Tidy_Parameters=/scb=1
Func _CommentedFunction()
    While 1
        #cs ; comment for #CE
        For $i = 1 To 10
            ; any code
            ; any code
            ; any code
        Next
        #ce ; comment for #CE
    WEnd
EndFunc   ;==>_CommentedFunction

 

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

I was rethink and, my conceptual prosposal is 

Comment block should always keep current user intendation as ANY comment should be save - I mean can not be changed by TIDY

Example Before TIDY

Func _CommentedFunction() ; before TIDY
    While 1
    For $i =1 To 10
    #cs ; comment block start at col=5 - not well positioned  - should be 13 instead 5
        ConsoleWrite("") ; any code - not well positioned  - should be 13 instead 5
    ConsoleWrite("") ; any code - not well positioned  - should be 13 instead 5
                ConsoleWrite("") ; any code - not well positioned  - should be 13 instead 17
#ce ; comment block start at col=1 - not well positioned  - should be 13 instead 1
    Next
    WEnd
EndFunc   ;==>_CommentedFunction

Example after TIDY + Skip_commentblock =1

Func _CommentedFunction() ; after TIDY + Skip_commentblock =1
    While 1
        For $i =1 To 10
    #cs ; comment block start at col=5 - not well positioned  - should be 13 instead 5 - TIDY NOT change position as Skip_commentblock =1
        ConsoleWrite("") ; any code - not well positioned  - should be 13 instead 9 - but #cs#ce region alawys should keep users position
    ConsoleWrite("") ; any code - not well positioned  - should be 13 instead 5 - but #cs#ce region alawys should keep users position
                ConsoleWrite("") ; any code - not well positioned  - should be 13 instead 17 - but #cs#ce region alawys should keep users position
#ce ; comment block start at col=1 - not well positioned  - should be 13 instead 1 - TIDY NOT change position as Skip_commentblock =1
        Next
    WEnd
EndFunc   ;==>_CommentedFunction

Example after TIDY + Skip_commentblock =0

Func _CommentedFunction() ; after TIDY + Skip_commentblock =0
    While 1
        For $i =1 To 10
            #cs ; comment block start at col=9 - TIDY change position as Skip_commentblock =0
        ConsoleWrite("") ; any code - not well positioned  - should be 13 instead 9 - but #cs#ce region alawys should keep users position
    ConsoleWrite("") ; any code - not well positioned  - should be 13 instead 5 - but #cs#ce region alawys should keep users position
                ConsoleWrite("") ; any code - not well positioned  - should be 13 instead 17 - but #cs#ce region alawys should keep users position
            #ce ; comment block start at col=9 - TIDY change position as Skip_commentblock =0
        Next
    WEnd
EndFunc   ;==>_CommentedFunction

 

EXAMPLE as au3 file:  test _NBS_9.au3  REMARK: do not use Tidy on this file just look on comments

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

6 minutes ago, Jos said:

Updated Tidy v18.708.9999.13

something went wrong:

before:
 

#AutoIt3Wrapper_Run_Tidy=y
;~ #Tidy_ILC_Pos=50 ; preset "InLineComment_Pos" to column #50
;~ #Tidy_Parameters=/scb=0
;~ #Tidy_Parameters=/Skip_commentblock=0
#Tidy_Parameters=/scb=1
;~ #Tidy_Parameters=/Skip_commentblock=1

Func _CommentedFunction() ; before TIDY
    While 1
    For $i =1 To 10
    #cs ; comment block start at col=5 - not well positioned  - should be 13 instead 5
        ConsoleWrite("") ; any code - not well positioned  - should be 13 instead 5
    ConsoleWrite("") ; any code - not well positioned  - should be 13 instead 5
                ConsoleWrite("") ; any code - not well positioned  - should be 13 instead 17
#ce ; comment block start at col=1 - not well positioned  - should be 13 instead 1
    Next
    WEnd
EndFunc   ;==>_CommentedFunction

after Running Tidy (18.708.9999.13):

#AutoIt3Wrapper_Run_Tidy=y
;~ #Tidy_ILC_Pos=50 ; preset "InLineComment_Pos" to column #50
;~ #Tidy_Parameters=/scb=0
;~ #Tidy_Parameters=/Skip_commentblock=0
#Tidy_Parameters=/scb=1
;~ #Tidy_Parameters=/Skip_commentblock=1

Func _CommentedFunction() ; before TIDY
    While 1
        For $i = 1 To 10
            #cs ; comment block start at col=5 - not well positioned  - should be 13 instead 5
                ConsoleWrite("") ; any code - not well positioned  - should be 13 instead 5
            ConsoleWrite("") ; any code - not well positioned  - should be 13 instead 5
                        ConsoleWrite("") ; any code - not well positioned  - should be 13 instead 17
            ce ; comment block start at col=1 - not well positioned  - should be 13 instead 1
        Next
    WEnd
EndFunc   ;==>_CommentedFunction

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

I have one other problem/issue not realated strictly  to TIDY .... but related to #CS #CE

I notice also problem with CTRL+Q which affect this concept

22 minutes ago, mLipok said:

Comment block should always keep current user intendation as ANY comment should be save - I mean can not be changed by TIDY

here is example:

_Example()
Func _Example()
    While 1
        
    WEnd
EndFunc   ;==>_Example

image.thumb.png.88f5a2025fd13e0d2d4b555cf0068f64.png

 

Could this be fixed as in proposal ?

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • Developers
2 hours ago, mLipok said:

something went wrong:

Don't think this is wrong!
The commentblock gets aligned with the code indentation but nothing inside the commentblock is changing. 
We should not expect miracles when there is lousy formatted input. Shit in... some sort of formatted shit out. ;)   
I did find an issue where it would miss some start characters which in now fixed in the current Dev version .14

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

  • Developers
2 hours ago, mLipok said:

Could this be fixed as in proposal ?

You really mean Ctrl+Q ? as default install will give this:

_Example()
Func _Example()
;~     While 1
;~         
;~     WEnd
EndFunc   ;==>_Example

or do you mean Ctrl+Shift+q which is the stream comment? 

Either way not a topic for this thread so lets take this offline to avoid confusing the hell out of everybody and myself ;) 

 

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

  • Developers

Anybody else done any form of testing on their existing scripts and if so, what were the results? 

I will help while testing to use WinMerge to see the exact different at the end of the tidy run by adding this to Tidy.Ini:

ShowDiffPgm = """C:\Program Files (x86)\WinMerge\winmergeu.exe" "%new%" "%old%"""

which will fire WinMerge when any change is made so you can exactly see what happened. 

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

25 minutes ago, Jos said:

Don't think this is wrong!

There is lack of #ce

I mean Tidy strip # char

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • Developers
7 minutes ago, mLipok said:

There is lack of #ce

I mean Tidy strip # char

ok ...So this should be fixed in the current Dev version.

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

I tried it and got mixed results.

Before:

#cs
    AutoIt Version: V3.3.14.5 [X32]
        Windows Version: WIN_10 [X64]
    Language: English (0409)

    Date: 9/29/2018 12:26 PM
        Author: fin

    Details: pixel to percent
#ce

Local $iWidth = @DesktopWidth / 100     ;1 space then tab comment
Local $iHeight = @DesktopHeight / 100 ;1 space comment

Local $GUI = GUICreate("0_o", $iWidth*30, $iHeight*35, $iWidth*50 - $iWidth*15, $iHeight*50 - $iHeight*17.5)

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

#cs
Here's a comment block
with three lines
that are left aligned
#ce

After:

#cs
    AutoIt Version : V3.3.14.5[X32]
    Windows Version : WIN_10[X64]
    Language : English(0409)
    
    Date : 9 / 29 / 2018 12 : 26 PM
    Author : fin
    
    Details : pixel To percent
#ce

Local $iWidth = @DesktopWidth / 100     ;1 space then tab comment
Local $iHeight = @DesktopHeight / 100 ;1 space comment

Local $GUI = GUICreate("0_o", $iWidth * 30, $iHeight * 35, $iWidth * 50 - $iWidth * 15, $iHeight * 50 - $iHeight * 17.5)

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

#cs
    Here's a comment block
    With three lines
        that are left aligned
    #ce

It fixed the tab issues in the top comment block but added a bunch of whitespace.

Bottom comment block got all messed up.

All I did was download the .exe and run it.  Browsed for a file and this is what I got.

Anyway, I'm pretty sure I write sloppy code so I figured it'd be a good test for ya...:)  Hope it helps!

And thanks for all that you do around here!

Here's the file that was made in backup folder if you want it: 

tidy-test-1_old1.au3

 

EDIT: Hey, why does my code look so weird?  It's not even showing comment blocks. (sorry)

Edited by Fin
I'm wondering what I did wrong that made my code show up like that.
Link to comment
Share on other sites

  • Developers

I understand what the trigger of the issue is and doubt there is a easy solution other than the options specified at the end of this post.
The With in the last commentblock is recognised as the "With" Keyword  and it is trying to tidy the comments block so missing the EndWith.
Easiest solution here is to ensure commentblock lines never start with "invalid code", add a semicolon in front of the lines, or Skip_Commentblock tidying by adding this line to the top:

#Tidy_Parameters=/Skip_commentblock

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

  • Developers

The more I think about this the more I lean towards making the default behavior to skip the tidy process inside of commentblocks as it is obviously also used for basic documentation. Then people that only use #CS/#CE for Code Comments can switch it on when they feel the need.
So my idea is to  leave the current /Skip_commentblock for backwards compatibility, but change the default from 0 to 1 and add a new directive which indicates to tidy comment blocks:

/tidy_commentblock[=0/1]

Thoughts?

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

I will answer toomorow. 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

I test it and found that all tab are change to 4 space with the tidy.ini proposed

Not sure that will not produce some disagreement. perhaps all AutoIt examples will be changed after tidying

 

Edited wrong diagnostic sorry

Edited by jpm
Link to comment
Share on other sites

  • Developers
7 minutes ago, jpm said:

I test it and found that all tab are change to 4 space with the tidy.ini proposed

The tidy.ini in Dev has TabChar=0 and TobSize=4, so will use Tab characters and assumes Tidy is set to TabSize 4, so should not use Spaces unless there is an overriding directive in the source. 

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

  • Developers

I have decided to change the default behavior of Tidy not to tidy in Commentblocks and replace the  /Skip_Commentblock options replacing it for /Tidy_Commentblock.
/Skip_Commentblock will remain to work for backward compatibility, but will be removed from the Tidy.ini example and documentation.

An updated tidy.exe is posted in de Dev directory.

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

  • Jos changed the title to Tidy major Update (27-10) - requesting help with testing!
  • Developers

Yes :) 

Input script:

func _commentedfunction() ; before tidy
while 1
for $i = 1 to 10
#cs ; comment block start at col=5 - not well positioned  - should be 13 instead 5
If $a=1 then
ConsoleWrite("") ; any code - not well positioned  - should be 13 instead 5
ConsoleWrite("") ; any code - not well positioned  - should be 13 instead 5
ConsoleWrite("")         ; any code - not well positioned  - should be 13 instead 17
endif 
#ce ; comment block start at col=5 - not well positioned  - should be 13 instead 5
next
wend
endfunc

Default Output:

Func _commentedfunction() ; before tidy
    While 1
        For $i = 1 To 10
            #cs ; comment block start at col=5 - not well positioned  - should be 13 instead 5
            If $a=1 then
            ConsoleWrite("") ; any code - not well positioned  - should be 13 instead 5
            ConsoleWrite("") ; any code - not well positioned  - should be 13 instead 5
            ConsoleWrite("")         ; any code - not well positioned  - should be 13 instead 17
            endif
            #ce ; comment block start at col=5 - not well positioned  - should be 13 instead 5
        Next
    WEnd
EndFunc   ;==>_commentedfunction

Output with /Tidy_Commentblock:

#Tidy_Parameters=/tidy_commentblock
Func _commentedfunction() ; before tidy
    While 1
        For $i = 1 To 10
            #cs ; comment block start at col=5 - not well positioned  - should be 13 instead 5
                If $a = 1 Then
                    ConsoleWrite("") ; any code - not well positioned  - should be 13 instead 5
                    ConsoleWrite("") ; any code - not well positioned  - should be 13 instead 5
                    ConsoleWrite("") ; any code - not well positioned  - should be 13 instead 17
                EndIf
            #ce ; comment block start at col=5 - not well positioned  - should be 13 instead 5
        Next
    WEnd
EndFunc   ;==>_commentedfunction

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

  • Jos changed the title to Tidy major Update (2-Nov-2018)
  • Jos locked and unpinned this topic
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...