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 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, pairing a trace of the left-hand context with the code snippet for the right-hand side.

To complete at run time, it uses the same logic to find the left-hand trace at the current cursor position, and tries to match that up against the database of completion fragments. Available completions are sorted by a proprietary blend of post score, left-hand context similarity, and nearby identifiers.

Thanks to