better autocomplete

This commit is contained in:
2026-01-22 22:24:24 -05:00
parent 950662e0b9
commit f3698f0fc6
4 changed files with 33 additions and 14 deletions

View File

@@ -111,3 +111,12 @@ func inorder(a, b string) bool {
}
return true
}
// Metrics gets the number of buckets in the autocomplete set and the length
// of the longest bucket.
func (s *Set) Metrics() (buckets, longest int) {
for _, b := range s.keys {
longest = max(longest, len(b))
}
return len(s.keys), longest
}