A year after it debuted, Xcode’s enhanced autocomplete features continue to struggle with overly liberal matches:
In this example, several of the matching text results display few commonalities with my search phrase . There’s really no reason that “fatale” should match
It shouldn’t be hard to create heuristics that count the number of matched chunks, their distance from each other, to build a score related to whether the match is chunky (a good thing for keywords) and singular (another good thing for discerning developer intent).
Successful autocompletion promotes good matches and discards inappropriate ones. “
upper” should score high on
CFStringUppercase and low on
That’s not the only problem with autocomplete. Image literal completion is a big problem. Xcode often prioritizes images over code APIs. When starting to type “picker”, Xcode should not suggest “picture-of-lovely-cat”. Here are some real world examples of this issue:
One developer told me that while typing
in for closures, that eighty percent of the time, he gets a random autocompleted image literal instead of the keyword he’s shooting for:
Surely, this is an obvious place to introduce autocomplete preferences that allow you to exclude literals from the API list. The auto complete for image literals should act more like colors, offering an
Image Literal entry point to a image picker instead of clogging the API name space:
It would certainly get rid of those inappropriate
Thanks Olivier Halligon, Andrew Campoli, and everyone else who gave me feedback and direction for this post.