Sublime Forum

How to approach custom "find in files"

#1

Speeding up Sublime’s “find in files” functionality would be grand. Doing project-wide searches in our project (~15k C# files) takes a non-trivial amount of time, and I’ve gotten in the habit of using ripgrep from a terminal to work around that (which is very clunky).

When this has been brought up in the past, the general feedback seems to be “write a plugin to call ripgrep”. This is doable, but the current API exposed through Sublime doesn’t allow for displaying a widget with options like the built-in “find in files” panel, which makes it difficult to write something useful and integrated.

My gut says to post a wish asking for access to the state of Sublime’s “find in files” panel, with the ability to get notified when someone clicks the “Find” button (and avoid asking for "let us create fully custom UIs with Sublime’s UI toolkit, which seems unlikely). However, is there a better way to go about this, so I can get fast searching?

0 Likes

#2

Add an API to get the current state of the Find panel buttons. · Issue #5072 · sublimehq/sublime_text

This may be possible already - I suggest to start by checking which command is logged (if any) when pressing Enter / clicking on the button, and then in plugin code, re-writing which command is used to your own custom one using an EventListener.

0 Likes