jupyter-xeus / xeus-javascript

A JavaScript kernel for JupyterLite, powered by Xeus
https://jupyter-xeus.github.io/xeus-javascript/lab/index.html?path=xeus-javascript.ipynb
BSD 3-Clause "New" or "Revised" License
10 stars 5 forks source link

Syntax highlights were gone in code cells for newly created notebooks #34

Closed MRYingLEE closed 5 months ago

MRYingLEE commented 7 months ago

In the Vallina demo notebook and all newly created notebooks, syntax highlights were gone in code cells.

An example is as follows: image

The previously created notebooks can show syntax highlights normally.

The same issue happened in both latest version of MS Edge and Google Chrome on Windows 11.

Please check. Thanks,

MRYingLEE commented 7 months ago

I found the direct reason.

In the previously created notebooks, the metadata for the notebooks are as follows: { "kernelspec": { "name": "xjavascript", "display_name": "JavaScript (xjavascript)", "language": "javascript" }, "language_info": { "codemirror_mode": "", "file_extension": "js", "mimetype": "text/x-javascript", "name": "javascript", "nbconvert_exporter": "", "pygments_lexer": "", "version": "ES6" } }

In the newly created notebooks, those are as follows: { "kernelspec": { "name": "xjavascript", "display_name": "JavaScript (xjavascript)", "language": "javascript" }, "language_info": { "name": "" } }

If I update the metadata of the newly created notebooks to the previous value, then the syntax highlights backs.

So far, I have no idea on the root reason.

MRYingLEE commented 7 months ago

The same issue happens in Xeus-Python also. So this must be a bug of Xeus.

DerThorsten commented 7 months ago

might also be an issue with jupyterlite itself.

On the xeus/c++ side, kernelspec / kernel info sits here https://github.com/jupyter-xeus/xeus-javascript/blob/main/share/jupyter/kernels/xjavascript/kernel.json.in and here https://github.com/jupyter-xeus/xeus-javascript/blob/main/src/xinterpreter.cpp#L129

I don't remember 100% where on the javascript side this info is consumed, but probably somewhere in https://github.com/jupyterlite/xeus/

MRYingLEE commented 5 months ago

The issue disappeared in the latest version.

I tested in both Edge and Chrom and also in both normal and inPrivate(incognito) mode.

Thanks,