JustusAdam / language-haskell

Highlighting support for the Haskell language in visual studio code.
https://marketplace.visualstudio.com/items/justusadam.language-haskell
BSD 3-Clause "New" or "Revised" License
97 stars 48 forks source link

Flags inside pragma #193

Open georgefst opened 3 years ago

georgefst commented 3 years ago

In {-# OPTIONS_GHC -F -pgmF tasty-discover -optF --tree-display #-}, the -- is recognised as a comment, and so (at least with my current theme), the remainder of the line is greyed out.

I guess we shouldn't be looking for the single-line comment syntax while we're already inside a multi-line comment.

sheaf commented 3 years ago

Thanks for the bug report.

I'm not 100% sure how to proceed, because single line comments are allowed inside {-# LANGUAGE #-} pragmas, for instance. Do we need special logic for OPTIONS_GHC pragmas specifically?

georgefst commented 3 years ago

single line comments are allowed inside {-# LANGUAGE #-} pragmas

Eugh, you're right. Seems they're even allowed with OPTIONS_GHC in some cases. I don't know how GHC knows it's not a comment in this case - maybe because -optF has to take an argument.

neongreen commented 1 year ago

What’s worse, a line comment inside an OPTIONS pragma also negates the closing #-}, so the rest of the file becomes mis-highlighted.

NB: if you special-logic the OPTIONS pragma, please allow anything starting with OPTIONS_, because some Haskell-derived languages like Mu would benefit from this as well.