onivim / oni

Oni: Modern Modal Editing - powered by Neovim
https://www.onivim.io
MIT License
11.36k stars 300 forks source link

Language client stops working when editing a Haskell project #2659

Open RichardWarfield opened 5 years ago

RichardWarfield commented 5 years ago

Oni Version: 0.3.7-beta3 Neovim Version (Linux only): 0.3.1 Operating System: Arch Linux

Issue:

After working for a while with several Haskell source files open, the language client stops working -- no more hover/documentation windows appear and the HIE logs show HIE receiving no further requests from the client. With Oni debug logging on, I also see that the requests being logged on the console by Oni come to an end:

[Language Client] Notification textDocument/hover - ...xyz.hs: start
[Language Client] Notification textDocument/hover - ...xyz.hs: end
[Language Client] Notification textDocument/definition - ...xyz.hs: start
[Language Client] Notification textDocument/definition - ...xyz.hs: end

Working with the dev tools' debugger, the issue seems to relate to the _promiseQueue in LanguageClient.sendRequest getting blocked by some promise that never resolves. If I add some counters in PromiseQueue I see the queue growing longer and longer after the language client stops working.

I'm not familiar enough with the vscode-jsonrpc library to figure out why this is happening. But I wonder if the _promiseQueue is really necessary here -- why not just use an independent promise for each request? It seems to me that the current design causes the whole LanguageClient pipeline to break down if a single promise in the queue remains pending (which in fact seems to be what I am observing).

(Edit: I tried editing the code to use ordinary promises rather than the promise queue, and it seems to fix the problem with no obvious side effects so far)

I'd like to provide a minimal example to repro here but it seems hard to pin down exactly what triggers the problem. It doesn't occur in simple examples but always occurs (after a little while) with my large-ish project.

oni-bot[bot] commented 5 years ago

Hello and welcome to the Oni repository! Thanks for opening your first issue here. To help us out, please make sure to include as much detail as possible - including screenshots and logs, if possible.