Skip to content
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

HLS crashes and stops working when a file contains "\r" in a comment #1158

Closed
Savelenko opened this issue Jan 5, 2021 · 4 comments · Fixed by #1166
Closed

HLS crashes and stops working when a file contains "\r" in a comment #1158

Savelenko opened this issue Jan 5, 2021 · 4 comments · Fixed by #1166
Labels
component: hls-eval-plugin type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@Savelenko
Copy link

Your environment

haskell-language-server version: 0.8.0.0 (GHC: 8.8.4) (PATH: /home/xxx/.config/Code - OSS/User/globalStorage/haskell.haskell/haskell-language-server-0.8.0-linux-8.8.4) (GIT hash: eb58f13f7b8e4f9bc771af30ff9fd82dc4309ff5)
Tool versions found on the $PATH
cabal:		2.4.1.0
stack:		2.5.1
ghc:		Not found

Which lsp-client do you use: VS Code (Code OSS) 1.51.1

Contents of hie.yaml:

cradle:
  stack:

Steps to reproduce

It seems there is a problem with parsing comments like {----------------}. The contents between the "braces" does not seem to matter (see below). I use these as "section separators" in long modules and after Haskell language server auto-updated I almost immediately got instability problems. The following message appears in logging output:

haskell-language-server-0.8.0-linux-8.8.4: Tokens.next failed to parse {- PhaseStore2 -}
 Parser did not consume entire stream, left: "\r"

This output is based on the following input module with nothing but a comment in it:

module Application.PhaseStore2 where

{- PhaseStore2 -}

I tried changing the contents of the comment with similar results.

Strangely enough, this does not happen in every module, while I have such separators in many files of the project.

Expected behaviour

Comments of the form {- -} are handled normally.

Actual behaviour

HLS repeatedly crashes and restarts. A message like above repeatedly appears in logging. Sometimes an "unmatched {-" (or something like this) appears in the editor as a problem pop-up, even after closing the comment.

@jneira jneira added type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. status: regression test needed labels Jan 5, 2021
@pepeiborra
Copy link
Collaborator

I suspect you can disable the Eval plugin to work around this.

@Savelenko
Copy link
Author

Thanks for the swift reply. Any pointer (to documentation about) how to disable the plugin?

@Ailrun
Copy link
Member

Ailrun commented Jan 7, 2021

It looks like the Eval plugin parser does not work well with files containing \r.
Let me try to rewrite the parser with... maybe megaparsec?

@Ailrun Ailrun changed the title HLS crashes and stops working due to {- -} comments HLS crashes and stops working when a file contains \r. Jan 7, 2021
@Ailrun Ailrun changed the title HLS crashes and stops working when a file contains \r. HLS crashes and stops working when a file contains \r. Jan 7, 2021
@Ailrun Ailrun changed the title HLS crashes and stops working when a file contains \r. HLS crashes and stops working when a file contains "\r" Jan 7, 2021
@Ailrun Ailrun changed the title HLS crashes and stops working when a file contains "\r" HLS crashes and stops working when a file contains "\r" in a comment Jan 7, 2021
Ailrun added a commit to Ailrun/haskell-language-server that referenced this issue Jan 7, 2021
@Ailrun
Copy link
Member

Ailrun commented Jan 7, 2021

I send a quick fix for this issue first, but I still think a full-power parser library might be better for parsing.

Ailrun added a commit to Ailrun/haskell-language-server that referenced this issue Jan 7, 2021
@mergify mergify bot closed this as completed in #1166 Jan 7, 2021
mergify bot pushed a commit that referenced this issue Jan 7, 2021
* Update the style for Token.hs in eval plugin

* Fix #1158
pepeiborra pushed a commit to pepeiborra/ide that referenced this issue Jan 9, 2021
* Update the style for Token.hs in eval plugin

* Fix haskell#1158
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: hls-eval-plugin type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants