Getting syntax highlighting to work for custom cell magic

So one option is to mirror Bigquery magic by julioyildo · Pull Request #553 · jupyter-lsp/jupyterlab-lsp · GitHub and send a pull request to jupyterlab-LSP and we could include this in the next release (here is a PR with some screenshots: Syntax highlighting by krassowski · Pull Request #319 · jupyter-lsp/jupyterlab-lsp · GitHub). You will need to find out names of CodeMirror modes (possibly here: CodeMirror: C-like mode) and of the Fortran mode. The regular expressions may be much simpler if the magics do not have any arguments.

The real treat is that once someone adds a spec for C/C++/Fortran language server you will also get much, much more coding assistance (advanced autocomplete, linting, etc) for free. See add Pyright langserver spec by yuntan · Pull Request #587 · jupyter-lsp/jupyterlab-lsp · GitHub for an example of a PR adding a spec.

2 Likes