[wingide-users] Feature request: contextual search or "close to" search operator

Yarko Tymciurak yarkot at uchicago.edu
Thu Oct 17 13:09:30 MDT 2013


On Oct 17, 2013, at 12:41 PM, Wingware Support <support at wingware.com> wrote:

> Anthony Floyd wrote:
>> Something I'd love to see in Wing: contextual search.
>> 
>> Often I'll want to search for Term A but only when it's within the
>> same line or n lines of Term B. Sort of like a "close to" operator.
>> 
>> Our main codebase is nearing 300k lines of Python, and keeping track
>> of where everything is has become challenging. But sometimes a "Search
>> in Files" returns way too many hits. A contextual search would go a
>> long way in helping.
> 
> It's not quite the same thing but in Wing 5 you can create a File Set from the set of files in the Search in Files result area, using the Name Result File Set item in the Options menu, then do another search on that file set by selecting it from the Look In menu. So "close to" is defined as "in the same file", which may not be fine grained enough, but I thought it might help in some cases.


Just sharing the thoughts this triggered as I read this:

Two things reminiscent:

  - xpath selectors, or perhaps even more:  cssselectors;
  - unified diff contexts (the ability to set the window size);

It occurs that the externally maintained and referenced "tree" (thinking in XML terms) Stephan referred to is file-space.

W/o parsing to accomplish something like cssselector specificity  (i.e. "only find "foo" in function contexts"),
but keeping w/ the concept of trees and the simplicity of unified diff windows, I could imagine some not-too-complicated
plugin to hold a list of the last search nodes (file:line), and applying a "Line Set" result, similar to the File Set result
capture, and then performing a search within a window (line) size of that (referable a +/- set, e.g. a window of +/-10 is
(+10, -10), so you can imagine (+10, -0) as well).

It seems like you'd need:

- a search-result list held somewhere;
- a way to limit search across files to line numbers;
- a way to specify a search with the first list, calculated as a range by the window.

Seems conceptually doable (and I think, as I think of it, I like it - though I wonder how useful it would be in practice,
over the "File Set" model).   Also - thinking back to cssselectors - I can imagine a plugin that lets you do several levels,
sequentially, so you could accomplish the cssselctor-like equivalent of   "foo > bar(-0,+30) > what_I_want", where
no window implies file-sized window.

Fun concept!

> 
> -- 
> Stephan Deibel
> Wingware | Python IDE
> Advancing Software Development
> 
> www.wingware.com
> _________________________________________________
> Wing IDE users list
> http://wingware.com/lists/wingide



More information about the wingide-users mailing list