Functions usages are not found in string literals
In our PHP project we use mechanism in which string literals can be parsed and resolved to function or static method. I wrote a plugin for navigation from literal to source function/method in PHPStorm. I see that `find usages` function use my implementation of PsiReferenceProvider to find usages in sting literals and it works fine for static methods but it doesn't work for functions. I debugged, but I cannot figure out why. Could you please give me a clue why it is so? Is functions some special case?
请先登录再写评论。
Looks like I need some additional information. Could you, please, share your implementation of PsiReferenceProvider?
My implementation of PsiReferenceProvider:
PsiReferenceProvider implementation does not matter, - the thing is that debugger does not even step into CoPsiReferenceProvider#getReferencesByElement method when searching function usages!
That looks suspicious. Please, try to invalidate caches on a project you testing your code. If no luck please send me your implementation of PsiReferenceContributor
Invalidating caches doesn't help. My PhpReferenceContributor#registerReferenceProviders is quite simple:
Still it's unclear for me what's the reason of the problem. Please, if it's possible upload an archive with your plugin to https://uploads.services.jetbrains.com/ and leave a file name in comment
The problem might be in word scanner which IDE is using for finding usages.
At first it split all project files into words. Then this word index is used for filtering out the files that can contain usages.
If the string literal's text doesn't match the function name, the file containing your reference can be rejected at this step.