Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 auto keyword support (UE4)

You must be registered to post a reply.
Click here to register.

Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji

Forum code is on.
Html is off.

Check to subscribe to this topic.

T O P I C    R E V I E W
Amimoller Posted - Dec 15 2020 : 3:27:52 PM
We are using vs2019 and Unreal (4.25)

For as long as i can remember, using the auto keyword has messed up VA. Both auto completion and "convert . to ->"

Here is a common example of getting a component.

When you type . it does not get converted to ->

if you change the code to be "auto* health" convertion works as normal, but the listbox will not adhere to "List non-inherited entries first"

Both issues makes the use of auto problematic as it slows down your workflow.

Getting this fixed would be great :)
8   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Dec 18 2020 : 2:47:03 PM
There is something inside Unreal Engine that is confusing our parser with Cast, but so far I cannot find any clues as to what it is. I have put a bug report in for this:


if you set up a simple test for the Cast function outside of Unreal Engine then VA handles it correctly, and dot is converted to -> when using it with auto.
Amimoller Posted - Dec 18 2020 : 03:49:06 AM
You are right, it does seem to work pretty well on non-template code. I guess the problem is that most of the places we want to use it in Unreal is templated functions. Mostly Cast and FindComponent and its variations.
feline Posted - Dec 17 2020 : 09:34:09 AM
In general VA's auto handing should work well, but VA can struggle with template code, since templates are instanciated at compile time, and VA does not get to compile the code. Currently auto does not correctly work out the return type from template functions, which is an open bug report. It's possible the same bug is showing up here.

casting should work correctly, but "Cast" is an unreal engine specific function, and is thus different to "normal" casts.

One place auto does work well in my experience is STL style iterators, which tend to have very long types to write out manually. But I don't know how much of this you will be doing in Unreal Engine.

If you place the caret into "Cast" what are you seeing in VA's context and definition fields? For the simple test code:

ACharacter *simpleCharacter;
APawn* pBaseClass = simpleCharacter;
auto characterCast = Cast<ACharacter>(pBaseClass);

I am seeing:

context field = ACharacter
definition field = class ENGINE_API ACharacter : public APawn{...}

which is not right.
Amimoller Posted - Dec 16 2020 : 2:49:00 PM
So i tried again, the options you mention where already turned on.

for the case
auto* component = FindComponent...
The listbox items do not have the tomatoe icon and probably come from intellisense

I tried another common case which is Cast<>
auto component = Cast<USomeComponent>(Component);
Here . to -> doesnt work, not even with auto*
But here it does show the correct listbox.

If i manually type -> then it uses the Intellisense suggestions.
Weird that its not the same as FindComponent.
Ill try some more cases, but i have yet to find any use of auto that seems to work correctly.

feline Posted - Dec 16 2020 : 1:58:15 PM
So far I cannot reproduce the second problem, "List non-inherited entries first".

Either I cannot get a listbox to appear on the auto variable, or when using a temporary variable to "fix" the auto variable then the order of the items in the listbox works correctly for me.

Can you please turn On:

VA Options -> Floating Buttons and Icons -> Denote content from Visual Assist with tomato icons

and see if you get any tomato icons in the listbox when you get this listbox that isn't ordered correctly? I am wondering if the listbox is coming from the IDE instead of from VA, but that still doesn't explain the lack of ordering.

Does the "List non-inherited entries first" work in other listboxes for you?

If you turn On:

VA Options -> Enhanced Listboxes -> Bold non-inherited members

are you seeing any bold entries in the listbox?
feline Posted - Dec 16 2020 : 1:23:23 PM
I have put in a bug report for auto not working out the return type of FindComponentByClass<>()

feline Posted - Dec 16 2020 : 12:42:46 PM
I am still looking, since something odd is going on here, but I have discovered a partial work around, if you are interested. Consider the very simple code example:

ACharacter *simpleCharacter;
auto autoLocal = simpleCharacter->FindComponentByClass<ULightComponentBase>();
autoLocal; // bug seen on this line

go to where the variable "autoLocal" is declared, place the caret into this variable name, and trigger the VA refactoring command "Introduce Variable". You will be prompted for a new variable name, I used "tempByClass" and VA turns this into the code:

ACharacter *simpleCharacter;
ULightComponentBase* tempByClass = simpleCharacter->FindComponentByClass<ULightComponentBase>();
auto autoLocal = tempByClass;
autoLocal; // variable now handled correctly

so you get VA to add the inbetween line that lets VA correctly understand the auto variable. This does make the auto variable redundant, but since you are just adding in a "clearer" definition of the auto variable, the following code that uses the auto variable remains unchanged.
feline Posted - Dec 16 2020 : 06:42:47 AM
I am definitely seeing some problems with auto and "FindComponentByClass" here. Do you only see this problem with template functions, or more generally?

© 2019 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000