test C and C++ detection when editing header files

This commit is contained in:
Alan Hamlett 2015-09-06 20:06:36 -07:00
parent f53044fd23
commit 4c8919f9ac
11 changed files with 49 additions and 17 deletions

View file

@ -123,7 +123,12 @@ def get_language_from_extension(file_name):
"""Returns a matching language for the given file extension.
"""
extension = os.path.splitext(file_name)[1].lower()
filepart, extension = os.path.splitext(file_name)
if os.path.exists(u('{0}{1}').format(u(filepart), u('.c'))) or os.path.exists(u('{0}{1}').format(u(filepart), u('.C'))):
return 'C'
extension = extension.lower()
if extension == '.h':
directory = os.path.dirname(file_name)
available_files = os.listdir(directory)