Is there a way to configure Search to ignore folded code?

Sometimes I work with regions of a class being folded
and only the parts I'm interested in are expanded. I
would like to be able to perform a search for some
text which would honour and not expand any of the currently
folded regions and search only within the visible ones.

Is there a way to do this already? If not, do you folks
think it should be added to the RFE list?

Cheers,

Bonny

6 comments

Bonny Rais wrote:

Sometimes I work with regions of a class being folded
and only the parts I'm interested in are expanded. I
would like to be able to perform a search for some
text which would honour and not expand any of the currently
folded regions and search only within the visible ones.

Is there a way to do this already? If not, do you folks
think it should be added to the RFE list?

Cheers,

Bonny


No, that's not possible and should not be possible IMO since folding is
only presentation factor while search concerns the real text behind.


--
Maxim Shafirov
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

FWIW, I tend to agree with the presentation factor argument. OTOH, one could argue that code folding might be interpreted as more than a presentation factor, i.e. be a way of restricting the scope of certain operations (e.g., searching, code reformatting etc.) Personally, I'm not yet sold on that idea, although I wouln't completely dismiss it either (especially if code folding were more fine grained - I'm contantly missing code folding on if's, for's, while's etc).

0

Maxim, in the event you extend the 'scope' concept to be more
Eclipse-competitive, this may possibly fit that work.
Maybe something like - do not show occurrences in folded regions
(they may be found).

Or, from the other side, the problem seems to be browsing through
the search results (e.g. ctrl-alt-down) that can potentially
uncollapse regions that a user wants to keep collapsed.
Then, it might be just a navigation problem - "don't uncollapse"
option somewhere.

All in all, I think the request is quite valid. I'm sure the code
you Jetbrainers have to deal with is nice and straight - you
wrote it for yourselves. However, here out in wild, it may
be opposite. And hiding some parts is one of ways to stay sane.
(I may as well be talking for my colleagues scared from my own code)

Hope your summer was nice

r.


Maxim Shafirov (JetBrains) wrote:

Bonny Rais wrote:

>> Sometimes I work with regions of a class being folded
>> and only the parts I'm interested in are expanded. I
>> would like to be able to perform a search for some
>> text which would honour and not expand any of the currently
>> folded regions and search only within the visible ones.
>>
>> Is there a way to do this already? If not, do you folks
>> think it should be added to the RFE list?
>>
>> Cheers,
>>
>> Bonny


No, that's not possible and should not be possible IMO since folding is
only presentation factor while search concerns the real text behind.

0

Richard,

Maybe something like - do not show occurrences in folded regions (they may be found).
That's exactly what I had in mind!

Sometimes a common pattern exists in a file and showing
all occurences just adds to the noise since one tends
to work on a particular aspect of the code at any one time.

Also your mention of the 'Uncollapse' option is very
useful since the code is collapsed for a reason, which
I think is not simply presentation - it helps keep clutter
out (for the current task at hand).

Maybe I should indeed try my hand at plug-in. Anybody
knows whether it is possible to chain onto such a built
in functionality like search?

Cheers,

Bonny

0

Please sign in to leave a comment.