haskell-language-server
haskell-language-server copied to clipboard
List comprehensions are treated as quasiquotes
Your environment
Which OS do you use?
- WSL 2 (Ubuntu)
Which version of GHC do you use and how did you install it?
- 9.0.2 ghcup
Which LSP client (editor/plugin) do you use?
- VSCode/Haskell
Which version of HLS do you use and how did you install it?
- 1.7.0.0 from ghcup.
Have you configured HLS in any way (especially: a hie.yaml
file)?
- No.
Steps to reproduce
Create a haskell file in vscode, with the contents:
main = print [x| x <- [1..10]]
the same behavior occurs even when {-#LANGUAGE NoQuasiQuotes#-}
is added.
Expected behaviour
HLS treats this as a list comprehension, and displays the appropriate suggestions (such as "redundant list comprehension"), when quasiquotes are disabled.
Actual behaviour
HLS gives an error when there is no space before the |
in the list comprehension, claiming that it is an unterminated quasiquotation at end of input
when QuasiQuotes are not enabled.
Interesting... Appears to be 9.0.2 specific. Can't reproduce on 8.10.7 nor 9.2.4 using master branch.
Same here in MacOS 12.15.1
Hmm, this seems like it could be us somehow enabling QuasiQuotes
unconditionally, but I can't see how that would happen.
I tried this, and the exceptionally weird thing is that if the appropriate end of the quasiquotation is added, like so:
main = print [x| x <- [1..10]|]
then HLS gives a Quasi-quotes are not permitted without QuasiQuotes
error. So it's not like they're just automatically enabled from what I can tell
HLS parses in a slightly unconventional mode since it enables -haddock
. Can you repro just with ghc -haddock Foo.hs
?
ghc -haddock BugTest.hs
compiles properly, and doesn't give any error about quasiquotes. Seems the issue is specific to HLS.
I think this is triggered by hlint. I can't reproduce this with just ghcide.
Is this still a problem?