wooorm / refractor

Lightweight, robust, elegant virtual syntax highlighting using Prism
MIT License
722 stars 33 forks source link

Highlighting string interpolations in groovy throws an Error #13

Closed peterwilliams closed 6 years ago

peterwilliams commented 6 years ago

Trying to highlight groovy code that contains string interpolations, ex:

def sum = "The sum of 2 and 3 equals ${2 + 3}"

throws the following error:

Error: Expected `string` for `name`, got `[object Object]`

I'll link a PR to this issue that creates a failing test case and partially solves the bug. However, I think another change needs to be made to the language file in order to get the test to pass, and I'm not quite sure how to modify the babel transform you introduced in #9 in order to accomplish this.

This line would need to be changed to:

env.content = Prism.highlight(env.content.value, {