microsoft / vscode-jupyter

VS Code Jupyter extension
https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter
MIT License
1.29k stars 291 forks source link

Python Interactive colorization misses stuff #3884

Closed greazer closed 3 years ago

greazer commented 5 years ago

We're using prismjs to do colorization. This isn't as robust as textmate

Case in point,

On the left textmate is identifying import as keyword.control. On the right prism doesn't even have that in its grammar.

The solution would probably be: Use https://www.npmjs.com/package/vscode-textmate to tokenize the source before we send it to react Use our current solution to load the json files with the colors and turn them into a css Expand this css to have colors for every token Change the react code to turn the code into tokenized html.

Alternatively might use this: https://www.npmjs.com/package/@uiw/react-codemirror

Then just give it the appropriate css files. That's what Jupyter uses.

greazer commented 5 years ago

Ping vscode team on their issue related to this.