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

How can one use this in a diff editor? #21

Closed anubra266 closed 8 months ago

luminaxster commented 8 months ago

Super easy, barely an inconvenience =P:

// Instantiate the highlighter for each editor in the diffEditor instance
const monacoJSXHighlighter = new MonacoJSXHighlighter(
   monaco, babel, traverse, monacoDiffEditor.getOriginalEditor() // original
);
const monacoJSXHighlighter = new MonacoJSXHighlighter(
   monaco, babel, traverse, monacoDiffEditor.getModifiedEditor() // modified
);

Live Demo =)