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

RubyLSP in windows 10 stuck on starting #2369

Closed
motebaya opened this issue Jul 26, 2024 · 3 comments
Closed

RubyLSP in windows 10 stuck on starting #2369

motebaya opened this issue Jul 26, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@motebaya
Copy link

Description

on Linux, it works fine without any issues, but for the past 2 days, i have been trying it on win10, and RubyLSP won't run on Vscode. it stuck at the 'starting' state.

i thought it was a duplicate of #2286, but it's not; this is just a simple project with a Gemfile file: #2286 (comment)

ruby version: ruby 3.3.4 (2024-07-09 revision be1089c8ec) [x64-mingw-ucrt]
ruby-lsp:

➜ bundle info ruby-lsp
  * ruby-lsp (0.17.9)
        Summary: An opinionated language server for Ruby
        Homepage: https://github.com/Shopify/ruby-lsp
        Documentation: https://shopify.github.io/ruby-lsp/                                             
        Path: D:/Software/Ruby33-x64/lib/ruby/gems/3.3.0/gems/ruby-lsp-0.17.9

what i do:

create folder/file and open it with powershell
mkdir tryruby
cd tryruby
touch main.rb
bundle init
bundle add httparty --group production
bundle add ruby-lsp --group development
code .
Gemfile ``` # frozen_string_literal: true
source "https://rubygems.org"

# gem "rails"

gem "httparty", "~> 0.22.0", :group => :production

gem "ruby-lsp", "~> 0.17.9", :group => :development
```
Gemfile.lock
  GEM
    remote: https://rubygems.org/
    specs:
      bigdecimal (3.1.8)
      csv (3.3.0)
      httparty (0.22.0)
        csv
        mini_mime (>= 1.0.0)
        multi_xml (>= 0.5.2)
      language_server-protocol (3.17.0.3)
      logger (1.6.0)
      mini_mime (1.1.5)
      multi_xml (0.7.1)
        bigdecimal (~> 3.1)
      prism (0.30.0)
      rbs (3.5.2)
        logger
      ruby-lsp (0.17.9)
        language_server-protocol (~> 3.17.0)
        prism (>= 0.29.0, < 0.31)
        rbs (>= 3, < 4)
        sorbet-runtime (>= 0.5.10782)
      sorbet-runtime (0.5.11495)
  
  PLATFORMS
    x64-mingw-ucrt
  
  DEPENDENCIES
    httparty (~> 0.22.0)
    ruby-lsp (~> 0.17.9)
  
  BUNDLED WITH
     2.5.16
main.rb
require 'httparty'
ip = HTTParty.get('https://httpbin.org/ip', {
  headers: {
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36'
  }
}).body
puts ip

output tab in VScode

Screenshot 2024-07-26 170700

in powershell

image

i don't know what's going on here, even after completely uninstalling VSCode and reinstalling it, nothing changed and it's still the same.

@motebaya motebaya added the bug Something isn't working label Jul 26, 2024
@vinistock
Copy link
Member

Thank you for the bug report. It seems that you're using the custom version manager, but in the output tab no command was printed. If you look at the first line of the first screenshot, the command we tried to run was && ruby ..., which makes me think there's no command given the empty space before the &&.

How are you setting up the version manager? If you completely remove all version manager configuration and either rely on the RubyInstaller integration or select the Ruby version manually, does it work?

@motebaya
Copy link
Author

Thank you for the bug report. It seems that you're using the custom version manager, but in the output tab no command was printed. If you look at the first line of the first screenshot, the command we tried to run was && ruby ..., which makes me think there's no command given the empty space before the &&.

How are you setting up the version manager? If you completely remove all version manager configuration and either rely on the RubyInstaller integration or select the Ruby version manually, does it work?

I have tried using rbenv from https://github.com/ccmywish/rbenv-for-windows because i thought it was the only one I could find for Windows, but a different issue came;

setup rbenv in $PROFILE following docs and reinstall ruby
image_2024-07-27_00-50-47
Screenshot 2024-07-27 013101

i also adding RUBY_VERSION to env path .
but, here the log from output tab vscode:
Screenshot 2024-07-27 011304

I don't know why the ruby version is still not detected and shows as undefined. i have even created a .ruby_version file with 3.3.3-1 in current project folder and added RUBY_VERSION to the ENV path.

full log:
log.txt

The linter and snippets work as well, but autocomplete doesn't work at all (because LSP is not running yet).
Screenshot 2024-07-27 012644

If there's anything needed to investigate the issue, please let me know. I'll provide it.!

@motebaya
Copy link
Author

Closed this, because the issue has been resolved. i think the problem was the default terminal in VSCode not being compatible. i tried switching it to Git Bash, but that didn't help. Then, when I switched it to Windows PowerShell (C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe), it worked perfectly! I don't even know why!
Screenshot 2024-07-27 142947

Screenshot 2024-07-27 144049
Screenshot 2024-07-27 144019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants