Skip to content

HLS simply stops working #3923

@mitchellwrosen

Description

@mitchellwrosen

Hello all, apologies for the low-quality bug report, but I wasn't able to find anything like this in the issue tracker.

Put simply, HLS simply tends to stop working, especially on bigger projects (but why does that matter?)

For example, I'm currently poking around the cabal codebase for the first time. You can follow along by:

  • Cloning https://github.com/haskell/cabal
  • Building once at the command line for good measure (cabal build cabal-install)
  • Opening a file like cabal-install/src/Distribution/Client/Main.hs
  • Start to do stuff. Jump around, make type errors, delete an export, just normal coding tasks...

I also have ghcid running in another terminal with ghcid -c 'cabal repl cabal-install', which seems to always report accurate information. That's the easiest way to tell when HLS is wrong - at some point it stops agreeing with ghcid, and it's always wrong when it does.

In a third terminal I have the LSP logs visible at TRACE level. I can see that (when HLS becomes broken) it still seems to be handling many requests. Here's an ugly dump:

[TRACE][2023-12-29 15:56:49] .../lua/vim/lsp.lua:1053	"notification"	"$/progress"	{  token = "2005",  value = {    kind = "begin",    title = "Processing"  }}
[TRACE][2023-12-29 15:56:49] ...lsp/handlers.lua:618	"default_handler"	"$/progress"	{  ctx = '{\n  client_id = 1,\n  method = "$/progress"\n}',  result = {    token = "2005",    value = {      kind = "begin",      title = "Processing"    }  }}
[DEBUG][2023-12-29 15:56:49] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "$/progress",  params = {    token = "2005",    value = {      kind = "report",      message = "596/599"    }  }}
[TRACE][2023-12-29 15:56:49] .../lua/vim/lsp.lua:1053	"notification"	"$/progress"	{  token = "2005",  value = {    kind = "report",    message = "596/599"  }}
[TRACE][2023-12-29 15:56:49] ...lsp/handlers.lua:618	"default_handler"	"$/progress"	{  ctx = '{\n  client_id = 1,\n  method = "$/progress"\n}',  result = {    token = "2005",    value = {      kind = "report",      message = "596/599"    }  }}
[DEBUG][2023-12-29 15:56:49] .../lua/vim/lsp.lua:1392	"LSP[haskell]"	"client.request"	1	"textDocument/codeLens"	{  textDocument = {    uri = "file:///home/mitchell/code/forks/cabal/cabal-install/src/Distribution/Client/Main.hs"  }}	<function 1>	2
[DEBUG][2023-12-29 15:56:49] .../vim/lsp/rpc.lua:284	"rpc.send"	{  id = 419,  jsonrpc = "2.0",  method = "textDocument/codeLens",  params = {    textDocument = {      uri = "file:///home/mitchell/code/forks/cabal/cabal-install/src/Distribution/Client/Main.hs"    }  }}
[DEBUG][2023-12-29 15:56:49] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "$/progress",  params = {    token = "2005",    value = {      kind = "report",      message = "325/599"    }  }}
[TRACE][2023-12-29 15:56:49] .../lua/vim/lsp.lua:1053	"notification"	"$/progress"	{  token = "2005",  value = {    kind = "report",    message = "325/599"  }}
[TRACE][2023-12-29 15:56:49] ...lsp/handlers.lua:618	"default_handler"	"$/progress"	{  ctx = '{\n  client_id = 1,\n  method = "$/progress"\n}',  result = {    token = "2005",    value = {      kind = "report",      message = "325/599"    }  }}
[DEBUG][2023-12-29 15:56:49] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "$/progress",  params = {    token = "2005",    value = {      kind = "report",      message = "322/599"    }  }}
[TRACE][2023-12-29 15:56:49] .../lua/vim/lsp.lua:1053	"notification"	"$/progress"	{  token = "2005",  value = {    kind = "report",    message = "322/599"  }}
[TRACE][2023-12-29 15:56:49] ...lsp/handlers.lua:618	"default_handler"	"$/progress"	{  ctx = '{\n  client_id = 1,\n  method = "$/progress"\n}',  result = {    token = "2005",    value = {      kind = "report",      message = "322/599"    }  }}
[DEBUG][2023-12-29 15:56:49] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  id = 419,  jsonrpc = "2.0",  result = {}}
[DEBUG][2023-12-29 15:56:49] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "$/progress",  params = {    token = "2005",    value = {      kind = "end"    }  }}
[TRACE][2023-12-29 15:56:49] .../lua/vim/lsp.lua:1053	"notification"	"$/progress"	{  token = "2005",  value = {    kind = "end"  }}
[TRACE][2023-12-29 15:56:49] ...lsp/handlers.lua:618	"default_handler"	"$/progress"	{  ctx = '{\n  client_id = 1,\n  method = "$/progress"\n}',  result = {    token = "2005",    value = {      kind = "end"    }  }}

But within the editor, I'm no longer getting any feedback whatsoever. I just have to restart HLS, and then it works again.

Again, apologies for the relatively low-quality bug report. I just wanted to make sure that this issue is known. I'd be happy to jump on a call to assist in collecting more information, if that would be helpful. It's easy for me to trigger this behavior on my end. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    multi-componentIssues relating to multi-component supporttype: 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