ruby-lsp icon indicating copy to clipboard operation
ruby-lsp copied to clipboard

Debug fails: Could not find set-1.1.0 in any of the sources

Open thomthom opened this issue 1 year ago • 2 comments

Operating System

Windows 11

Ruby version

ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x64-mingw-ucrt]

Project has a bundle

  • [X] Has bundle

Ruby version manager being used

no manager

Description

I have a fresh install of VSCode Insider. Installed only the Ruby LSP extension.

Set a breakpoint in a ruby file, and tried to start the debugger with the following settings:

    {
      "type": "ruby_lsp",
      "request": "launch",
      "name": "Debug file",
      "program": "ruby ${file}"
    },

It fails with the following error: image

The Output doesn't list anything other than:

2024-02-01 16:41:27.547 [info] Spawning debugger in directory c:\Users\Thomas\SourceTree\sketchup-extension-vscode-project
2024-02-01 16:41:27.547 [info]    Command bundle exec rdbg --port 49682 --open --command -- ruby C:\Users\Thomas\SourceTree\sketchup-extension-vscode-project\src\ex_hello_cube.rb
2024-02-01 16:41:27.547 [info]    Environment { ... }

If I launch the command from that log in the terminal I get the following error:

C:\Users\Thomas\SourceTree\sketchup-extension-vscode-project>bundle exec rdbg --port 49542 --open --command -- ruby C:\Users\Thomas\SourceTree\sketchup-extension-vscode-project\src\ex_hello_cube.rb
Could not find set-1.1.0 in locally installed gems
Run `bundle install` to install missing gems.

My Gemfile file:

source 'https://rubygems.org'

group :ide do
  gem 'sketchup-api-stubs'       # VSCode SketchUp Ruby API insight
end

group :development do
  gem 'minitest' # Helps solargraph with code insight when you write unit tests.
  gem 'skippy', '~> 0.5.1.a'     # Aid with common SketchUp extension tasks.
  # gem 'solargraph'               # VSCode Ruby IDE support
end

group :documentation do
  gem 'commonmarker', '~> 0.23'
  gem 'yard', '~> 0.9'
end

group :analysis do
  gem 'rubocop', '>= 1.30', '< 2.0'  # Static analysis of Ruby Code.
  gem 'rubocop-sketchup', '~> 1.4.0' # Auto-complete for the SketchUp Rub API.
end

The Ruby file is simply:

module Examples # TODO: Change module name to fit the project.
  module HelloCube

    unless file_loaded?(__FILE__)
      ex = SketchupExtension.new('Hello Cube', 'ex_hello_cube/main')
      ex.description = 'SketchUp Ruby API example creating a cube.'
      ex.version     = '1.0.0'
      ex.copyright   = 'Trimble Inc © 2016-2022'
      ex.creator     = 'SketchUp'
      Sketchup.register_extension(ex, true)
      file_loaded(__FILE__)
    end

  end # module HelloCube
end # module Examples

Any idea why it's failing because of missing set gem? I was about to just install it, but figured I'd log this in case it's a bug.

thomthom avatar Feb 01 '24 15:02 thomthom

I did try to add 'set' to Gemfile. Didn't help. I also did a gem install set:

C:\Users\Thomas\SourceTree\sketchup-extension-vscode-project>gem install set
Successfully installed set-1.1.0
Parsing documentation for set-1.1.0
Installing ri documentation for set-1.1.0
Done installing documentation for set after 0 seconds
1 gem installed

But I still get the same error.

thomthom avatar Feb 01 '24 16:02 thomthom

Thank you for the bug report!

I think the issue is that the command being executed is not using bundle exec, which would explain why dependencies in the Gemfile are being ignored.

If you try adding bundle exec in front of ruby, does it solve the issue? Like this:

bundle exec rdbg --port 49542 --open --command -- bundle exec ruby C:\Users\Thomas\SourceTree\sketchup-extension-vscode-project\src\ex_hello_cube.rb

Notice that there are two bundle exec statements. One to launch the rdbg executable and the other for the command that is launched by rdbg itself.

vinistock avatar Feb 05 '24 19:02 vinistock

This issue is being marked as stale because there was no activity in the last 2 months

github-actions[bot] avatar May 18 '24 12:05 github-actions[bot]

Closing this for now. Please let us know if you think the issue is with the Ruby LSP and hasn't been resolved.

vinistock avatar May 27 '24 18:05 vinistock