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

10 comments
Comment actions Permalink

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:

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



--
Maxim Mossienko
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Maxim

>

class $SomeClass$ {
$ReturnType$ $MethodName$($ParameterType$ $Parameter$);
}
also $ParameterType$ is optional (0..n)

>

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

0
Comment actions Permalink

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.

$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".

HTH,
Sascha

0
Comment actions Permalink

the easiest way (usually the only one) that works for me is to copy an existing template

>

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
0
Comment actions Permalink

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
>>


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?



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink

Maxim

Remove Foo text from java expression type constraint.

>

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

0
Comment actions Permalink

Hi,

Ensure that your libs have attached sources and you can navigate from
PsiNonJavaFileReferenceProcessor to at least one of its descendants.

Alain Ravet wrote:

Maxim

>> Remove Foo text from java expression type constraint.
>>


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



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink

Maxim

>

Ensure that your libs have attached sources and you can navigate from


The source is correctly attached (Ctrl-B opens
PsiNonJavaFileReferenceProcessor.java, and not decompiled code)



, but

PsiNonJavaFileReferenceProcessor to at least one of its descendants.

>


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

0
Comment actions Permalink

Alain Ravet wrote:

Maybe it's time I asked for the fish: how can I obtain a
PsiNonJavaFileReferenceProcessor?


You gotta make your own ;)

Sascha

0
Comment actions Permalink

Hi,

Indeed, there are no methods that returns
PsiNonJavaFileReferenceProcessor or descendants.

Alain Ravet wrote:

Maxim

>>
>> Ensure that your libs have attached sources and you can navigate from


The source is correctly attached (Ctrl-B opens
PsiNonJavaFileReferenceProcessor.java, and not decompiled code)



, but

>> PsiNonJavaFileReferenceProcessor to at least one of its descendants.
>>


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



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

Please sign in to leave a comment.