Hi Plugin Experts,
I am writing a plugin to integrate ripgrep search into sublime. I have everything working (you can righclick, the seach shows up in a new window, similar to find in files option, only much much faster).
I am using view.setstatus
to set the status message. I also have a 100ms timer that calls my view.setstatus to update status bar animation while workers are still active.
my update_status function looks like this:
def update_status(self, workers, msgStr, showResults, count=0, dir=1):
count = count + dir
found = False
for worker in workers:
if worker.is_alive():
found = True
if count == 7:
dir = -1
elif count == 0:
dir = 1
self.view.set_status("RipGrepSublime", "RipGrep Fetching results for '%s' [%s=%s]" %
(msgStr, ' ' * count, ' ' * (7 - count)))
# StatusBarIndicator.on_activated(self, self.view, "RipGrepSublime", "RipGrep Fetching results for '%s' [%s=%s]" %
# (msgStr, ' ' * count, ' ' * (7 - count)))
sublime.set_timeout(lambda: self.update_status(workers, msgStr, showResults, count, dir), 100)
break
if not found:
self.view.erase_status("RipGrepSublime")
output = ""
if showResults:
for worker in workers:
self.display_results(worker.symbol, worker.output)
I am running into an issue with the status bar message.
When a search is active, the message is visible in the view context, once I change the view, the status bar message is not active anymore. I want the status bar message to be active across views. This way even if you switch views, you can still see if your search is still active. I tried to useeventlistner
, however, I am unable to pass it a parameter (status bar message string). What am I missing?
Thanks in advance
Rajah