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
 UE4 auto complete adds text
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

playdeadjakob
Junior Member

Denmark
17 Posts

Posted - Jun 14 2021 :  06:34:42 AM  Show Profile  Reply with Quote
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
SNew(STextBlock).Text

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?



/Jakob

playdeadjakob
Junior Member

Denmark
17 Posts

Posted - Jun 14 2021 :  07:34:58 AM  Show Profile  Reply with Quote
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.


/Jakob
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17335 Posts

Posted - Jun 14 2021 :  08:37:50 AM  Show Profile  Reply with Quote
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.

zen is the art of being at one with the two'ness
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17335 Posts

Posted - Jun 14 2021 :  10:06:42 AM  Show Profile  Reply with Quote
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:

https://docs.unrealengine.com/4.26/en-US/ProgrammingAndScripting/Slate/Architecture/

but I am not sure what VA should know to do in this situation.

zen is the art of being at one with the two'ness
Go to Top of Page

playdeadjakob
Junior Member

Denmark
17 Posts

Posted - Jun 16 2021 :  07:36:19 AM  Show Profile  Reply with Quote
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.


/Jakob
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17335 Posts

Posted - Jun 16 2021 :  12:59:19 PM  Show Profile  Reply with Quote
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:

https://docs.unrealengine.com/4.26/en-US/ProgrammingAndScripting/Slate/Widgets/

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.

zen is the art of being at one with the two'ness
Go to Top of Page

playdeadjakob
Junior Member

Denmark
17 Posts

Posted - Jun 17 2021 :  09:25:29 AM  Show Profile  Reply with Quote
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.


/Jakob

Edited by - playdeadjakob on Jun 17 2021 11:44:03 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17335 Posts

Posted - Jun 17 2021 :  1:52:16 PM  Show Profile  Reply with Quote
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:

SPaperExtractSpritesDialog.h
SPaperExtractSpritesDialog.cpp

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:

SLATE_ATTRIBUTE( FText, Text )

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

https://docs.unrealengine.com/4.26/en-US/API/Runtime/Slate/Widgets/Input/SButton/FArguments/

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

zen is the art of being at one with the two'ness
Go to Top of Page

playdeadjakob
Junior Member

Denmark
17 Posts

Posted - Jun 18 2021 :  04:47:59 AM  Show Profile  Reply with Quote
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?



/Jakob
Go to Top of Page

playdeadjakob
Junior Member

Denmark
17 Posts

Posted - Jun 21 2021 :  04:16:01 AM  Show Profile  Reply with Quote
The argument defined after BEGIN_SLATE_ARGUMENT goes into the SMyWidget::FArguments.
The Text argument defined by SLATE_ATTRIBUTE( FText, Text) become Arg._Text.


/Jakob
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17335 Posts

Posted - Jul 14 2021 :  11:07:44 AM  Show Profile  Reply with Quote
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:

https://docs.unrealengine.com/4.26/en-US/API/Runtime/Slate/Widgets/Input/SButton/

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.

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:
© 2021 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000