From 835bbd132c43d06aa6bd9b05ef6e2516352709e4 Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Tue, 8 Aug 2017 16:44:51 +0100 Subject: [PATCH] Set CodeMirror mode using mimetype, not mode name One mode definition file can contain different modes, e.g. clike includes C, C++, C#, Java, and a few others. We need to use the mime type to distinguish which one we want. Closes gh-2737 --- notebook/static/edit/js/editor.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/notebook/static/edit/js/editor.js b/notebook/static/edit/js/editor.js index b95ceda970..4ab8249021 100644 --- a/notebook/static/edit/js/editor.js +++ b/notebook/static/edit/js/editor.js @@ -150,8 +150,10 @@ function( /** set the codemirror mode from a modeinfo struct */ var that = this; utils.requireCodeMirrorMode(modeinfo, function () { - that.codemirror.setOption('mode', modeinfo.mode); + that.codemirror.setOption('mode', modeinfo.mime); that.events.trigger("mode_changed.Editor", modeinfo); + }, function(err) { + console.log('Error getting CodeMirror mode: ' + err); }); };