Jump to content

Recommended Posts

  • Developers
Posted
  On 10/26/2018 at 12:00 PM, mLipok said:

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

Expand  

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

  • Developers
Posted

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

Posted (edited)

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:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 10/26/2018 at 12:35 PM, Jos said:

Updated Tidy v18.708.9999.13

Expand  

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:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

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

  On 10/26/2018 at 12:36 PM, mLipok said:

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

Expand  

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:

  Reveal hidden contents

Signature last update: 2023-04-24

  • Developers
Posted (edited)
  On 10/26/2018 at 12:42 PM, mLipok said:

something went wrong:

Expand  

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

  • Developers
Posted
  On 10/26/2018 at 12:58 PM, mLipok said:

Could this be fixed as in proposal ?

Expand  

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

  • Developers
Posted (edited)

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

Posted (edited)
  On 10/26/2018 at 3:10 PM, Jos said:

Don't think this is wrong!

Expand  

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:

  Reveal hidden contents

Signature last update: 2023-04-24

  • Developers
Posted (edited)
  On 10/26/2018 at 3:35 PM, mLipok said:

There is lack of #ce

I mean Tidy strip # char

Expand  

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

Posted (edited)

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.au3Fetching info...

 

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.
  • Developers
Posted

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

  • Developers
Posted (edited)

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

Posted

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:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

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
  • Developers
Posted
  On 10/27/2018 at 7:30 AM, jpm said:

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

Expand  

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

  • Developers
Posted (edited)

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

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

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

Posted

OK

where is the Tidy.ini example?

If it is the one Tidy.ini in Dev can the

 Remove_Empty_Lines=
 ShowConsoleInfo=


have the default value

Guest
This topic is now closed to further replies.
×
×
  • Create New...