uivonim icon indicating copy to clipboard operation
uivonim copied to clipboard

WSL: Uivonim commands not working

Open kalvinpearce opened this issue 3 years ago • 4 comments

As discussed in #99 commands such as :Uivonim nc and :Uivonim explorer don't run when in WSL. Attached is the full developer console log but no errors seem to come up when trying to run the commands.

Interesting to note that the tab complete works for Uivonim but wont complete any of the arguments eg nc or explorer. I have confirmed that these work with my windows config but are not working when passing the --wsl flag.

image

kalvinpearce avatar Feb 09 '21 09:02 kalvinpearce

Thanks for the issue! It appears the problem is due to not being able to connect to the neovim pipe to communicate over RPC. Since it’s running neovim in WSL, I’m guessing it’d have to connect a slightly different way.

However, looking at the code, I’m not really sure why it doesn’t just communicate over the neovim process’s stdin/stdout (this is left over from Veonim, so I’m not sure why that was originally done; might have been done for the multiple nvim instance feature, but I still don’t really think it’s necessary). I think modifying things to drop pipes altogether and just use stdin/stdout might fix this issue (assuming I understand the code properly), but that might take some time. I’ll try and look into it soon and see what I can do/find.

EDIT: Why the above is done is detailed in this comment: https://github.com/smolck/uivonim/issues/24#issuecomment-711555423

smolck avatar Feb 09 '21 14:02 smolck

@kalvinpearce Could you run :echo $NVIM_LISTEN_ADDRESS and comment the output here? I'm not sure how --listen behaves when running nvim through WSL (I'm guessing it's mostly like Linux though), and so seeing an example might be helpful. I think the main thing to change will be this: https://github.com/smolck/uivonim/blob/d35b78c9c3b46b982f5c5f3e37580b04551f523d/src/support/utils.ts#L121-L124

That line just gets the name for the pipe used by Neovim when --listen is passed an argument, but I'm guessing it's failing on WSL since the path won't be the same as if it were just on Windows.

(Note that the proper fix might be to drop the pipe altogether, but I need to look into it as I said above and I don't think that should necessarily block this issue.)

smolck avatar Feb 09 '21 14:02 smolck

Running :echo $NVIM_LISTEN_ADDRESS returns the following: image

This matches the error from the developer console output (as seen in the original screenshot) so I think you're on to something with it not being about to connect to the pipe

kalvinpearce avatar Feb 10 '21 08:02 kalvinpearce

Hmm, so it appears the pipe name is correct, it’s just having trouble connecting. This WSL issue seems to be relevant: https://github.com/microsoft/WSL/issues/4204

This issue also seems to be relevant: https://github.com/microsoft/WSL/issues/4150

So it seems to be more of a WSL issue than an uivonim issue; however, I think it could still be fixed, or at least worked around. ATM a separate thread is used to communicate with neovim for performance purposes (although the performance improvement it supposedly offers is only really anecdotal at this point), and it does so over a socket, but I could potentially also provide an option to only use one thread. I’m guessing that would fix this issue, since all communication with neovim would take place over the stdin/stdout of the child nvim process, but it also might cause some issues.

I’m also not sure how hard that would be to do, and I think the code will need some other work beforehand, so unfortunately I don’t know how long it’ll take to fix this.

smolck avatar Feb 10 '21 13:02 smolck