You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
goto-definition for interface implementations #698
When working with interfaces, you might be tempted to use goto-definition to look into an implementation of the interface but this currently just gets you to the interface.
It would be nice to have the ability to choose which implementation of the method you want to take a peek at
As a bonus, having only one shortcut handling this smartly (ie open directly when no alternatives) would be nice.
Reacted by Jan Mollowitz, Javi, Victor, Gabriel Borges, Alex Weigl and Yann Rabiller
+1 to find all implementations of an interface, so useful when working on a project you are not familiar with.
The only problem I see here is the time it take to scan a project.
It may only be because we still got the legacy code inside our project but it's always more than 30s to find references in my work project.
So it can be pretty annoying to wait that long when we want to jump to a definition.
Should the feature work only for interface and abstract class ?
Can it be faster to scan only for classes instead of references in all files ?
I guess making a list of all classes that exclude every class not extending or implementing an interface (even with a regex maxbe?) could first improve the performance of the search?
@elythyr Have you considered adding a composer.json using classmap strategy to your legacy project, just for the sake of improving phpactor's performance ?
Should the feature work only for interface and abstract class ?
I don't see why it should, we need to scan all classes in the project anyway.
Can it be faster to scan only for classes instead of references in all files ?
We still need to load and parse all files in the project - but we don't have to analyse them, we only need to check if the implemented interfaces / extended class is a descendant of the requested interface/class (this could be done with WorseReflection, which is lazy and so shouldn't add more overhead than required).
So it should be faster than find all references, which has to basically interpret each file.
(as a note, it would be possible add a cache / database to index these things in the future, which brings it's own problems, but might be a nice option).
Activity
einenlum commentedon Jul 4, 2019
I also need to find the different implementations of an interface in a project. Could be a really nice feature. 👍
camilledejoye commentedon Jul 8, 2019
+1 to find all implementations of an interface, so useful when working on a project you are not familiar with.
The only problem I see here is the time it take to scan a project.
It may only be because we still got the legacy code inside our project but it's always more than 30s to find references in my work project.
So it can be pretty annoying to wait that long when we want to jump to a definition.
Should the feature work only for interface and abstract class ?
Can it be faster to scan only for classes instead of references in all files ?
einenlum commentedon Jul 8, 2019
I guess making a list of all classes that exclude every class not extending or implementing an interface (even with a regex maxbe?) could first improve the performance of the search?
kermorgant commentedon Jul 8, 2019
@elythyr Have you considered adding a composer.json using classmap strategy to your legacy project, just for the sake of improving phpactor's performance ?
dantleech commentedon Jul 8, 2019
I don't see why it should, we need to scan all classes in the project anyway.
We still need to load and parse all files in the project - but we don't have to analyse them, we only need to check if the implemented interfaces / extended class is a descendant of the requested interface/class (this could be done with WorseReflection, which is lazy and so shouldn't add more overhead than required).
So it should be faster than find all references, which has to basically interpret each file.
(as a note, it would be possible add a cache / database to index these things in the future, which brings it's own problems, but might be a nice option).
dantleech commentedon Mar 29, 2020
This is "working" with the https://github.com/phpactor/indexer extension, and will be bundled with the next release. #918
Caveat that automatically indexing code will only work with the LSP integration (although you can index (and watch) the code with a dedicated command)
dantleech commentedon May 3, 2020
This is implemented with the indexer. Support for methods will be added in next release.
einenlum commentedon Jun 18, 2020
I missed that! Thank you so much @dantleech It works so great :)