Skip to content

Commit 835bbd1

Browse files
committed
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
1 parent b099303 commit 835bbd1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

notebook/static/edit/js/editor.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,10 @@ function(
150150
/** set the codemirror mode from a modeinfo struct */
151151
var that = this;
152152
utils.requireCodeMirrorMode(modeinfo, function () {
153-
that.codemirror.setOption('mode', modeinfo.mode);
153+
that.codemirror.setOption('mode', modeinfo.mime);
154154
that.events.trigger("mode_changed.Editor", modeinfo);
155+
}, function(err) {
156+
console.log('Error getting CodeMirror mode: ' + err);
155157
});
156158
};
157159

0 commit comments

Comments
 (0)