donnyh13 Posted March 23 Posted March 23 (edited) Hi @Jos, I just noticed a (potential) minor bug with Tidy and inline comments. If you run Tidy, and it has to de-indent a line of script with an inline comment at the end, it leaves the comments in its original position, adding spaces after the script line. Is this a purposeful thing? Try running Tidy on this, with no parameters set for Tidy: Quote Local $aVar ; Test And it will result in this: Quote Local $aVar ; Test Best regards, Donny Edited March 23 by donnyh13 LibreOffice UDF ; Scite4AutoIt Spell-Checker Using LibreOffice Spoiler "Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."
Developers Jos Posted March 23 Developers Posted March 23 (edited) I guess the first code should have been indented, but the tabs were removed? It is indeed the case that as default the code is properly indented and the inline comments start position is kept where possible. This is considered a feature that the inline comments stay aligned when the code indentation is changed. e.g. Local $aVar ; Test Local $aVar ; Test Local $aVar ; Test Local $aVar ; Test will result in Local $aVar ; Test Local $aVar ; Test Local $aVar ; Test Local $aVar ; Test Edited March 23 by Jos donnyh13 1 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.
donnyh13 Posted March 23 Author Posted March 23 (edited) 1 hour ago, Jos said: but the tabs were removed Yes, sorry, I didn't notice that, It was a simple example, but where I ran into it was running tidy on code that had been tidied, but then having removed some "If" blocks, thus making the indent level decrease. After running Tidy, I seen that my comments that were only 1 space away from the end of the line before, became 4 or more spaces away. But if this is intended, then it's not a big deal, as I can see its use, per your example. Original Tidied code: If 1 = 1 Then ; A comment 1 space away. If 2 = 2 Then ; A comment 1 space away. If 3 = 3 Then ; A comment 1 space away. EndIf EndIf EndIf Remove one level of "IF"'s and tidy again: ;~ If 1 = 1 Then ; A comment 1 space away. If 2 = 2 Then ; A comment 1 space away. If 3 = 3 Then ; A comment 1 space away. EndIf EndIf ;~ EndIf Edited March 23 by donnyh13 LibreOffice UDF ; Scite4AutoIt Spell-Checker Using LibreOffice Spoiler "Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."
Developers Jos Posted March 24 Developers Posted March 24 There is also a -1 option for the Support for directive #Tidy_ILC_Pos=nn as you can see here. This is the previous Tidy behaviour, where all spaces were trimmed to one space between end of code and comment. I will update the documentation to include that info. donnyh13 1 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 Jos Posted March 24 Developers Posted March 24 Just uploaded an updated Tidy to the Beta directory that now also has option #Tidy_ILC_Pos=-2 The -2 option will simply copy any existing Whitespace characters between the Code and InlineComment, from the existing line to the newly indented line. Try that and see if that is what you are looking for, but I thought it would be nice to make that available as well as option. 🙂 donnyh13 1 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.
donnyh13 Posted March 24 Author Posted March 24 Thanks Jos! That works great. LibreOffice UDF ; Scite4AutoIt Spell-Checker Using LibreOffice Spoiler "Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now