Skip to content

Instantly share code, notes, and snippets.

@nantsou
Created July 26, 2019 00:56
Show Gist options
  • Save nantsou/b82e5b7abf11e3c5d08677de0f68fc31 to your computer and use it in GitHub Desktop.
Save nantsou/b82e5b7abf11e3c5d08677de0f68fc31 to your computer and use it in GitHub Desktop.
mode_map = {
"cpp": "c_cpp",
"java": "java",
"python":"python",
"python3": "python",
"bash": "sh",
"javascript": "javascript",
"css": "css",
"html": "html",
}
function update_code_mode(obj) {
var choice_id = obj.id;
var editor_id = choice_id.replace("language", "code");
var code_mode = "ace/mode/" + mode_map[obj.value];
var _editor = window.ACEInstances?window.ACEInstances[editor_id]:null;
if (_editor) _editor.getSession().setMode(code_mode);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment