HaxeFoundation / HaxeFoundation/haxe
[ide] find references vs hierarchy
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
As we discussed on Slack today, there was misunderstanding regarding the `WithBaseAndDescendants ` setting of the "find references" feature. Consider the following scenario:
```haxe
class Base {
public function method() {}
}
class Child1 extends Base {
override function method() {
}
}
class Child2 extends Base {
override function method() {
}
}
function main() {
(null : Base).method();
(null : Child1).method();
(null : Child2).method();
}
```
Finding references of any of the defined `method` will currently always yield all three usages, which corresponds to "find usages of the base method" functionality found in e.g. IDEA. Also that seems to be the behaviour of VS Code for TypeScript, however...
However, this is not what we always want when searching for usages. Usually, the intention is to find _all potential usages_ of **this** method, not its parent method. In other words, if we search for usages of `Child1.method`, the result should only include `(null : Base).method()` and `(null : Child1).method()`, because `(null : Child2).method()` is NEVER an usage of `Child1.method`.
I think what we really want for IDEs here is just two variants:
- find usages of _base_ method: search the whole inheritance tree, the current `WithBaseAndDescendants` behaviour.
- find usages of _this_ method: search this class, the subtree of its children and usages of parent methods up in the inheritance chain excluding all other parent's children
Contributor guide
Assessment
This issue has not been assessed yet.