I spend most of my time developing flipping back and forth between VS Code and Searchfox. VS Code is a great editor but it has nowhere near the speed needed to do searches over the entire tree, at least on my machine. Searchfox on the other hand is pretty fast. But there’s something missing. I usually want to search Searchfox for something I found in the code. Then I want to get the file I found in Searchfox open in my editor.
Luckily VS Code has a decent extension system that allows you to add new features so I spent some time yesterday evening building an extension to integration some of Searchfox’s functionality into VS Code. With the extension installed you can search Searchfox for something from the code editor or pop open an input box to write your own query. The results show up right in VS Code.
Click on a result in Searchfox and it will open the file in an editor in VS Code, right at the line you wanted to see.
It’s pretty early code so the usual disclaimers apply, expect some bugs and don’t be too surprised if it changes quite a bit in the near-term. You can check out the fairly simple code (rendering the Searchfox page is the hardest part of it) on Github.
If you want to give it a try, install the extension from the VS Code Marketplace or find it by searching for “Searchfox” in VS Code itself. Feel free to file issues for bugs or improvements that would be useful or of course submit pull requests of your own! I’d love to hear if you find it useful.
5 thoughts on “Searchfox in VS Code”
A while ago I wrote a super simple Sublime Text plugin that also allows you to search for definitions with searchfox. https://github.com/evilpie/sublime-searchfox
You could maybe add it to the recommended list in mozilla-central 🙂
Definitely, probably once the extension has had a couple more tweaks made to it.
I literally just wrote a note to myself to explore writing this not two hours ago.
Not that I would have followed through on anything but a glacial timescale. Thanks so much!
You are the best!
Comments are closed.