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

Code actions / Apply hints no longer working #118

Closed
bhrgunatha opened this issue Mar 17, 2021 · 3 comments
Closed

Code actions / Apply hints no longer working #118

bhrgunatha opened this issue Mar 17, 2021 · 3 comments

Comments

@bhrgunatha
Copy link

bhrgunatha commented Mar 17, 2021

emacs --version
GNU Emacs 27.1

I'm using the offical Arch package along with the (unofficial) AUR haskell-language-server-bin which just downloads the linux build from the official github repo

I'm working my way through the haskell fp-course fork that uses stack.

It's been working well but I've recently converted my crufty, but stable and familiar old config to use-package.

Here are the relevant parts of my config

I have the following versions from melpa:

lsp-haskell 20210209.2150
lsp-mode    20210314.1828
lsp-ui      20210220.703  

The problem is now the code actions or hints that lsp-haskell reports no longer work. They did work in the past, but during the upheaval it's now broken.

As a simple example

module Test where
fn :: Int -> Int
fn = \x -> x * 2

There are 2 hints reported via flycheck. The flycheck errors buffer shows the hints

 Found:
   fn = \ x -> x * 2
 Why not:
   fn x = x * 2
 (lsp)

 Found:
   \ x -> x * 2
 Why not:
   (* 2)
 (lsp)

Clicking on Apply all hints doesn't change the buffer though and a message appears lsp-request: ExitFailure 1.

When I check the hls.log I see errors parsing json responses:

Command "haskell-language-server-wrapper --lsp -d -l /tmp/hls.log" is present on the path.
Command "haskell-language-server-wrapper --lsp -d -l /tmp/hls.log" is present on the path.
Found the following clients for /home/bhrgunatha/docs/scratch/Test.hs: (server-id lsp-haskell, priority 0)
The following clients were selected based on priority: (server-id lsp-haskell, priority 0)
Creating watch for /home/bhrgunatha
haskell-lsp:incoming message parse error. {"jsonrpc":"2.0","id":1,"result":null}
 Error in $.result: parsing () failed, expected Array, but encountered Null

haskell-lsp:incoming message parse error. {"jsonrpc":"2.0","id":2,"result":null}
 Error in $.result: parsing () failed, expected Array, but encountered Null

Command "haskell-language-server-wrapper --lsp -d -l /tmp/hls.log" is present on the path.
Command "haskell-language-server-wrapper --lsp -d -l /tmp/hls.log" is present on the path.
Found the following clients for /home/bhrgunatha/docs/scratch/Test.hs: (server-id lsp-haskell, priority 0)
The following clients were selected based on priority: (server-id lsp-haskell, priority 0)
haskell-lsp:incoming message parse error. {"jsonrpc":"2.0","id":3,"result":null}
 Error in $.result: parsing () failed, expected Array, but encountered Null

haskell-lsp:incoming message parse error. {"jsonrpc":"2.0","id":4,"result":null}
 Error in $.result: parsing () failed, expected Array, but encountered Null

It looks like lsp-haskell is not getting the expected responses from the haskell-language-server. I've see the same error reported hundreds of times in the lsp.log buffer over many restarts of emacs trying to investigate the problem.

I see 2 processes on my machine

haskell-language-server-8.10.4 --lsp -d -l /tmp/hls.log
haskell-language-server-wrapper --lsp -d -l /tmp/hls.log

I'm not sure if the problem is with lsp-haskell, lsp-mode, or the haskell language server but lsp-haskell is mentioned in the log file so I'm reporting the problem here.

@michaelpj
Copy link
Collaborator

The log message you're seeing is this: haskell/haskell-language-server#1476

However, that's apparently benign, so I don't think it can be responsible for the problem you're seeing. Regardless, I think this is almost certainly a HLS issue. Could you open an issue there, ideally including what's in /tmp/hls.log?

@bhrgunatha
Copy link
Author

bhrgunatha commented Mar 17, 2021

I will do that, thanks.
You know, I searched (unsuccessfully) for that message. Even now the only thing I can find is my own post on reddit's emacs sub :).
So thanks for the link too!

@michaelpj
Copy link
Collaborator

Looks like you made on there, so I'll close this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants