-
-
Notifications
You must be signed in to change notification settings - Fork 648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Find references of the base field or include descendant fields #9315
Find references of the base field or include descendant fields #9315
Conversation
Shouldn't these be some sort of flags on the |
Is there performance difference between these methods? Because I'm wondering if we should just always return everything and let IDEs figure out what to show. E.g. I imagine it would be nice to only ask user whether they want override usages if there are any overrides in the first place (not that VSCode supports asking anyway though). |
Well, for that the IDE would still need some metadata for each reference regarding whether it's a base reference or not. I imagined it could work the other way around, with the IDE providing a parameter that indicates whether or not to include descendants (could be a vshaxe setting). |
| TClassDecl c :: _ when c.cl_path = cl_path -> c | ||
| _ :: types -> loop types | ||
in | ||
loop com.types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a particular reason we store the class' path and then dig it up here, instead of just storing the tclass
reference itself like we usually do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
tclass
instances are not physically equal at this moment and at the moment of find_references
invocation.
Maybe that's a bug, but I didn't investigate that.
Yes. These methods perform as many reference searches as the amount of descendant methods in hierarchy. And now I realized this could be done in one search :) Will update later. |
Changed to a parameter for |
Hm, having three kinds confuses me a bit. What exactly is the "old behavior" right now / "normal"? |
It finds only "direct" references. No parent or overridden methods. |
Right... Not sure
So, not really "instead" if it finds references to the requested one after all? :) I wonder if two boolean flags would work better? typedef FindReferencesParams = {
var ?includeBase:Bool;
var ?includeDescendants:Bool;
} Though I'm not sure if we would even want to expose the second as a setting, I think IntelliJ only lets you chose between base fields or not? |
I've changed wording: /**
Find only direct references to the requested symbol.
Does not look for references to parent or overriding methods.
**/
var Direct = "direct";
/**
Find references to the base field and all the overriding fields in the inheritance chain.
**/
var Base = "base";
/**
Find references to the requested field and references to all
descendants of the requested field.
**/
var Descendants = "descendants";
I don't think so. There's actually no practical sence in this combination:
|
Technically these are |
Changed to |
@Simn are you ok with this PR? |
Yes, except for the |
I wonder if we should think ahead a bit and name it Or perhaps "Find References" makes sense for rename anyway too? |
I'm still not 100% convinced that we need all these settings in practice, but if we do then we should be consistent and also make "find implementations" configurable like that. Because right now when searching for implementations of an interface we also get indirect implementations. |
That sounds more like a property for each reference found. |
Based on my experience with a big Haxe project development in IDEA I'm 100% sure these settings are useful in practice :) |
This reverts commit d8e3781.
HL failure is not related |
Closes #9044
Closes #9139 (using
withDescendants
kind; see below)This PR adds optional
kind
parameter to thedisplay/references
request:"direct"
- old behavior"withBaseAndDescendants'
- find references to the base field instead of the requested one. Also finds references to all descendants of the base field."withDescendants"
- find references to the requested field and references to all descendants of the requested field.It is possible to use this parameter with command line requests: