onivim / oni

Oni: Modern Modal Editing - powered by Neovim
https://www.onivim.io
MIT License
11.36k stars 301 forks source link

Solargraph error with Ruby 2.5.1 #2676

Closed npupko closed 5 years ago

npupko commented 5 years ago

image

Oni Version: 0.3.6 Neovim Version: 0.3.1 Operating System: Mac OS Mojave 10.14.2 Solargraph: 0.29.4 Ruby: 2.5.1

Issue: Can not use language server with Oni

Expected behavior: Autocomplete for ruby

Actual behavior: Errors in console

Steps to reproduce: Just install Oni and add to config:

  "language.ruby.languageServer.command": "solargraph",
  "language.ruby.languageServer.arguments": ["stdio"],
oni-bot[bot] commented 5 years ago

Hello and welcome to the Oni repository! Thanks for opening your first issue here. To help us out, please make sure to include as much detail as possible - including screenshots and logs, if possible.

badosu commented 5 years ago

ENOENT seems like Oni can't find the executable for solargraph.

You can install the gem on your system ruby or tweak the command to find the executable, I use 2.5.1 here and it works.

npupko commented 5 years ago

@badosu Does Oni work with RVM? Should I somehow configure it?

badosu commented 5 years ago

@npupko Not sure, you would have to check which ruby version you're using and since this is a per-project configuration I don't think that would be feasible. Would be a good feature for an oni ruby plugin though.

If you want to use the default ruby version that RVM uses in your shell you should be able to find the executable by running which ruby or which solargraph.

badosu commented 5 years ago

Closing as it is not actually a bug in Oni as far as I can see, please reopen if you're not able to use it with a system ruby or after specifying the RVM path for your installed solargraph.

npupko commented 5 years ago

Thanks! I got it. Everything worked out

codeluggage commented 5 years ago

Adding my experience here in case it helps someone:

I ran into the same issue. I use rbenv and my gems lived in /Users/mf/.rbenv/shims/solargraph. To get this working for Oni, I used this configuration:

export const configuration = {
     ...
    "language.ruby.languageServer.command": "/Users/mf/.rbenv/shims/solargraph",
    "language.ruby.languageServer.arguments": ["stdio"],
}

I had to restart the editor completely for this to take effect.