haskell / haskell-language-server

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

Unable to format/highlight code: unterminated quasiquotation at end of input #3906

Open weakit opened 9 months ago

weakit commented 9 months ago

Environment

haskell-language-server version: 2.4.0.0 (GHC: 9.0.2) (PATH: C:\tools\haskell\ghcup\bin\haskell-language-server-9.0.2~2.4.0.0.exe)
Tool versions found on the $PATH
cabal:          3.6.2.1
stack:          2.11.1
ghc:            9.4.7

Everything is installed from ghcup on Windows. I am using the VSCode plugin.

Steps to reproduce

I have this simple script in primes.hs

sieve = sx [2..] 
  where 
    sx (p:xs) = p : sx [x|x <- xs, x `mod` p > 0]

main = do
  print (take 10000 sieve)

Expected behaviour

image No errors, correct syntax highlighting,

Actual behaviour

image Syntax highlighting doesn't seem to work correctly.

And this error on trying to format the code in Visual Studio code

Error condition, please check your setup and/or the [issue tracker](https://github.com/haskell/haskell-language-server/issues): ormolu: Internal Error: ormoluCmd: OrmoluParsingFailed (RealSrcSpan SrcSpanMultiLine "C:\\...\\primes.hs" 3 27 7 1 Nothing) "[GHC-21231] unterminated quasiquotation at end of input"

Debug Information

Unsure if this is supposed to belong here, but I'm opening this issue.

Adding spaces between x|x seems to resolve the issue.

fendor commented 9 months ago

Hi, thank you for the bug report!

Is this happening on a plain .hs file? I can not reproduce on linux :/

I created the file Main.hs:

sieve = sx [2..] 
  where 
    sx (p:xs) = p : sx [x|x <- xs, x `mod` p > 0]

main = do
  print (take 10000 sieve)

And all these commands

complete successfully for me.

weakit commented 9 months ago

Yup. Simple .hs file.

I just installed Haskell, and then wanted to test it out with a very simple program and that's what I did.

Please let me know if there's any information I can help you with.

fendor commented 9 months ago

The information from the issue template would be helpful! Please provide the output of haskell-language-server-wrapper --debug primes.hs, executed in the terminal.

If you use vscode-haskell, you may also follow the steps described here: https://github.com/haskell/vscode-haskell#investigating-and-reporting-problems

soulomoon commented 8 months ago
  1. the syntax color part. Seems the do is missing color. It should be syntax highlighting problem. Since HLS does not provide the syntax highlighting, it is not a problem related to HLS. here: https://github.com/JustusAdam/language-haskell.git

  2. the format part

    Error condition, please check your setup and/or the [issue tracker](https://github.com/haskell/haskell-language-server/issues): ormolu: Internal Error: ormoluCmd: OrmoluParsingFailed (RealSrcSpan SrcSpanMultiLine "/Users/ares/src/extend-property/hls-plugin-api/test/Ide/PluginUtilsTest.hs" 204 27 208 1 Nothing) "[GHC-21231] unterminated quasiquotation at end of input"

    Considered a ormolu bug?