zikaari / monaco-editor-textmate

MIT License
122 stars 16 forks source link

Fixed TmTheme scope issue for monaco-editor #9

Closed Nishkalkashyap closed 5 years ago

Nishkalkashyap commented 5 years ago

Fixes issue: https://github.com/NeekSandhu/monaco-textmate/issues/5

API maintains backward compatibility. Optionally pass editor instance to wireTmGrammars(...args, editor) to filter for appropriate token scope.

Implementation borrowed from: https://github.com/NeekSandhu/monaco-textmate/issues/5#issuecomment-496412139

Before:

monaco-textmate-old

After:

monaco-textmate-corrected

zikaari commented 5 years ago

Thanks, @Nishkalkashyap!

The patch will be pushed in next minor release.

Please yarn add monaco-editor-textmate again to upgrade to 2.2.0

cc @CompuIves this patch implements "proper" token scope inheritance. Token will take color of its parent scope if itself doesn't have any color mapped directly.

CompuIves commented 5 years ago

This is really cool, thanks for the update @Nishkalkashyap! Also very cool that you made a CodeSandbox demo!