Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Indenting after UE4 macros -- any retroactive fix?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Kelby
Junior Member

USA
10 Posts

Posted - Jan 05 2020 :  11:36:10 PM  Show Profile  Reply with Quote
Thanks to the Whole Tomato team for the recent fix that allows me to type a UE4 UPROPERTY or UFUNCTION without auto-indenting the next line!

But now I still have tens of thousands of lines of code that were auto-indented before the latest update that included this fix. Is there a convenient and safe way to remove all of those old indents? I can leave it as is, I suppose, but it's a bit sloppy to have so much code indented and all the new code going forward not indented.

Kelby

simco50
Starting Member

United Kingdom
1 Posts

Posted - Jan 06 2020 :  04:53:34 AM  Show Profile  Reply with Quote
Awesome update indeed. I've been getting around it by using a regex find and replace which worked very well for me so far.
Here it is in case you want to give it a try
replace:
((?:UPROPERTY|UFUNCTION)\(.*\).*\n\t)\t
with
$1

This will replace the matches with the contents of the first capture group which is the match without the last indent.
I'm not a regex wizard so I'm sure there could be a much better/smarter solution :)

Edited by - simco50 on Jan 06 2020 04:53:42 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18750 Posts

Posted - Jan 06 2020 :  12:51:52 PM  Show Profile  Reply with Quote
From this forum thread:

https://forums.wholetomato.com/forum/topic.asp?TOPIC_ID=16718

I worked out the following find and replace regular expression, which copies the indent from the following line, and applies it to the Unreal macro, so it should have the correct indent. It works correctly in the code I have tested, so should help:

Find
^([ \t]+)((UCLASS|UINTERFACE|USTRUCT|UFUNCTION|UPROPERTY)\(.*)\n([ \t])+(\w)
Replace
$1$2\n$1$5

which works with the Visual Studio Find and Replace regex syntax, which is different to other regex syntax's, just because

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000