Improved Matching for the File Palette (cmd-T or cmd-P)


The File Palette (opened with cmd-T or cmd-P) is really essential, however, the matching algorhytm is often falling short because it doesn’t honor a simple detail:

In a typical Rails app, similar file name exists in different places. For instance a model app/models/project.rb and the controller app/controllers/project_controller.rb. Say I want to open the model and therefore type “mproj” into the file palette, here are the top hits:

The file you’re looking for comes way down in the list.

There are at least two ways to improve this:

  • Give matching letters and letter sequences which follow a / or the beginning of the path a higher score. (This would push the model and the spec to the top already.)
  • Save stats of the files most often opened in a project and push those to the top of the search results. (This would most likely push the model to the top and the migrations beginning with the timestamps to the very bottom.)

What do you think?


I did some poking around and the matching logic is in the fuzzaldrin node package. Perhaps you could take a look and give suggestions on how it could be improved?