haskell / haskell-language-server

Official haskell ide support via language server (LSP). Successor of ghcide & haskell-ide-engine.
Apache License 2.0
2.72k stars 368 forks source link

List comprehensions are treated as quasiquotes #3122

Open TheBFL opened 2 years ago

TheBFL commented 2 years ago

Your environment

Which OS do you use?

Which version of GHC do you use and how did you install it?

Which LSP client (editor/plugin) do you use?

Which version of HLS do you use and how did you install it?

Have you configured HLS in any way (especially: a hie.yaml file)?

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.

drsooch commented 2 years ago

Interesting... Appears to be 9.0.2 specific. Can't reproduce on 8.10.7 nor 9.2.4 using master branch.

arademaker commented 2 years ago

Same here in MacOS 12.15.1

michaelpj commented 2 years ago

Hmm, this seems like it could be us somehow enabling QuasiQuotes unconditionally, but I can't see how that would happen.

TheBFL commented 2 years ago

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

pepeiborra commented 2 years ago

HLS parses in a slightly unconventional mode since it enables -haddock. Can you repro just with ghc -haddock Foo.hs?

TheBFL commented 2 years ago

ghc -haddock BugTest.hs compiles properly, and doesn't give any error about quasiquotes. Seems the issue is specific to HLS.

wz1000 commented 2 years ago

I think this is triggered by hlint. I can't reproduce this with just ghcide.

michaelpj commented 10 months ago

Is this still a problem?