Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 UE4 auto complete adds text

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
playdeadjakob Posted - Jun 14 2021 : 06:34:42 AM
This may be a setting in Visual Studio I cannot find, but here goes anyway.

It happens everywhere, but an example that happens all the time is in Slate.
I type

autocomplete suggest TextFlowDirection

I type ( to complete my .Text(

it auto-inserts TextFlowDirection( instead of keeping it as Text(, which is what I typed.

I have only complete on tab and enter enabled and not on any other character.

Do you have any suggestions for how to fix this?

12   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Aug 13 2021 : 12:45:46 PM
Remember that VA does not attempt to expand / understand all of the macros it comes across. We want to help you edit the file "as is", not as it becomes after all of the macros in the code have been expanded, which can significantly change the code.

UE seems to have some quite complex macros, so this is already a significant step. But also remember that the UE build process generates extra code files, that are then compiled normally, so we are not actually "seeing" all of the code.

I got a simple test case working outside of UE, but my test case is running into VA's attempts to understand and handle UE, which complicates matters somewhat. Plus my test case would basically hard code the extra members that Slate classes gained, which isn't ideal.

I have put this feature request in, to see what our developers make of this. It's not that simple a change though, so it may take a while to have a look at this.

playdeadjakob Posted - Aug 12 2021 : 06:13:35 AM
Sounds like it would work in theory, but if it doesn't work with Unreal maybe there is a deeper part of the macro expansion we have not found.
feline Posted - Jul 14 2021 : 11:07:44 AM
Apologies for the slow reply, I have been studying other problems.

Trying to make sense of Slate by following the macros and types isn't getting me very far, but I have worked out an idea. Can you please look at this, and see if it makes sense, and would it help?

I am starting with the class "SButton", where the class declaration contains multiple Slate entries, for example:

SLATE_ARGUMENT( EHorizontalAlignment, HAlign )
SLATE_EVENT( FOnClicked, OnClicked )
SLATE_ATTRIBUTE( FVector2D, DesiredSizeScale )

but these "items" are not class members of SButton. There is no mention of "HAlign" on this page:


So, if VA believes that SNew(SButton) returned the new type:

class VASlateWidget<SButton> : public SButton { }

where the new type VASlateWidget both inherited all of the SButton members, but also gained the SLATE_ARGUMENT members, would this help?

Given that when using SNew(SButton) the function calls are "chained", what if VA was told that each member of VASlateWidget<SButton> returned VASlateWidget<SButton> so that you could call all of the members on each return type as well.

Assuming this would be a helpful work around, should we pick up all of the SLATE_ macros in the class declaration?

Does this even make sense?

I have tried to get VA to do some of this with macros, and while I can make it work in simple test cases, it doesn't work with Unreal Engine.
playdeadjakob Posted - Jun 21 2021 : 04:16:01 AM
The argument defined after BEGIN_SLATE_ARGUMENT goes into the SMyWidget::FArguments.
The Text argument defined by SLATE_ATTRIBUTE( FText, Text) become Arg._Text.
playdeadjakob Posted - Jun 18 2021 : 04:47:59 AM
Slate is template macro hell with operator overload galore sprinkled on for good meassure.
I definitely understand why VA can't pick up everything from Slate.
I wont say I understand the very inner workings of it, but I can use it and know how to write my own widgets.
Would it make sense to set up a call where I go through some of it?

feline Posted - Jun 17 2021 : 1:52:16 PM
VA can struggle with complex macro code, since we are working with the code as you edit it, not the code that has all of the macros expanded, that the compiler gets, after the pre-processor step. So, since Unreal Engine makes heavy use of complex macros, this makes it hard for us, so we have made various improvements to VA to better understand and support Unreal Engine, but apparently not many to handle Slate, so far.

I don't have any simple Slate examples in hand yet, so I just did a find in files across Unreal Engine its self. I am currently looking at the files:


in Unreal Engine 4.26.

There are no references to SLATE_BEGIN_ARGS in the cpp file, and only two references in the .h file, in both cases the code is simply passing the parent class name to this macro. So I am not sure what you mean about the arguments that a widget accepts coming from this macro.

Going to line 220, where a SButton is used, and it is calling "Text" on the return of SNew.

VA does not think that SButton contains a Text member, and it is not listed in the UE documentation for SButton either.

Going to the file "SButton.h", this contains a SLATE_BEGIN_ARGS call, but again the only parameter is the class name. It looks like its calling the base class constructor.

The SButton class contains:


which VA is not picking up as a class member. I have got as far as the page:


but I am not yet sure how this fits into the situation.

Once I have a reasonable grasp of what is going on with Slate, I will put together a bug report for VA, to improve our handling of Slate.

Until VA understands which class members are being called here, it won't be able to help with the parameters for the function calls. Any help in understanding all of this would be most welcome
playdeadjakob Posted - Jun 17 2021 : 09:25:29 AM
I know a lot about Slate. I've written an entire asset editor and several debug tools in it.
As I mentioned above, the arguments a widget accepts are the ones defined after SLATE_BEGIN_ARGS.

As I mentioned in my 2nd post, removing the symbol char completions from the options fixed my issue, I now only complete on tab and enter.
I understand that you try to get the IDE to behave as expected, but it was weird to me since I explicitly disabled the option to have chars defined in the IDE do listbox completion.

In any case. Completion works, but Slate widgets don't always pick up their arguments for listboxes.
feline Posted - Jun 16 2021 : 12:59:19 PM
Because we try to extend the IDE, we try to behave "naturally" and as people expect, so respecting some IDE settings, including the settings for which characters complete a listbox, is part of this.

Is your change to the IDE settings for which characters accept a listbox working for now?

I have found code examples inside Unreal Engine showing Slate widgets have the Text() member. So SNew() is "creating" a widget based on the passed type, effectively adding members to the passed type...

Do you know much about Slate? This page helps a little bit:


but when it says "The following arguments are not on every single widget, but they are on most widgets." and then does not seem to give any clue as to the rule for which widgets will get these arguments, not so helpful.
playdeadjakob Posted - Jun 16 2021 : 07:36:19 AM
I have intellisense completely turned off.
It was still completing listbox choices with the characters defined in the IDE. Works when I delete all of them.

I have source as VA.

SNew(xxx) create a new widget of type xxx and returns a reference, which is why you can set different properties on it with .PropName(prop).

I promise you STextBlock has .Text()... it is defined after SLATE_BEGIN_ARGS as an attribute, which means you can set it directly or bind a function to get it.
feline Posted - Jun 14 2021 : 10:06:42 AM
Do you know what effect SNew(xxx) should have on the type passed to it?

It does not seem to be documented directly. I have found out it is a part of the Slate UI framework, and this page talks about it:


but I am not sure what VA should know to do in this situation.
feline Posted - Jun 14 2021 : 08:37:50 AM
Assuming IDE intellisense parser is enabled, the setting you want is:

VA Options -> Enhanced Listboxes -> Source of C/C++ content: Visual Assist OR Default Intellisense

if this is set to "Default Intellisense" then you should get a listbox from the IDE. If this is set to Visual Assist then you get a listbox from VA.

If "Text" is not in the listbox that VA produces then VA is going to want to insert the best match from the listbox.

It looks like "STextBlock::Text" does not exist, so it looks like VA does not properly understand what SNew is doing.
playdeadjakob Posted - Jun 14 2021 : 07:34:58 AM
Finally found it.
I needed to enable intellisense, delete the symbol completion and disable it again.
So it uses the autocomplete symbols even when I have it turned off in VA.

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