Move code context creation

In support of 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. ;)