From 89694097cc6039fc40a6eaf8449938b0dbe1cafb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Thu, 8 Feb 2018 15:17:30 +0100 Subject: [PATCH] Temporary extension of ACE editor language map, make 'text' default --- src/event_handlers/source_code_event_handler.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/event_handlers/source_code_event_handler.py b/src/event_handlers/source_code_event_handler.py index 51cff20..b1328e0 100644 --- a/src/event_handlers/source_code_event_handler.py +++ b/src/event_handlers/source_code_event_handler.py @@ -91,12 +91,19 @@ class SourceCodeEventHandler(EventHandlerBase, SupervisorMixin): def map_file_extension_to_language(filename): language_map = { - # TODO: extend, maybe auto-generate??? '.py': 'python', - '.js': 'javascript' + '.js': 'javascript', + '.html': 'html', + '.css': 'css', + '.java': 'java', + '.cpp': 'c_cpp', + '.hpp': 'c_cpp', + '.c': 'c_cpp', + '.h': 'c_cpp', + '.cs': 'csharp' } _, extension = splitext(filename) - language = 'javascript' + language = 'text' try: language = language_map[extension] except KeyError: log.debug('No such extension in list, falling back to default: "{}".'.format(language)) return language \ No newline at end of file