I’m trying to use a prebuilt jupyterlab-ihaskell to provide syntax highlighting, but when I open a notebook in the console I get the error
TypeError: i.modeInfo is undefined
which leads me to think there is a problem with the way I’m using CodeMirror here. Does anyone have any suggestions for what I’m doing wrong?
CodeMirror 5 has the extension mechanism of extend-a-global-by-import-side-effect, seldom seen these days.
You basically want The CodeMirror
, as @jupyterlab/codemirror
sees/extends it with a number of plugins… like modeInfo
!
- A practical (but neglected/unmerged) example:
- An in-the-wild mode:
1 Like
Thanks for your fast and helpful responses! In the meantime I also found jupyterlab_robotmode
and I adapted my extension accordingly so it loads now: jupyterlab-ihaskell: make compatible with JupyterLab 3 by vaibhavsagar · Pull Request #1267 · gibiansky/IHaskell, but it’s still not syntax-highlighting when I load it. I suspect it’s not correctly loading the Haskell mode for CodeMirror but I’m not seeing any error messages that would confirm this. I’m very much a novice when it comes to JavaScript, does anyone have any tips?
The built-in modes are… funny. You may need to call Mode.ensure
(usage) before using it in the multiplexing mode. A quick test would be seeing if you can set the text editor highlighting mode and that somehow makes it work (it calls ensure
under the hood).
Also, apropos of nothing: it might be cool if that repo’s binder included jupyterlab-lsp and haskell-language-server… but I don’t know what I don’t know about getting such a thing set up 
Thanks, that’s exactly what I was missing! I didn’t know about jupyterlab-lsp
, you’re right that it would be really cool. As you can see I’ve been unable to match the blistering pace of JupyterLab development so I’ll have to investigate it further to see how easy it is to get up and running.
1 Like