Open slowenthal opened 8 years ago
The codemirror_mode
in a kernel_info_reply can be a dictionary to pass more options. E.g. for Python you can do (something like) this:
"codemirror_mode": {"name": "python", "version": 3}
Maybe there's something similar for selecting between SQL dialects?
This page just defines mime types. https://codemirror.net/mode/sql/index.html
In my code I got this to work - ... getElementById("desc%d"), {readOnly: true, mode:"text/x-cassandra"}
But the SQL mode was loaded, and I guess this is one of the dialects, so I was able to state the mime type. AFIK, we need to load the sql mode, but can specify the mime type there. I looked at util.js and found a bunch of code that tries to figure this out, but doesn't seem to do the right thing. I'm not a javascript guy, so I'm not sure how everything gets set up.
How are you setting the mime-type? Is it a custom kernel? It appears that setting codemirror mime-type in the kernel_info_reply does work for others, e.g. the Cling kernel.
I am using the sql codemirror_mode, which has several mime types associated with it. I would like to use text/x-cassandra. For some output formatting of CQL (for describing objects), I was able to actually get codemirror to render x-cassandra with my own textarea in the output. However, the input cells seem to use a generic sql format, even if I set the mimetype='text/x-cassandra' in the kernel.