[wingide-users] Fwd: Doing "Find Uses" and Search and Replace all at once

Wingware Support support at wingware.com
Tue Feb 14 13:50:25 MST 2012

On 2/14/12 3:32 PM, clif edwards wrote:
> I just use file search/replace with a hot key for each and forget the
> refactoring tool

I find refactoring preferable most of the time since you can rename one 
particular symbol that might be named the same as many other symbols in 
the source base.  Find Uses has the same advantage.

To address Ken's original request:  You could use the following script 
to kick off both types of search at once:

import wingapi

def find_uses_and_search():
     app = wingapi.gApplication

find_uses_and_search.contexts = (wingapi.kContextEditor(), )

Drop this into a file in the 'scripts' folder in your user settings 
directory (listed 5th in Wing's About box) and use Edit > Reload All 
Scripts.  Then you should have a "Find uses and search" item in the 
editor  context menu:  Select a symbol and then right click and select 
that item.  It's more useful if you have the Search in Files tool and 
Find Uses tools in separate tool areas, of course.

To do the same thing w/ rename refactoring, replace 'batch-search' with 
'rename-symbol' in the above (or define a second command).

You can also bind these to keys with the Keyboard > Custom Key Bindings 
preference, of course.


Stephan Deibel
Wingware | Python IDE
Advancing Software Development


More information about the wingide-users mailing list