Stian Grytøyr 7 years ago • updated by Jon Skinner 7 years ago 6
Introduce a touch of filename bias in the code that produces the Goto File/Anything result lists, maybe with an even stronger bias for matches at the beginning of word parts in the filename.

If I type "app con" in the Goto File overlay, I get the following matches:

* priorities_controller.rb
* projects_controller.rb
* accounts_controller.rb
* application_controller.rb
* ...

The first three match because the path is .../app/controllers/..., but I think most people would like to see "application_controller.rb" at the top of the list if they type in "app con".
These signals, and more, are taken into account in the cost function: you can see this when filtering with a shorter string, such as 'app', or 'appc', which ranks application_controller first, as it should.

The issue you're seeing is that there are many ways to match 'appcon' against 'app/controllers/application_controller.rb', and the ranking function is giving up before finding the best way. I'll increase the number of iterations it's willing to do before giving up, which will fix the problem on in this instance.

Many thanks for this report, by the way: In the test cases I've got here, the ranking gives better results than any other similar systems, and as much as possible, I'd like to keep it that way.
My pleasure. Thanks for the thorough explanation and, of course, for the upcoming fix.
I've solved this by using something like "/app con".
I support that could work, but the "/" is somewhat difficult to type on my Norwegian keyboard, so I’m very pleased that Jon will address this. The Goto File/Anything overlays are, at least to me, a crucial part of the editor.
Here is another example where I feel it would be more natural if the order was reversed, since the text I have typed so far perfectly matches the start of the filename of the second file in the list: http://dl.dropbox.com/u/326491/st2_filename_matching.png

The expanded paths for the matches are as follow:

* ./db/migrate/20101012195957_add_netaxept_fields_to_accounts.rb
* ./vendor/plugins/active_merchant/lib/active_merchant/billing/gateways/netaxept.rb.

I guess this might also be fixed by the change you mentioned in your earlier comment - I just thought I’d mention it.
Actually, if I just type in "neta", 'netaxept.rb' isn’t even in the visible part of the result list, but 'unclosed tag.sublime-snippet' is in fourth place with no "word-part-start" matches, all characters are matched in the middle of the filename - the 'n' and 'e' in 'unclosed' etc.