Skip to content

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

Closed
@Savelenko

Description

@Savelenko

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: hls-eval-plugintype: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions