-
Notifications
You must be signed in to change notification settings - Fork 14
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
feat(goto): Navigate between test and implementation #53
Conversation
9a534ec
to
ac7c6d3
Compare
Hi @BertvanHoekelen, could I get you to test out if this works and satisfies your issue? install it manually using |
ac7c6d3
to
f1b63ac
Compare
Hey @adelf, could I get you to review the indexer? First time creating one, so would like to know if I made any huge mistakes 😄 |
Hi, @olivernybroe . This index is too greedy. It will try to find pest test functions inside every php file during indexing. Better to add at least some filter, for example file path should include "/tests/" part... it can be implemented in InputFilter. I can add it later today. |
@adelf Ah nice. Yes that makes a lot of sense. So getting directories marked as test and only look at them? Looking a little on how fun PsiFile.isPestTestFile(): Boolean {
if (this !is PhpFile) return false
return PsiTreeUtil.findChildrenOfType(this, FunctionReferenceImpl::class.java)
.any(FunctionReferenceImpl::isPestTestFunction)
} So it basically fetches all FunctionReferences and then checks if one of them is a pest test functions. I was thinking if we could somehow check this with an iterator/tree traverser so it on each FunctionReference checks if they are a pest function and stops if that is true. This way it won't have to traverse the whole tree first and then check each element, but can stop earlier in checking the tree, if it hits a pest test early on. Just now sure how to implement that 😟 |
Fixed. Index tests shouldn't try to find a virtual file in the list. Just the key value in the key list. |
…est-finder � Conflicts: � CHANGELOG.md
@adelf I updated It looks if the path contains any test folders, e.g. so it can match
It then also checks all test source folders, so if users have some special setup where the test folder is not called test, but is marked as test, it still works. Do you see any issues with this? |
Hi @olivernybroe, I have just installed the alpha and it works like a charm 🎉 Thanks! |
@BertvanHoekelen Awesome! Thanks for testing it out. We will fix some performance issues with it and then I think we will release a new version of the plugin where this feature will be part of it. |
https://github.com/pestphp/pest-intellij/blob/master/src/main/kotlin/com/pestphp/pest/PestTestFileUtil.kt#L36 here I find all
Will be found, but
this one won't. So, I check only first level of the tree, which of course much faster. If it's ok, we can use the same for |
@adelf Ah that's brilliant! Should help a lot with indexing on big files which are not pest tests. If people have tests which are wrapped in if statements of something like that, then I am okay with not supporting it. |
@adelf I'll merge this in and make a EAP release for I think i'll make the Btw. thanks a lot on the help with how to create indexers |
This PR adds support for navigating between a test and it's implementation.
CHANGELOG.md
issues: #34