language-haskell icon indicating copy to clipboard operation
language-haskell copied to clipboard

Flags inside pragma

Open georgefst opened this issue 4 years ago • 3 comments

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.

georgefst avatar Aug 02 '21 16:08 georgefst

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?

sheaf avatar Aug 02 '21 16:08 sheaf

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.

georgefst avatar Aug 02 '21 16:08 georgefst

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.

neongreen avatar Apr 21 '23 09:04 neongreen