linguist icon indicating copy to clipboard operation
linguist copied to clipboard

Haskell highlighter detects non-existent comments

Open trillioneyes opened this issue 12 years ago • 3 comments

In Haskell, comments are started by the character sequence --. However, if these characters occur with other non-alphanumerics, they do not start a comment but are used as an operator. This allows functions with names like (-->).

Github's highlighter still considers such operators to be comments. As a consequence, in code like the following:

import XMonad.ManageHook ((-->))

Github thinks the two closing parentheses are commented out, and highlights the entire rest of the file incorrectly.

Sample of the error: https://gist.github.com/trillioneyes/11088670

trillioneyes avatar Apr 19 '14 15:04 trillioneyes

I've run into this exact problem myself, and have had to resort to rather silly measures to work around it.

https://github.com/AshleyMoni/dotfiles/commit/2bf0493e2ef836ff49d3956fbe37ad4bdfa5e58e

AshleyMoni avatar Apr 19 '14 15:04 AshleyMoni

This is not a problem with linguist. The highlighting is done with Pygments. You should report it on their BitBucket repo ;)

pchaigno avatar Apr 19 '14 21:04 pchaigno

Ah, okay. Thank you!

trillioneyes avatar Apr 19 '14 22:04 trillioneyes