Autocomplete from Stack Overflow

by Emil Schutte (2016)

Tired of writing code? Me too! Let's have Stack Overflow do it.

(Try typing a space. JavaScript only, for now.)

How it works

I grabbed a Stack Overflow data dump from https://archive.org/details/stackexchange and scraped out any code snippets from

Then I processed it by walking the ASTs of those snippets and creating a "completion" fragment for each node, indexed by a fingerprint of the left-hand context.

To complete at run time, it uses the same logic to generate a fingerprint for the context at the current cursor position, and fuzzy-matches that against the database. Matching completions are sorted by a proprietary blend of post score, left-hand context similarity, and nearby identifiers.

Thanks to