API for language detection?

Hello,

Does CodeMirror have an API of sorts to tell what languages are being used in the editor based off the file extension?

Yes, at least as far as languages in the default distribution are concerned, you can load mode/meta.js and use the CodeMirror.findModeByFileName function it defines.