tree-sitter / tree-sitter-haskell

Haskell grammar for tree-sitter.
MIT License
151 stars 36 forks source link

Typed Template Haskell quotations / splices not handled correctly #116

Closed kosmikus closed 3 months ago

kosmikus commented 6 months ago

GHC with TemplateHaskell allows typed quotations and splices, written

[|| x ||]

and

$$(foo bar)

or just

$$x

Looks like the tree-sitter parser currently handles this incorrectly, breaking syntax highlighting in rather substantial ways for files containing these constructs.

I looked briefly whether there's a very quick fix, but unfortunately it looks like this requires adapting the scanner.

tek commented 6 months ago

Added to the TODO list for my in-progress redesign, and fixed the most egregious bug for now.

But I don't see what's broken with the typed splices – do you have an example?

kosmikus commented 6 months ago

Thanks for the quick response. I think you're right that typed splices are fine, actually. I didn't have any top-level typed splices when I experienced the problem, so I couldn't observe that they're handled ok as they were occurring inside of typed quotations. But AFAICS, typed splices are indeed handled ok.

tek commented 6 months ago

cool, thanks for the report!