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

Type Signatures on New Line

Open ruhatch opened this issue 7 years ago • 3 comments

I have some type signatures laid out as

function
  :: Type1
  -> Type2
function = undefined

and the highlighting here seems to be incorrect. The function name is not highlighted as usual, and the third line (-> Type2) is not coloured correctly.

ruhatch avatar Apr 18 '17 12:04 ruhatch

Atom's grammar model limitation. See #57, #81, #89, #101, and probably a few others. I will keep this open to increase visibility, since these reports get extremely redundant after a while.

lierdakil avatar Apr 18 '17 16:04 lierdakil

Relevant: https://github.com/lspitzner/brittany/issues/94

lierdakil avatar Dec 29 '17 01:12 lierdakil

Actually, I managed to come up with a reasonably effective band-aid (finally?). Not a solution, not by any stretch, but should help with the most common case.

It basically works by asserting that Haskell statements can't start with :: operator, hence successive lines having the same indentation level as :: have to be part of a signature.

So this works (somewhat, identifier isn't highlighted as a signature declaration): image

this still doesn't, but such formatting is rather rare, I reckon: image

Best results are still achieved with something like this: image

lierdakil avatar Dec 29 '17 20:12 lierdakil