There is a condition under which json-rpc.read
returns nil.
As far as I've been able to understand when debugging the communication between eglot and fennel-ls, eglot initially sends 3 messages:
The problem occurs with the point 2 of that list, when json-rpc.read
returns nil
because the msg
at https://git.sr.ht/~xerool/fennel-ls/tree/main/item/src/fennel-ls.fnl#L37 gets immediately sent to dispatch.handle
, and if it was nil
, it breaks stuff there.
So I had to wrap it into a when
, to prevent the LS from crashing internally, and for it to be able to survive on to actually get to process the json content that comes next.
At this point, I 'm not sure what's going on. Obviously, fennel-ls should not have this problem, and the problem that I described in the previous issue about cutting the content size string too short.
I think it might be some OS-specific or version-specific issue on my side, but I would have no idea since it's the first time that I'm dealing with eglot and fennel-ls.
Does this situation with the nil
look off?
On the other hand, if returning
nil
should not be something tha ever happens, then why is there is an explicitnil
that can be returned from https://git.sr.ht/~xerool/fennel-ls/tree/main/item/src/fennel-ls/json-rpc.fnl#L18, which causes a cascade of nill returns..