The main project I work on has a pattern where code that flows from C++ to ObjC (and vice versa) will have the same function name to make it easier to search through code. As an example, there could be a void Class::foo(int bar) in C++ and - (void)foo:(int)bar in ObjC. In order to fully find all callsites of any variant of foo in the code I’d often “Find in Files…” twice in rapid succession, once for .foo( (and/or ->foo() and once for foo: (with a leading space). In order to do this I also had a very small local plugin that caused each “Find in Files…” to create a new tab:
import re
import sublime
import sublime_plugin
s_views = []
def s_updateViewName(view):
contents = view.substr(sublime.Region(0, view.size()))
contents = contents.replace("\n", "\\n")
match = re.search("^Searching \d+ files for \"(.*)\"(?:\s|\\\\n|$)", contents)
if match:
view.set_name("Find Results (\"" + match.group(1) + "\")")
else:
view.set_name("Find Results (\"\")")
class UniqueFindBufferEventListener(sublime_plugin.EventListener):
def on_activated_async(self, view):
if view.name() != "Find Results":
return
s_updateViewName(view)
s_views.append(view)
def on_modified_async(self, view):
if view not in s_views:
return
s_updateViewName(view)
s_views.remove(view)
After upgrading to ST4 I now see “Cancelled!” in the first find tab. Is there a setting to control this so that starting another “Find in Files…” doesn’t cancel a prior one? This is also problematic in situations like if I realize that my first “Find in Files…” was misspelled, start a new “Find in Files…” with the right spelling, and then close the first tab for the first incorrectly spelled “Find in Files…”.
