Switch language / syntax mode of current document

This is an update of @JakeStoeffler's PR #4276.  It's merged up with the latest master and addresses the main code review comments I made there.  I also added some simple unit tests.

I still have two concerns about merging this immediately, though:

**1)** The dropdown UI doesn't look great. It uses a native `<select>`, which is just hard to style... and the way the statusbar is laid out makes it look misaligned in this case:
![language picker](https://f.cloud.github.com/assets/1197510/1867075/419e3564-7847-11e3-85ec-1e33455f62bf.png)

It would look nicer if we used an HTML popup like code hints, context menus, and the Recent Projects dropdown... but it would definitely add a bunch more work here.  So maybe we can skate by with the current `<select>`-based UI for now.  @larz0, any thoughts?

**2)** This foregrounds all the bugs in #2911 a lot more.  I added a checklist of issues there.  Are there any that are prominent enough to act as blockers here?  (JS code hints seems like it might be the most glaring issue, but unfortunately that's one of the harder ones to fix too).