Move code context creation

In support of [atom-script#112](https://github.com/rgbkrk/atom-script/pull/112), refactoring this a bit to move the code context creation out.

WIP until I finalize it. Just wanted to show what my direction is while you're working in the same code base. ;)
*whistles*