When a file is open in the visual studio editor, through the EnvDTE.Document.Language property a string result such as "CSharp", "C/C++", "HTML", "JScript", etc. is returned specifying the language of a file. I'd like to be able to access that same language information when a file is not open (i.e. from a ProjectItem context).
EnvDTE.ProjectItem.FileCodeModel.Language seemed promising, but only gave me a result for CSharp files. No information was available for HTML, XAML, etc.
I could make assumptions based on file extensions, but being able to retrieve the language as interpreted by Visual Studio (presumably through the language service(s)) would be a lot more robust. It seems like the information is available since it is stored on the document, but I haven't been able to find the right API for accessing it.
Any help or suggestions would be greatly appreciated. :)