Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Neovim can't find neovim-ruby-host #7730

Closed
cbcoutinho opened this issue Dec 16, 2017 · 25 comments
Closed

Neovim can't find neovim-ruby-host #7730

cbcoutinho opened this issue Dec 16, 2017 · 25 comments
Labels

Comments

@cbcoutinho
Copy link

Neovim can't find the latest version of neovim-ruby-host on my machine. Installing the neovim gem into my user directory by executing the following:

$ gem install --user neovim

Results in a binary with the ruby version attached to it as a suffix:

$ find / -iname 'neovim-ruby-host*'
/home/chris/.gem/ruby/2.4.0/bin/neovim-ruby-host.ruby2.4

Running vim +CheckHealth results in an error of not being able to locate the neovim ruby binding; however, if I copy neovim-ruby-host.ruby24 to neovim-ruby-host, then the health check works fine. Is there a simple way of making the health check a bit more lenient?

My gem environment:

RubyGems Environment:
  - RUBYGEMS VERSION: 2.6.13
  - RUBY VERSION: 2.4.2 (2017-09-14 patchlevel 198) [x86_64-linux-gnu]
  - INSTALLATION DIRECTORY: /usr/lib64/ruby/gems/2.4.0
  - USER INSTALLATION DIRECTORY: /home/chris/.gem/ruby/2.4.0
  - RUBY EXECUTABLE: /usr/bin/ruby.ruby2.4
  - EXECUTABLE DIRECTORY: /usr/bin
  - SPEC CACHE DIRECTORY: /home/chris/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/lib64/ruby/gems/2.4.0
     - /home/chris/.gem/ruby/2.4.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => true
     - :bulk_threshold => 1000
     - :benchmark => false
     - :install => "--format-executable --no-user-install"
     - "install" => "--format-executable --no-user-install"
     - :format_executable => true
     - :update => "--format-executable --no-user-install"
     - "update" => "--format-executable --no-user-install"
     - :sources => ["https://rubygems.org"]
  - REMOTE SOURCES:
     - https://rubygems.org
  - SHELL PATH:
     - /home/chris/Software/nvm/versions/node/v8.9.3/bin
     - /home/chris/.go/bin
     - /home/chris/Software/Salome/appli_V8_2_0
     - /opt/mssql-tools/bin
     - /usr/local/cuda/bin
     - /home/chris/Software/hdf5/install/bin
     - /home/chris/Software/openmpi/install/bin
     - /home/chris/Software/dakota/install/bin
     - /home/chris/Software/dakota/install/test
     - /home/chris/.gem/ruby/2.4.0/bin
     - /home/chris/.cargo/bin
     - /usr/sbin
     - /home/chris/bin
     - /home/chris/.local/bin
     - /home/chris/.local/bin
     - /home/chris/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/lib/mit/sbin
@justinmk
Copy link
Member

Is there a simple way of making the health check a bit more lenient?

Guess the provider needs to be enhanced. @alexgenco any reason a global install would be required?

@mhinz
Copy link
Member

mhinz commented Dec 16, 2017

Ruby was compiled with --program-suffix=2.4 and --format-executable is used in the gemrc, so each executable installed by a gem will have that suffix as well.

exepath() won't cut it in that case. I guess we'll need a new function that searches for a pattern in $PATH.

@alexgenco
Copy link
Contributor

Can't you fix this by overriding g:ruby_host_prog? Added here: #6841

@cbcoutinho
Copy link
Author

I'm not sure if that applies to my system, but I'm not an expert on ruby so excuse my ignorance - I didn't install the neovim gem using rvm. I was just able to download ruby and gem from my package manager (opensuse, zypper) and install neovim as I described above. Would the solution mentioned in that PR require neovim was installed using rvm?

@alexgenco
Copy link
Contributor

@cbcoutinho in your case you could add to your init.vim:

let g:ruby_host_prog = '/home/chris/.gem/ruby/2.4.0/bin/neovim-ruby-host.ruby2.4'

RVM was just used as an example in that PR; any arbitrary path or command can be used.

@cbcoutinho
Copy link
Author

cbcoutinho commented Dec 16, 2017 via email

@alexgenco
Copy link
Contributor

Should we add some information about g:ruby_host_prog in the CheckHealth output if it can't find the executable?

@justinmk
Copy link
Member

Sure

@alexzaizar09
Copy link

i am using asdf as my version manager and I have set let g:ruby_host_prog = '~/.asdf/installs/ruby/2.7.1/bin/neovim-ruby-host' in my init.vim at the top of the file, but it keeps saying failed to run: gem list -ra ^neovim$ does anyone know why is this not setting the correct version for ruby? and I also have the same problem with nodejs

@alexgenco
Copy link
Contributor

@alexzaizar09 this makes sense if gem isn't aware of asdf installation, but does the ruby provider actually work though? Like if you run :ruby puts 1 do you get output?

The health check might need to be a little smarter when g:ruby_host_prog is set.

@alexzaizar09
Copy link

yes, ruby and node are working inside the working directory without any problem, but neovim does not detect them

@alexgenco
Copy link
Contributor

Is gem not in your path? I imagine you would need to export PATH="$PATH:$HOME/.asdf/installs/ruby/2.7.1/bin" somewhere, assuming gem is in there as well (I've never used asdf before, not really sure how it works)

@alexzaizar09
Copy link

gem is inside the asdf installation, and not it is not in my path cause that is the reason for using a version manager. I need to switch between different versions of ruby, including the gem executable that is why you point neovim to some specific version you want to reference, not?

@alexgenco
Copy link
Contributor

Is the only problem here that your healthcheck is returning an error? If you just want a clean health check, setting the path as I mentioned should fix it. We could probably add something like g:ruby_gem_prog or something but that seems kind of misleading since only the health check would use it. We should probably also update the healthcheck messaging to make it more clear that it specifically can't find the gem executable.

@alexzaizar09
Copy link

no, the problem is that plugins that depend upon ruby or node are not working for example COC

@alexgenco
Copy link
Contributor

Ok sorry, I misunderstood. As far as I know (this may have changed), the gem command is only needed to check for the latest version of the gem in the healthcheck, but otherwise the ruby provider should be working as intended, so I think there is something else going on. A couple things to try:

  • start up nvim with the path as I specified earlier: PATH="$PATH:$HOME/.asdf/installs/ruby/2.7.1/bin" nvim and see if things work as expected
  • enabled debug logging: touch /tmp/nvim-ruby.log; NVIM_RUBY_LOG_LEVEL=debug NVIM_RUBY_LOG_FILE=/tmp/nvim-ruby.log nvim +'ruby puts 1' and post what's in /tmp/nvim-ruby.log

Unfortunately I can't really help with node.js.

@alexzaizar09
Copy link

hum, really curious, there is nothing inside the /tmp/nvim-ruby.log and COC still is not working. A bit of context inside every project i have a .tool-versions where asdf defines my local version, and the ruby script just printing "HI" does work fine as it also works which ruby with the correct version. I hate to have this problem this has been my go-to text editor for years, and know i have to use VSCode which opens slow and other stuff

@alexgenco
Copy link
Contributor

the ruby script just printing "HI" does work fine

Do you mean printing from an nvim command, e.g. :ruby puts "HI"?

COC still is not working

How isn't it working? Is there an error message?

I looked a little bit into asdf, it looks like it might be worth trying let g:ruby_host_prog = 'asdf exec neovim-ruby-host'

@alexzaizar09
Copy link

The ruby script ran from the command line as ruby main.rb is correctly printing "HI", while also the console responds with the correct ruby version. COC is not working because it is nor detecting errors nor completing any word. Pointing asdf exec neovim || gem || ruby doesn't work, the check health keeps throwing the same error messages and COC still is not working

@alexgenco
Copy link
Contributor

Can you please run :ruby puts 1 in nvim and tell me what it prints? I need specific error messages or I can't help.

The :checkhealth error is irrelevant, likely a different issue. :ruby puts 1 is the true test if the provider is working. Please make sure you've tried all my previous suggestions with :ruby puts 1, NOT :checkhealth.

@Gregory9931
Copy link

Just don't understand how this works guess just new

@alexzaizar09
Copy link

the provider is working for both if that is your test, but the plugins are not, so which is it? To be clear, :ruby puts 1 prints 1 and lets me press enter to get out of the terminal

@alexgenco
Copy link
Contributor

@alexzaizar09 Then the problem is likely with your COC configuration, not with the Ruby provider, which is working.

@alexzaizar09
Copy link

@alexgenco the thing is that if I switch into a folder where I define through asdf the same versions I'm pointing to in the *_prog declarations suddenly it all works, Node and Ruby so how about that?

@alexzaizar09
Copy link

So the ruby portion is working, I didn't change anything it is simply working, but the node portion change the error for this: ERROR: Failed to run: ['node', '/home/alex/.asdf/installs/nodejs/13.14.0/ bin/node', '--version'] does anyone know why is this not overriding the node execution path from: let g:node_host_prog = '~/.asdf/installs/nodejs/13.14.0/.npm/bin/neovim-node-host'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants