Break some pieces into a util file
Refactor LanguageEndpoint and add referenced files to build

The implementation in languageServiceHost.ts wasn’t being used—it had
been replaced by the anonymous implementation in languageEndpoint.ts. I
got rid of the latter (and copied its functionality to the one in
languageServiceHost.ts), and added reference files to the TypeScript
build.

Drawbacks as of now: code duplication errors are thrown all over the
place (from duplicate third-party dependencies). But, if the projects
you reference don’t have their own copies of your project’s
dependencies, everything should build fine.