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
 Feature Requests
 Feature: Hide Super::Stuff from find references
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Zeblote
Tomato Guru

183 Posts

Posted - Sep 24 2018 :  10:21:30 PM  Show Profile  Reply with Quote
Find references has a setting to turn off showing all the overrides:





Unfortunately all the Super:: spam remains:



It'd be really useful if these were also hidden if that setting is used.

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Sep 25 2018 :  11:07:12 AM  Show Profile  Reply with Quote
In the Find References Results window have you considered right clicking and turning Off:

Display unknown/guess hits

this will remove these lines, since they all have the question mark telling us that VA isn't sure what is going on here.

I am thinking of this approach since filtering these results out when you turn off "Display inherited and overridden references" is technically wrong, since VA does not know what these results are. So you might want to see inherited results, but still filter out the Super results that VA is confused by.

I am hoping to avoid a feature request asking for a separate setting just for the Super lines.

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

Zeblote
Tomato Guru

183 Posts

Posted - Sep 25 2018 :  11:14:55 AM  Show Profile  Reply with Quote
I tried that setting, it only hides about half of the super calls though.

I'm thinking this could be a special case for unreal engine, which is why I posted it in this forum - something using Super::Method() is always a call to the parent method here, so it'd be fine to remove them if overriden references is off. It can't be anything else since nothing else would use Super:: in that way and having an actual class called Super isn't allowed.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Sep 25 2018 :  11:56:59 AM  Show Profile  Reply with Quote
That's not what I am seeing.

OK, I am testing VS2017 with VA 2283.2 (about to upgrade on this machine), and I am testing in the sample RPG game project that I have downloaded for Unreal Engine. I am using the "default" engine that I got via the Epic Games launcher, version 4.20.3

In a cpp file I have added the test code:

FComponentVisualizer visualTestFind;
visualTestFind.OnRegister();


when I run Find References on this "OnRegister" call I get 41 references (+4 hidden) in 39 files. This is with guess / unknown results being shown.

Turning off showing guess / unknown results reduces the result list to 9 references (36 hidden) in 9 files.

Just to double check I am not missing something obvious, with keyboard focus in the Find References Results window I have used Ctrl-F, for the find inside the results window dialog, and done a search for "super". No references are being found.

Can you post a screen shot of some of the non guess super results you are seeing?

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

Zeblote
Tomato Guru

183 Posts

Posted - Sep 25 2018 :  12:10:46 PM  Show Profile  Reply with Quote
That's a different OnRegister, I tested it with UActorComponent::OnRegister

It isn't really a major problem at all, since there are very few super calls left after filtering overriden and guess hits, but there still are some:



Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Sep 28 2018 :  08:01:01 AM  Show Profile  Reply with Quote
I am getting a rather different list of results when doing the Find References on

UActorComponent::OnRegister;

and so far, all of the results I have checked out actually make sense. I will re-test this once I have the github version of Unreal Engine downloaded and behaving its self, perhaps that is a factor.

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

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Oct 02 2018 :  10:57:10 AM  Show Profile  Reply with Quote
I am now testing this on the Github source build version of Unreal Engine, as described in the thread about array access:

https://forums.wholetomato.com/forum/topic.asp?TOPIC_ID=15226&whichpage=2

I am now seeing the same 10 results you are listing when doing a Find References on:

UActorComponent::OnRegister();

taking just the first Super reference, which is the code:

void UScriptContextComponent::OnRegister()
{
    Super::OnRegister();
    // rest of body here...
}

using Alt-Shift-G on the class name "UScriptContextComponent" to see what the base class is, VA is telling me that the base class is "UActorComponent", so the function call is actually:

UActorComponent::OnRegister();

the very thing we are doing the Find References on. Are you seeing any references where this is not the case? Filtering out these results seems a bit counter productive, since they are direct calls, just from a derived class. If you need to filter them out, can you explain why? Also, would the same logic apply to the explicit call:

UActorComponent::OnRegister();

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

Zeblote
Tomato Guru

183 Posts

Posted - Oct 02 2018 :  11:12:35 AM  Show Profile  Reply with Quote
> Filtering out these results seems a bit counter productive, since they are direct calls, just from a derived class

