-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broken character literal highlighting #132
Comments
(See neovimhaskell#132) When a character literal contains a "region" start pattern ('(','[','{','"'), everything after the start pattern is interpreted as a contained region, and consequently breaks syntax highlighting. After further investigation, the regex used to match character literal is actually incorrect according to the Haskell 2010 language specification (https://www.haskell.org/onlinereport/haskell2010/haskellch2.html#x7-200002.6), which means most valid character literals aren't highlighted at all, and the \u<code> pattern while not being a legal character in Haskell, is correctly highlighted. This commit tries to remedy the above issues.
Oh god it's not just me. The character literals used to work fine, then I took some time off haskell, and now they're broken for both vim and neovim. |
Yep, just tested it and it's a regression somewhere between neovim 0.4.1 and neovim 0.6.0. It's got something to do with matching Update: wow, it's more weird. Apparently
If you open it in nvim and Update2: my bad, to make this test file work for both nvim 0.4.1 and 0.6.0 you need to add Update3: using Update4: I conclude that it broke in neovim 0.6.0 exactly, since in 0.5.1 it works |
When a character literal contains a "region" start pattern ('(','[','{','"'), everything after the start pattern is interpreted as a contained region, and consequently breaks syntax highlighting. After further investigation, the regex used to match character literal is actually incorrect according to the Haskell 2010 language specification (https://www.haskell.org/onlinereport/haskell2010/haskellch2.html#x7-200002.6), which means most valid character literals aren't highlighted at all, and the \u<code> pattern while not being a legal character in Haskell, is correctly highlighted.
For example, '[' here breaks everything after it: ) is not highlighted as a delimiter - like its matching (, and showVol is not highlighted as it should've been, like getVol above:
With the addition of a ' and a ], they "close" the bogus "open" token [ and ', and everything is highlighted correctly again:
The character literal highlighting is not even correct!
This is how the plugin defines the way haskellCharacter should've been highlighted, notice that the "characters" inside of the single quotes are highlighted as if they weren't character literals instead, e.g. A is highlighted as a type, 9 as a number, + as an operator, z as normal text:
The text was updated successfully, but these errors were encountered: