maestrith / AHK-Studio

Created with AHK Studio
http://www.maestrith.com
363 stars 68 forks source link

Autoindent for labels? #242

Open markhavemann opened 2 years ago

markhavemann commented 2 years ago

Is it by design that content of labels are not automatically indented?

I love that fuctions and loops and everything with curly brackets is indented, but autoindent will often UNindent my labels for me after I've done it manually. AHK uses so many labels that this is almost a dealbreaker for me since it makes code so much harder to read.

maestrith commented 2 years ago

Yes, this is by design. The reason I do not indent them is because AHK is a bit strange in the fact that there really isn't a reliable way to tell when you have finished a label. With a function there is a clear { and } but labels are sadly not as structured :(

markhavemann commented 2 years ago

that's so sad, it would make code sooo much more readable.

Any way to make it a feature by something like adding a certain comment (maybe somethin like "return ;=end=label name=") at the end of the return for a label?

Besides that AHK Studio is amazing, thanks for making it!

maestrith commented 2 years ago

you can use ;{ and ;} around any code to indent it: `;{

 this will be indented

;} this won't`

markhavemann commented 2 years ago

that's awesome, thank!

markhavemann commented 2 years ago

For anyone else who finds this in the future:

Make sure "Auto Indent Comment Lines" is turned on in "Options->Auto Indent", otherwise it won't indent from the commented curly braces.