yunabe / tslab

Interactive JavaScript and TypeScript programming with Jupyter
Apache License 2.0
701 stars 44 forks source link

CodeMirror in Jupyter does not handle TypeScript #18

Closed yunabe closed 4 years ago

yunabe commented 4 years ago

tslab kernel returns language_info.name == 'typescript' now.

But code-highlighting is not working on new cells in Jupyter notebook.

When I run CodeMirror.findModeByMIME('text/typescript'); in dev-console of Jupyter notebook window, it returns undefined though CodeMirror.findModeByMIME('text/javascript'); and CodeMirror.findModeByMIME('text/x-go'); return modes. It looks like TypeScript mode is not available in Jupyter notebook now for some reason.

$ jupyter notebook --version
6.0.2
$ jupyter lab --version
1.2.2
$ CodeMirror.version (in dev-console)
"5.48.4"

This bug does not affect jupyter lab. In jupyter lab, ts-only keywords like interface are highlighted properly.

interface Hello {
    getMessage(): string;
}
wisefool769 commented 1 year ago

@yunabe Do I have to do anything special to turn on syntax highlighting for JS / TS ? right now seeing nothing highlighted properly.