wooorm / refractor

Lightweight, robust, elegant virtual syntax highlighting using Prism

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Highlighting string interpolations in groovy throws an Error

peterwilliams opened this issue · comments

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, {