Closed MangoIV closed 3 months ago
Could you add some logs where this particular issue happens? Perferably with --debug
?
I can verify that I'm getting the same issue, and I'm able to reproduce it consistently. Basically, I have to wait for about 5-10 seconds after neovim opens a haskell file to start typing or else I hit the same case as @MangoIV.
Basic repro steps:
The odd thing is, this behavior continues even after I attempt to reboot the LSP. I have to completely close out of neovim and restart to get it working again.
I've attached the log file from when I was reproing this. I used the --debug flag as suggested.
As well, I seemed to get these errors when saving the file in neovim:
Error detected while processing BufWritePre Autocommands for "<buffer=4>":
LSP[haskell-tools.nvim] 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 SrcSpanPoint "/Users/ryan/src/dailycode/fair_coin_
flips/Main.hs" 4 1 Nothing) "[GHC-58481] parse error (possibly incorrect indentation or mismatched brackets)"
"~/src/dailycode/fair_coin_flips/Main.hs" 3L, 41B written
E492: Not an editor command: Lspinfo
Error detected while processing BufWritePre Autocommands for "<buffer=4>":
LSP[haskell-tools.nvim] 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 SrcSpanPoint "/Users/ryan/src/dailycode/fair_coin_
flips/Main.hs" 4 1 Nothing) "[GHC-58481] parse error (possibly incorrect indentation or mismatched brackets)"
"Main.hs" 2L, 19B written
Error detected while processing BufWritePre Autocommands for "<buffer=4>":
LSP[haskell-tools.nvim] 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 SrcSpanPoint "/Users/ryan/src/dailycode/fair_coin_
flips/Main.hs" 4 1 Nothing) "[GHC-58481] parse error (possibly incorrect indentation or mismatched brackets)"
"Main.hs" 3L, 41B written
The incorrect indentation or mismatched brackets error persists even when the code is this in my editor:
module Main where
main :: IO ()
main = putStrLn "foo"
Which seems to tell me that haskell-language-server got stuck looking at an old version of the file. hls.log
After upgrading to neovim version 0.10.1 I haven't been able to reproduce this issue. It's likely that this was a bug on neovim's side and not the language server.
Oh, interesting!
@MangoIV Can you confirm that?
I cannot reproduce it anymore, either. I just tried a couple of times, I guess it really must have been the update to 0.10.1.
Thank you for notifying me about it!
Your environment
Which OS do you use?
Nixos 24.11 Which version of GHC do you use and how did you install it? ghc 9.6 but also happens with 9.8 and 9.4, all of them distributed by nixpkgs
How is your project built (alternative: link to the project)? cabal
Which LSP client (editor/plugin) do you use? neovim + haskell-tools.nvim (native lsp)
Which version of HLS do you use and how did you install it? 2.8.0.0, installed via nixpkgs
Have you configured HLS in any way (especially: a
hie.yaml
file)? noSteps to reproduce
It doesn't reproduce very well but here's how you can try: create a
.hs
file and immmediately start editing it, without waiting for the hls to start upExpected behaviour
the hls starts up normally
Actual behaviour
the hls gets stuck parsing reporting an error that doesn't mirror the actual state of the file and does not recover.
Debug information
It also only happens on startup. If you wait for the hls to start up and only then start editing, everything is fine :)