jbyuki / one-small-step-for-vimkind

Debug adapter for Neovim plugins
MIT License
409 stars 11 forks source link

require"osv".launch() locks up neovim #3

Closed sprocket-9 closed 3 years ago

sprocket-9 commented 3 years ago

NVIM v0.5.0-dev+1300-g7fcc59655

Hi, I'm having some trouble trying to get the plugin working and I'm not sure if it's the plugin, nvim or something else with my set up. When I try to launch(), nvim is locking up - I can see the new spawned instance of embedded/headless vim in the process table, but it goes no further. A bit of debugging shows the problem lies with the rpcrequest blocking and never returning:

https://github.com/jbyuki/one-small-step-for-vimkind/blob/main/lua/osv/init.lua#L86 if I comment that line out, the same problem occurs at: https://github.com/jbyuki/one-small-step-for-vimkind/blob/main/lua/osv/init.lua#L90

I'm using nvim nightly. Not sure if it's broken or maybe it has changed the way rpcrequests are handled, so the problem may be with nvim rather than the plugin.

jbyuki commented 3 years ago

Thank you for your issue. My first instinct would be that neovim is in blocked mode (waiting for input see nvim_get_mode) but it might also be something else. Did you try to run require'osv'.run_this? This might detect if it's blocking mode.

I will add a blocking detection in launch which should detect if something is wrong and not wait infinitely in the meantime.

jbyuki commented 3 years ago

I added the block detection in launch, you can also try just launch() and see if it still hangs. If it's still the case, it must be something else but I'm currently not seeing it.

sprocket-9 commented 3 years ago

You were right! The embedded neovim was starting in blocked mode, specifically mode 'r' = Hit-enter prompt. Assuming neovim must be displaying some error message but I don't know how to see what it is. I've tracked the problem down to the line in my init.vim: colorscheme nightfly. If I comment this out or use another colorscheme launch() works fine. Could be https://github.com/bluz71/vim-nightfly-guicolors doesn't like running in a neovim in headless RPC mode as there's no pty? Anyway no big deal, I can use another colorscheme.

Thanks for adding the block detection and the info on nvim_get_mode, it was a big help.

jbyuki commented 3 years ago

Great, happy to hear that!

I've tracked the problem down to the line in my init.vim: colorscheme nightfly

Indeed, I can confirm the "issue" here as well. This is not related to osv but investigating a little further gave me this running neovim in headless:

Error detected while processing nightfly.vim:
line   20:
E684: list index out of range: 0
E15: Invalid expression: has('nvim-0.4') && nvim_list_uis()[0]['ext_termcolors'] && !&termguicolorsPress ENTER or type command to continue

I'm not really in charge of nightfly but you can subsitute line 20 in colors/nightfly.vim to correct the issue if you haven't corrected it already:

 if has('nvim-0.4') && len(nvim_list_uis()) > 0 && nvim_list_uis()[0]['ext_termcolors'] && !&termguicolors

I will do send a quick PR to nightfly.vim for good measures. Closing this for now.

akinsho commented 3 years ago

@jbyuki apologies for posting on a dead issue. I've hit the same issue with headless nvim being blocked on startup but I am wondering how you diagnosed the issue, it's not my colorscheme as far as I can see, what did you do to get the output of what wasn't working?

jbyuki commented 3 years ago

Hey @akinsho , I'm don't remember the exact command but you can start neovim headless using nvim --headless. Sometimes the output isn't shown until you exit it so try either sending an interrupt signal or appending a -c "exit" to the command.

akinsho commented 3 years ago

Thanks tracked it down 👍🏿 , getting a connection refused error now but I'll track it down. Haven't had a chance to dig in properly yet