neovim-qt: MacOS: "QLocalSocket::connectToServer: Invalid name"

Is it possible to add the ability for Neovim-Qt to connect to a Neovim instance that’s listening on a filesystem or domain socket?

Currently, if I try to use --server /path/to/socket or --server @sockname you get an error saying that the listening address is invalid:

nvim -i NONE -u NONE --headless --listen ./nvim.sock &
nvim-qt --server ./nvim.sock

nvim -i NONE -u NONE --headless --listen @nvim &
nvim-qt --server @nvim

This error happens on Neovim-Qt v0.2.16.1 with Neovim v0.5.0.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 23 (15 by maintainers)

Commits related to this issue

Most upvoted comments

I opened a PR to fix this, tests are looking good. I’ll merge once CI is done.

This seems to be the same as seen in this bug https://bugreports.qt.io/browse/QTBUG-50877. From the testing earlier it seems there are two distinct cases, but the upstream issue does not go into them and I was unable to find the source for this.

To verify try this:

  1. open an nvim instance and check its value for $NVIM_LISTEN_ADDRESS (it should be inside /tmp/nvimXXXX/0)
  2. from any folder in the system call nvim-qt --server nvimXXXX/0 (use the path you saw above)

It seems that Qt assumes relative paths passed QLocalSocket are relative to /tmp/.

The only solution that I can think of is making the path absolute as part of the call (exclude windows for now).

@gwerbin

Yes, it was only an example, nvr uses filesystem socket I think.

I think you command nvim -i NONE -u NONE --headless --listen ./nvim.sock is the problem. On my Linux machine, the file is not created. I’ll dig up a filesystem socket example, that case should be supported and working.