jskinner / DefaultPackages

Old bug tracker for Sublime Text's "Default Packages", e.g. bad syntax highlighting
http://web.archive.org/web/20150524043750/https://www.sublimetext.com/forum/viewtopic.php?f=2&t=12095
26 stars 2 forks source link

Haskell Syntax Highlighting with Guards #159

Closed FichteFoll closed 4 years ago

FichteFoll commented 8 years ago

From @Kasceh on November 16, 2015 12:36

The first piped statement with a guard when not using an = (which isn't necessary) isn't coloured properly, and the the statement following it isn't coloured properly either.

The following is valid Haskell:

handleLookup :: Either String Code -> String
handleLookup x
  | Either.isLeft x       = "Issue: " ++ fromLeft x
  | otherwise             = "Code: "  ++ fromRight x

but is highlighted like so:

hs

whereas having an = after handleLookup x on line 2, styles it like so:

hs

EDIT:

Seems to be a general issue that Sublime doesn't fully understand what can terminate a partial-statement:

Correct syntax, Incorrect highlighting: hs

Incorrect syntax, correct highlighting hs

Copied from original issue: SublimeTextIssues/Core#1024