class Opal::Hike::Index

def sort_matches(matches, basename)

more weight.
priority. Extensions in the front of the `extensions` carry
Sorts candidate matches by their extension
def sort_matches(matches, basename)
  matches.sort_by do |match|
    extnames = match.sub(basename.to_s, '').to_s.scan(/\.[^.]+/)
    extnames.inject(0) do |sum, ext|
      index = extensions.index(ext)
      if index
        sum + index + 1
      else
        sum
      end
    end
  end
end