Skip to content

Instantly share code, notes, and snippets.

@apmckinlay
Last active December 10, 2015 15:38
Show Gist options
  • Save apmckinlay/4455719 to your computer and use it in GitHub Desktop.
Save apmckinlay/4455719 to your computer and use it in GitHub Desktop.
max_matches: 30
GetMatches(prefix)
{
list = Suneido.LibLocate.list
prefix = prefix.Tr("_").Lower()
from = list.LowerBound(prefix)
to = Min(from + .max_matches, list.LowerBound(prefix.RightTrim() $ "~"))
matches = list[from .. to]
matches.Map!({ it.AfterFirst("=") })
matches.Sort!().Unique!()
libs = Suneido.LibLocate.libs
matches.Map!({ it.Replace(":\d\d", { " (" $ libs[0 + it[1..]] $ ")" }) })
return matches
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment