Add module support and SDK selection.

This recognizes source roots and all manner of things.
This code was borrowed mostly from the redline.st plugin.