Generate good completions for local variables and functions depending on
scope. Partial implementation.