I'm running into an annoyance with using HIE as a language server for the ViM ALE plugin. It seems to be an issue on the HIE side since the logs show HIE returning an empty result for the hover request. If I have a file, hover information becomes unavailable until I make a change to the file (even as simple as adding a blank line). See the attached file debug.log.
The HIE version is Version 0.2.2.0 x86_64 ghc-8.4.3.
For reference, here is the ALE issue: w0rp/ale#1918.
I'm happy to help debug the issue but I'm not sure where to start.
Very curious, I was just working on fixing this. Thanks for opening the issue!
My findings so far: the problem is due to how vim send text updates to the language server. Instead of sending the updated ranges, it sends the full document every time. This make hie not keep track of the position of the identifiers it could type check previously.
Great! Glad someone is already looking at it!
@lorenzo Are you working on addressing this in hie or LanguageClient-neovim?
Is it that LanguageClient-neovim is sending textDocument_didChange in the form of:
interface TextDocumentContentChangeEvent {
/**
* The range of the document that changed.
*/
range?: null;
/**
* The length of the range that got replaced.
*/
rangeLength?: null;
/**
* The new text of the range/document.
*/
text: ${FullFile};
}
I鈥檓 planning to fix it in hie, since it is a difficult problem to solve for both the lsp clients vim has.
The problem is that it sends both range and rangeLength as null, when we were relying on those to preserve the hover feature.
I can explain why Vim clients like mine send the whole document each time. In Vim you can keep track of changes in undo history, but there's no real way to figure out which sections of code have changed when changes are made to a file. Because of that, the easiest thing you can do for telling an LSP server that a document has changed is to send the entire buffer to the server on every change, after a short delay.
Thanks for explaining @w0rp
Does anything have to happen in hie for this still?
@alanz doesn't look so. And hover info works just fine after saving, though i'm using LanguageClient, not ALE.
This is not fixed yet. The problem is not about just saving, but saving a file with errors.
Most helpful comment
I鈥檓 planning to fix it in hie, since it is a difficult problem to solve for both the lsp clients vim has.
The problem is that it sends both range and rangeLength as null, when we were relying on those to preserve the hover feature.