Open Southhill opened 2 years ago
A few issues here:
references
does not set isDefinition
for the subclass method definitions of destroy
. This means we can't filter these out in the references response
We can't filter out the calls to super.destory()
. This is pretty much the same though as recursive call to destroy
. I think it's the correct behavior for how we understand references
Even if we fixed both of those, we'd still show two references. This is because b.destory
still counts as a reference to a.destory
. I seem to recall that this is a limitation of how we understand references
I'm following up on the details, but internally the language service produces a 3-element list with exactly the results you'd expect for each of Base.destroy, A.destroy and B.destroy. Then the language service flattens all 3 entries instead of returning the entry for A.destroy. I'm not sure why.
For ease of reference, here's a condensed repro:
class Base {
protected destroy() {
return 0;
}
}
class A extends Base {
public destroy(): number {
super.destroy();
return 0;
}
}
class B extends Base {
public destroy(): number {
super.destroy();
return 0;
}
}
(new A).destroy();
(new B).destroy();
Expected: 1 reference to A.destroy Actual: 6 references to A.destroy
Does this issue occur when all extensions are disabled?: Yes
wrong_referencesCodeLens.ts file: https://gist.github.com/Southhill/a89406054990d1ae86fcebf7124d125f
Steps to Reproduce:
A
methoddestroy
only 1 references but 6 references