Olical / conjure

Interactive evaluation for Neovim (Clojure, Fennel, Janet, Racket, Hy, MIT Scheme, Guile, Python and more!)
https://conjure.oli.me.uk
The Unlicense
1.79k stars 110 forks source link

Failed to resolve host for Conjure connection (IPV6?) #612

Open ar1a opened 1 month ago

ar1a commented 1 month ago

On windows, opening a .clj file errors out with this:

Error executing vim.schedule lua callback: ...AppData/Local/nvim-data/lazy/conjure/lua/conjure/net.lua:55: Failed to resolve host for Conjure connection
stack traceback:
    [C]: in function 'error'
    ...AppData/Local/nvim-data/lazy/conjure/lua/conjure/net.lua:55: in function 'connect'
    ...ocal/nvim-data/lazy/conjure/lua/conjure/remote/nrepl.lua:131: in function 'connect'
    ...lazy/conjure/lua/conjure/client/clojure/nrepl/server.lua:353: in function <...lazy/conjure/lua/conjure/client/clojure/nrepl/server.lua:299>

I believe this is caused by this check: https://github.com/Olical/conjure/blob/6d2bc7f7b24c2c43d54f263bee7b9b08aef5d1a1/lua/conjure/net.lua#L24

because when I run lua vim.print(vim.loop.getaddrinfo("localhost"))

it returns

9:26:52 PM msg_show   vim.print(vim.loop.getaddrinfo("localhost")) { {
9:26:52 PM msg_show   vim.print(vim.loop.getaddrinfo("localhost"))     addr = "::1",
9:26:52 PM msg_show   vim.print(vim.loop.getaddrinfo("localhost"))     family = "inet6",
9:26:52 PM msg_show   vim.print(vim.loop.getaddrinfo("localhost"))     protocol = "ip"
9:26:52 PM msg_show   vim.print(vim.loop.getaddrinfo("localhost"))   } }

where the only family returned is inet6

Olical commented 1 month ago

Well that's odd, you can override the host with this config

https://github.com/Olical/conjure/blob/6d2bc7f7b24c2c43d54f263bee7b9b08aef5d1a1/doc/conjure-client-clojure-nrepl.txt#L151-L155

So maybe setting that to a specific IP for now might help? Need to have a think about how to solve this and reproduce it without Windows though 🤔

I think there are other Windows users that I assume haven't run into this, so it could also be a specific version or configuration of Windows too I guess.

Thanks for the useful context and output of getaddrinfo! That sort of information massively helps me understand things without being able to re-produce it myself.

ar1a commented 1 month ago

Changing that to use 127.0.0.1 gets it to connect at least! Evaluating things seem to work fine: image but the auto-completion provided by cmp-conjure is not present - maybe I need to set the variable before opening the buffer and not just changing it and running :ConjureConnect. I'll look at that later

will update you if I make any progress in the mean time

ar1a commented 1 month ago

Hmm, hitting K on something like prn also produces something along the lines of

Error  12:02:42 AM msg_show.lua_error Error executing Lua callback: ...gram Files/Neovim/share/nvim/runtime/lua/vim/_system.lua:244: ENOENT: no such file or directory
stack traceback:
    [C]: in function 'error'
    ...gram Files/Neovim/share/nvim/runtime/lua/vim/_system.lua:244: in function 'spawn'
    ...gram Files/Neovim/share/nvim/runtime/lua/vim/_system.lua:335: in function 'system'
    C:/Program Files/Neovim/share/nvim/runtime/lua/man.lua:22: in function 'system'
    C:/Program Files/Neovim/share/nvim/runtime/lua/man.lua:263: in function 'get_path'
    C:/Program Files/Neovim/share/nvim/runtime/lua/man.lua:812: in function 'init'
    C:/Program Files/Neovim/share/nvim/runtime/lua/man.lua:824: in main chunk
    [C]: in function 'require'
    C:/Program Files/Neovim/share/nvim/runtime/plugin/man.lua:7: in function <C:/Program Files/Neovim/share/nvim/runtime/plugin/man.lua:6>
Error  12:02:52 AM msg_show.lua_error Error executing Lua callback: C:/Program Files/Neovim/share/nvim/runtime/plugin/man.lua:7: loop or previous error loading module 'man'
stack traceback:
    [C]: in function 'require'
    C:/Program Files/Neovim/share/nvim/runtime/plugin/man.lua:7: in function <C:/Program Files/Neovim/share/nvim/runtime/plugin/man.lua:6>

more windows being weird?

Olical commented 1 month ago

Hm that error to me looks like the built in Neovim man page lookup which is the default for K in most filetypes I think? It appears to be to be trying to spawn a sub-process but the program it's trying to execute doesn't exist. Conjure doesn't do this other than when we're trying to start stdio REPLs.

So I suspect it's trying to run man and your system doesn't have it? The stack trace sadly doesn't give us all the details though so I can't really tell what it's trying to execute. I'm guessing man from the context clues of man.lua being further up the stack.