# Kernel with CodeMirror simpleMode defined, not surviving refresh

**URL:** <https://discourse.jupyter.org/t/kernel-with-codemirror-simplemode-defined-not-surviving-refresh/1692>\
**Category:** General\
**Tags:** kernel-gateway\
**Created:** [July 17, 2019, 2:22pm UTC](https://discourse.jupyter.org/t/kernel-with-codemirror-simplemode-defined-not-surviving-refresh/1692 "2019-07-17T14:22:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![am262327](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@am262327](https://discourse.jupyter.org/u/am262327)\
**Post date:** [July 17, 2019, 2:22pm UTC](https://discourse.jupyter.org/t/kernel-with-codemirror-simplemode-defined-not-surviving-refresh/1692/1 "2019-07-17T14:22:36Z")

</div>

Hi there guys,

I wrote a kernel with syntax highlighting built-in. It works great! I load it up, and everything highlights with the colors I gave it. The issue though is that the syntax highlighting doesn’t work when I refresh the page. I don’t know what I’m doing wrong, as I can’t find any help information on this.

Here’s what I have for the **kernel.js** file

```
define(
['codemirror/lib/codemirror', 'codemirror/addon/mode/simple'],
function(CodeMirror) {
  return {
    onload: function(){
        CodeMirror.defineSimpleMode('<name_of_langauge>', {
        /* definitions here */
       }
    }
   }
}

```

I am seeing in the console the 404 message:  
[http://localhost:8888/static/components/codemirror/mode/](http://localhost:8888/static/components/codemirror/mode/)\<name\_of\_language/\<name\_of\_language.js\>?v=…  
But I get this on the first load as well (I don’t understand why it’s trying to load that, either.

Any insight is appreciated.

---

<div class="post-metadata">

**Author:** ![BoPeng](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/bopeng/32/4166_2.png) [@BoPeng](https://discourse.jupyter.org/u/BoPeng)\
**Post date:** [April 14, 2021, 6:01pm UTC](https://discourse.jupyter.org/t/kernel-with-codemirror-simplemode-defined-not-surviving-refresh/1692/2 "2021-04-14T18:01:27Z")

</div>

There are a few codemirror related questions here but none appeared to be answered… I have raised an issue at the issue tracker ([Properly way to define new CodeMirror mode in JLab extension · Issue #10095 · jupyterlab/jupyterlab · GitHub](https://github.com/jupyterlab/jupyterlab/issues/10095)) but cannot help noticing that it was one of the 1.7k unresolved issues there ☹
