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

Unable to start LSP Server #1485

Closed
happer64bit opened this issue Aug 8, 2022 · 6 comments
Closed

Unable to start LSP Server #1485

happer64bit opened this issue Aug 8, 2022 · 6 comments

Comments

@happer64bit
Copy link

"> Ruby LSP: Start"

[Error - 10:24:52 PM] Ruby LSP client: couldn't create connection to server.
Launching server using command bundle failed. Error: spawn bundle ENOENT

@vinistock
Copy link
Member

Can you provide more context? Do you have the ruby-lsp gem installed? Which Ruby version manager are you using?

@happer64bit
Copy link
Author

@vinistock I already install ruby-lsp with gem install ruby-lsp and My Ruby version is Ruby+Devkit 3.1.2-1 (x64) from https://rubyinstaller.org/

@vinistock
Copy link
Member

We currently only support shadowenv as a Ruby version manager. The work to add support for more version managers is in #1481 and I have added rubyinstaller to the list.

The LSP should work properly once the issue is completed.

@cstrahan-blueshift
Copy link

cstrahan-blueshift commented Aug 24, 2022

EDIT:

It seems auto-completion isn't supported without Sorbet: #61

And I'm guessing the same is true for documentation pop-ups on hover, etc.

Code formatting and diagnostics (e.g. syntax errors) are working though!

Leaving my original comment in case it helps anyone else that ends up here via their favorite search engine:


@vinistock In the interim, could you provide some guidance on what's required in the shadowenv config? I've cobbled together the following (in .shadowenv.d/ruby.lisp):

(provide "ruby" "2.7.5")

(when-let ((ruby-root (env/get "RUBY_ROOT")))
 (env/remove-from-pathlist "PATH" (path-concat ruby-root "bin"))
 (when-let ((gem-root (env/get "GEM_ROOT")))
   (env/remove-from-pathlist "PATH" (path-concat gem-root "bin")))
 (when-let ((gem-home (env/get "GEM_HOME")))
   (env/remove-from-pathlist "PATH" (path-concat gem-home "bin"))))

(env/set "GEM_PATH" ())
(env/set "GEM_HOME" ())
(env/set "RUBYOPT" ())

(env/set "RUBY_ROOT" (path-concat (env/get "HOME") ".rvm/rubies/ruby-2.7.5"))
(env/prepend-to-pathlist "PATH" (path-concat (env/get "RUBY_ROOT") "bin"))
(env/set "RUBY_ENGINE" "ruby")
(env/set "RUBY_VERSION" "2.7.5")
(env/set "GEM_ROOT" (path-concat (env/get "HOME") ".rvm/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0"))

(when-let ((gem-root (env/get "GEM_ROOT")))
  (env/prepend-to-pathlist "GEM_PATH" gem-root)
  (env/prepend-to-pathlist "PATH" (path-concat gem-root "bin")))

(let ((gem-home  
      (path-concat (env/get "HOME") ".rvm/gems/ruby-2.7.5@recommendation-service")))
  (do
    (env/set "GEM_HOME" gem-home)
    (env/prepend-to-pathlist "GEM_PATH" gem-home)
    (env/prepend-to-pathlist "PATH" (path-concat gem-home "bin"))))

And the ruby-lsp extension no longer reports any problems, but I still don't get any autocompletion/docs-on-hover/etc.

The only messages I see in VSCode's "Ruby LSP" OUTPUT tab is:

/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/syntax_tree-3.4.0/lib/syntax_tree/node.rb:609: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/syntax_tree-3.4.0/lib/syntax_tree/node.rb:1147: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/syntax_tree-3.4.0/lib/syntax_tree/node.rb:1406: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/syntax_tree-3.4.0/lib/syntax_tree/node.rb:2125: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/syntax_tree-3.4.0/lib/syntax_tree/node.rb:2252: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/syntax_tree-3.4.0/lib/syntax_tree/node.rb:2355: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/syntax_tree-3.4.0/lib/syntax_tree/node.rb:2380: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/syntax_tree-3.4.0/lib/syntax_tree/node.rb:2426: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/syntax_tree-3.4.0/lib/syntax_tree/node.rb:2452: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/syntax_tree-3.4.0/lib/syntax_tree/node.rb:2468: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/syntax_tree-3.4.0/lib/syntax_tree/node.rb:2478: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/syntax_tree-3.4.0/lib/syntax_tree/node.rb:2505: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/syntax_tree-3.4.0/lib/syntax_tree/node.rb:2610: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/syntax_tree-3.4.0/lib/syntax_tree/node.rb:2773: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/syntax_tree-3.4.0/lib/syntax_tree/node.rb:2975: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/syntax_tree-3.4.0/lib/syntax_tree/node.rb:3070: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/syntax_tree-3.4.0/lib/syntax_tree/node.rb:5200: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/syntax_tree-3.4.0/lib/syntax_tree/node.rb:5191: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/syntax_tree-3.4.0/lib/syntax_tree/node.rb:5359: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/syntax_tree-3.4.0/lib/syntax_tree/parser.rb:596: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/syntax_tree-3.4.0/lib/syntax_tree/parser.rb:1556: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/syntax_tree-3.4.0/lib/syntax_tree/parser.rb:1982: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!
Starting Ruby LSP...
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
/home/cstrahan/.rvm/gems/ruby-2.7.5@recommendation-service/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated

@vinistock
Copy link
Member

vinistock commented Aug 25, 2022

@cstrahan-blueshift indeed the features you mentioned aren't supported without Sorbet. Implementing them accurately requires type checking, which the Ruby LSP does not do.

Based on the output in VS Code, the Ruby LSP seems to be working properly.

We have ideas on how to implement a more naive approach to things like go to definition, hover, signature help and autocompletion, based on simple indexing and name matching, but we haven't gotten to explore them yet. The issues are in our roadmap.

@happer64bit
Copy link
Author

@cstrahan-blueshift How to install shadowenv on windows?

jayanth-kumar-morem referenced this issue in jayanth-kumar-morem/vscode-ruby-lsp Apr 26, 2023
@vinistock vinistock transferred this issue from Shopify/vscode-ruby-lsp Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants