luminaxster / syntax-highlighter

An extensible library to highlight (and comment) JSX syntax in the Monaco Editor using Babel. It exposes its AST, so you can add your own syntax-based or custom highlights.
https://luminaxster.github.io/syntax-highlighter/
MIT License
30 stars 4 forks source link

incorrect highlight #8

Closed aboveyunhai closed 2 years ago

aboveyunhai commented 2 years ago

image Direct modification from demo.

The highlight is correct at the first render, but after I start to type, the highlighter seems to lose its integrity.

aboveyunhai commented 2 years ago

@luminaxster I tried to look through the source code but failed to understand how parsing works internally. I also check how codesandbox highlighter works https://github.com/codesandbox/codesandbox-client/blob/196301c919dd032dccc08cbeb48cf8722eadd36b/packages/app/src/app/components/CodeEditor/Monaco/workers/syntax-highlighter.js Just leave the link here in case if ppl can found the difference that covers the issue.

luminaxster commented 2 years ago

Thank you for letting me @aboveyunhai! It is a defect with the model change detection so it refreshes the highlighting, I'm looking into it and coming back with a fix shortly.

luminaxster commented 2 years ago

Coming back from vacation, looking into it tomorrow.