≡

wincent.dev

  • Products
  • Blog
  • Wiki
  • Issues
You are viewing an historical archive of past issues. Please report new issues to the appropriate project issue tracker on GitHub.
Home » Issues » Bug #1947

Bug #1947: Contiguous characters scoring bug

Kind bug
Product Command-T
When Created 2012-02-06T19:58:48Z, updated 2012-02-07T02:35:54Z
Status open
Reporter John Whitley
Tags no tags

Description

This is a new spec (in describe CommandT::Match >> describe 'score method') that illustrates what I believe to be a scoring bug:

    it 'prioritizes matches with more contiguous characters' do
      sparse_matches = match_for('config/application.rb', 'caption')
      contiguous_matches = match_for('lib/assets/javascripts/tracker/views/caption_view.js.coffee', 'caption')
      contiguous_matches.score.should > sparse_matches.score
    end

This spec fails in the current Command-T HEAD, but IMO the scoring algorithm should be modified such that this passes. In essence, this is a fight between the rules exemplified by the specs "prioritizes shorter paths over longer ones" and "prioritizes matches with more matching characters".

It's also worth noting that this spec illustrates a volatile ordering case in the scoring algorithm. The two paths listed above fight for the top-spot as the letters in "caption" are typed out, with the shorter path mostly, but not always, winning.

The algorithm in pull request #7 on GitHub appears interesting w.r.t. this, but the request doesn't update the specs so it's hard to make heads or tails of its effectiveness.

Comments

  1. John Whitley 2012-02-06T20:24:04Z

    On further inspection of pull request 7 and TextMate's behavior, I've made an interesting observation: TextMate matches exclusively on filename unless a '/' character is present in the search string. That would be a great as a Command-T option.

Add a comment

Comments are now closed for this issue.

  • contact
  • legal

Menu

  • Blog
  • Wiki
  • Issues
  • Snippets