Hmm, not exactly. They're just calls to the parent method from within the method I'm already at. I mostly use find references on methods to figure out what else in the engine calls it, so having all the entries inside overrides in there is not really helpful with that. If I wanted to find the overrides I'd use Related -> Derived Symbols instead.


> Also, would the same logic apply to the explicit call:

That's a good question, I'm not sure. That type of parent call is rarely used in unreal, but that would make it more general instead of being unreal specific, something like "Hide all parent calls"
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Oct 02 2018 :  3:50:45 PM  Show Profile  Reply with Quote
I don't understand what you mean by calls to the parent method from within the method you are already at.

Sitting in the file "MyProjectCharacter.cpp", which is part of the game project, not the Unreal Engine its self, I have added the line of code:

AMyProjectCharacter::AMyProjectCharacter()
{
    // find references and returned references test for forum thread
    // https://forums.wholetomato.com/forum/topic.asp?TOPIC_ID=16400
    UActorComponent::OnRegister();

    // rest of method...
}

I trigger Find References on the "OnRegister" function call.

The first result in the Find References Results window is for the game project, the result where I triggered the find.

The next result is inside the engine, and it is:

C:\src_github\UnrealEngine\Engine\Plugins\ScriptPlugin\Source\ScriptPlugin\Private\ScriptContextComponent.cpp
	Super::OnRegister();

when I go to this result, and study the code, this is a direct call to the function "OnRegister()" in the Super class of "UScriptContextComponent", which makes it a call to "UActorComponent::OnRegister()"

Which is what VA has been asked to find.

There are no overrides at work here, this is a direct call to the function and class in question. Or am I approaching this from the wrong point of view?

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

Zeblote
Tomato Guru

183 Posts

Posted - Oct 02 2018 :  6:10:48 PM  Show Profile  Reply with Quote
> Or am I approaching this from the wrong point of view?

Hmm, I think so. Maybe I'm describing it badly. I'm not asking about removing all calls to the function, but explicitly the overrides and parent calls only.

Example code:


class A
{
public:
	virtual void Blah()
	{

	}

	void Stuff1()
	{
		Blah();
	}
};

class B : public A
{
public:
	virtual void Blah() override
	{
		A::Blah();
	}

	void Stuff2()
	{
		A::Blah();
		Blah();
	}
};


Default find references on A::Blah():



Makes sense so far.

Now if I turn off inherited references:



It's currently showing me these:



But for exploring unreal, that's somewhat... inconvenient. I basically want a mode that shows me these instead:



Not sure how feasible this is since it would have to detect which of the calls are parent calls from inside overrides and which aren't.

Edited by - Zeblote on Oct 02 2018 6:12:35 PM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Oct 03 2018 :  08:17:36 AM  Show Profile  Reply with Quote
This isn't how Find References is designed to think at all. Here you are trying to filter on surrounding context. Plus, consider B::Blah(), yes, this is calling the parent function, but in some of the Unreal Engine examples I have found, there is further code after this call to the parent.

So, if we assume that both functions in class B do something else, then I really don't see the real difference here.

Have you tried right clicking in the Find References Results list and turning on "Line Numbers (requires refresh)"? Along with line numbers this will also show you the name of the calling method, giving you some context information. It isn't going to tell you everything, but it should help.

Also, are you aware that you can delete results from the Find References Results list by pressing Del with the result you want to remove highlighted? Combined with being able to clone the results list, to keep it on hand while doing another Find References this lets you keep track of results you are interested in, as you delete the results that are not of interest.

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

Zeblote
Tomato Guru

183 Posts

Posted - Oct 03 2018 :  09:30:17 AM  Show Profile  Reply with Quote
> This isn't how Find References is designed to think at all.

I see, if this isn't a simple change then it's definitely not worth it just to get rid of a few parent calls.


> turning on "Line Numbers
> delete results
> clone the results list

Wasn't aware of any of these things! Those will be useful in the future.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Oct 03 2018 :  2:34:14 PM  Show Profile  Reply with Quote
There are quite a few features tucked away in VA, if you know where to look for them Have you tried Ctrl-F with the focus in the Find References Results list yet?

Also, if you want to "extract" the results to work on them in an editor, Ctrl-C copies the current node and all of its children to the clipboard as text.

Both sometimes very useful, especially if you are using Find References a lot.

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