S.S.: who can return a Foo?
I'm looking for all the methods that can produce/return a PsiFooBar, but
I can't make it work.
Using S.S., I tried variations around:
$ReturnType$ $MethodName$($Parameter$)
where
$ReturnType$ has 'PsiFooBar' as java expression type (+ look in type
hierarchy)
$MethodName$ has no constraint, but is the search target
$Parameter$ is optional (0..n)
What is wrong here?
Alain
Please sign in to leave a comment.
Hi,
If you search for methods, then add class, like following,
also one needs to specify both parameter name and type
class $SomeClass$ {
$ReturnType$ $MethodName$($ParameterType$ $Parameter$);
}
also $ParameterType$ is optional (0..n)
Alain Ravet wrote:
--
Maxim Mossienko
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Maxim
>
>
I had already tried that (but I retried with your example, to no avail).
I made a small project around 2 classes:
public class FoeFactory
{
public Foo makeFoe() { return null; } <<------- what I'm
looking for
}
public class Foo {
}
I can't find a way for S.S. to find "makeFoe"
Alain
Alain, the easiest way (usually the only one) that works for me is to copy an existing
template, in your case class based -> methods of the class, and modify the variable
assignments to fit what I need. S.S. is IMHO too unintuitive to write a search template
from scratch.
I guess that's the problem here. Don't enter the type under "Expression constraints" but
under "Text constraints".
HTH,
Sascha
>
That's what I did, after reading the help file from top to bottom.
>>$ReturnType$ has 'PsiFooBar' as java expression type (+ look in type hierarchy)
>>
>>
>
>I guess that's the problem here. Don't enter the type under "Expression constraints" but
>under "Text constraints".
>
It looks right, but it didn't help in this case: see the screencopies
here under:
What's wrong here?
Attachment(s):
SS_0_.png
SS_1.png
SS_2.png
SS_3.png
SS_4.png
Hi,
Remove Foo text from java expression type constraint.
Alain Ravet wrote:
>> the easiest way (usually the only one) that works for me is to copy an existing template
>>
>>>$ReturnType$ has 'PsiFooBar' as java expression type (+ look in type hierarchy)
>>>
>>>
>>
>>I guess that's the problem here. Don't enter the type under "Expression constraints" but
>>under "Text constraints".
>>
>>
--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"
Maxim
>
It helped a lot, thanks.
After that, I replaced 'Foo' by 'PsiNonJavaFileReferenceProcessor', but
this time the same search found nothing (scope = project and libraries).
(I need one for
.. = searchHelper.processUsagesInNonJavaFiles(qName,
pnjfRefProcessor,scope);
)
What did I miss here?
Alain
Hi,
Ensure that your libs have attached sources and you can navigate from
PsiNonJavaFileReferenceProcessor to at least one of its descendants.
Alain Ravet wrote:
>> Remove Foo text from java expression type constraint.
>>
--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"
Maxim
>
The source is correctly attached (Ctrl-B opens
PsiNonJavaFileReferenceProcessor.java, and not decompiled code)
, but
>
A extensive FindUsage (all 7 options selected + scope = Project and
Library) on PsiNonJavaFileReferenceProcessor only returned 1 usage, as a
parameter type, in the very method I need it for:
PsiSearchHelper.processUsagesInNonJavaFiles (..)
Maybe it's time I asked for the fish: how can I obtain a
PsiNonJavaFileReferenceProcessor?
Alain
Alain Ravet wrote:
You gotta make your own ;)
Sascha
Hi,
Indeed, there are no methods that returns
PsiNonJavaFileReferenceProcessor or descendants.
Alain Ravet wrote:
>>
>> Ensure that your libs have attached sources and you can navigate from
>> PsiNonJavaFileReferenceProcessor to at least one of its descendants.
>>
--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"