The following patch load mode only when they are needed. It is supposed to work but somehow does not.
diff --git a/src/sos_notebook/kernel.js b/src/sos_notebook/kernel.js
index e5d340c..5b7165a 100644
--- a/src/sos_notebook/kernel.js
+++ b/src/sos_notebook/kernel.js
@@ -25,13 +25,7 @@ define([
"codemirror/lib/codemirror",
"codemirror/mode/python/python",
"codemirror/mode/r/r",
- "codemirror/mode/octave/octave",
- "codemirror/mode/ruby/ruby",
- "codemirror/mode/sas/sas",
- "codemirror/mode/javascript/javascript",
- "codemirror/mode/shell/shell",
- "codemirror/mode/julia/julia",
- "codemirror/mode/markdown/markdown",
+ 'codemirror/lib/util/loadmode',
"codemirror/addon/selection/active-line",
"codemirror/addon/fold/foldcode",
"codemirror/addon/fold/foldgutter",
@@ -2100,6 +2094,7 @@ table.task_table {
"use strict";
+ CodeMirror.modeURL = "codemirror/mode/%N/%N.js";
var sosKeywords = ["input", "output", "depends", "parameter"];
var sosActionWords = ["script", "download", "run", "bash", "sh", "csh",
"tcsh", "zsh", "python", "python2", "python3", "R", "node", "julia",
@@ -2252,7 +2247,7 @@ table.task_table {
if ('base_mode' in parserConf) {
let mode = findMode(parserConf.base_mode.toLowerCase());
if (mode) {
- base_mode = CodeMirror.getMode(conf, mode);
+ base_mode = CodeMirror.loadMode(conf, mode);
} else {
console.log(`No base mode is found for ${parserConf.base_mode}. Python mode used.`);
}
@@ -2502,7 +2497,7 @@ table.task_table {
let mode = findMode(state.sos_state.slice(6).toLowerCase());
if (mode) {
state.sos_state = null;
- state.inner_mode = CodeMirror.getMode(conf, mode);
+ state.inner_mode = CodeMirror.loadMode(conf, mode);
state.inner_state = CodeMirror.startState(state.inner_mode);
} else {
state.sos_state = 'nomanland';
The following patch load mode only when they are needed. It is supposed to work but somehow does not.