atom-haskell / language-haskell

Haskell language support for Atom
https://atom.io/packages/language-haskell
MIT License
72 stars 26 forks source link

:: on a new line highlights incorrectly #89

Closed quchen closed 8 years ago

quchen commented 8 years ago

Consider

someValue
    :: (A -> B) 
    -> C

someValue
    :: Constraint 
    => (A -> B) 
    -> C

This style is common when Haddock-documenting the individual arguments of a function. The outcome is

selection_003

where the type signature is detected to end prematurely (scope: language.haskell and nothing else).

The behaviour on deleting the newline before the :: is equivalent from the language’s point of view, and handled correctly:

selection_004

lierdakil commented 8 years ago

This is expected. Atom's grammar model forbids backtracking and tokenizes one line at a time, which means no lookahead. So there is absolutely no way to figure out what a single identifier on a line means. Grammar falls back to basically doing nothing in this case.

16 сент. 2016 г. 11:24 ДП пользователь "David Luposchainsky" < notifications@github.com> написал:

Consider

someValue :: (A -> B) -> C

someValue :: Constraint => (A -> B) -> C

This style is common when Haddock-documenting the individual arguments of a function. The outcome is

[image: selection_003] https://cloud.githubusercontent.com/assets/3020161/18579662/60532012-7bf7-11e6-949b-ca35b31d5464.png

where the type signature is detected to end prematurely (scope: language.haskell and nothing else).

The behaviour on deleting the newline before the :: is equivalent from the language’s point of view, and handled correctly:

[image: selection_004] https://cloud.githubusercontent.com/assets/3020161/18579722/b02d20f6-7bf7-11e6-847a-dd3d880cd0f8.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/atom-haskell/language-haskell/issues/89, or mute the thread https://github.com/notifications/unsubscribe-auth/AG8EZszXg62K_3MFQWm5o0-KpDa2SeN_ks5qqlJNgaJpZM4J-szN .

quchen commented 8 years ago

Oh, that is unfortunate. Thanks anyway!