castwide / readapt

A Ruby debugger for the Debug Adapter Protocol.
MIT License
42 stars 3 forks source link

Repl error for Ruby #12

Closed sphynx79 closed 2 years ago

sphynx79 commented 3 years ago

I try to use this gem with Neovim 5.0 in Windows 10 and dap-neovim, but when i try to use the repl o receive the following issues

Debug adapter definition and debug configuration

:gem install readapt

local dap = require('dap')

dap.adapters.ruby = {
  type = 'executable';
  command = 'ruby.exe';
  args = {"C:\\Ruby3\\bin\\readapt", 'stdio'};
}

dap.configurations.ruby = {
  {
    type = 'ruby',
    request = 'launch',
    name = 'File',
    cwd = vim.fn.getcwd(),
    program = '${workspaceFolder}/main.rb',
  },
}

Debug adapter version

readapt 1.4.1

Steps to Reproduce

Set breakpoint Start Debugger Try print variable in repl

Expected Result

print variable in repl console

Actual Result

https://user-images.githubusercontent.com/5004160/126904844-d7840fd3-3a7f-4096-a296-3071189609e0.mp4

dap>
dap> p ciao
"ciao"
"ciao"
#<Thread:0x0000000008b4e800 C:/Ruby3/lib/ruby/gems/3.0.0/gems/backport-1.2.0/lib/backport/client.rb:104 run> terminated with exception (report_on_exception is true):
C:/Ruby3/lib/ruby/gems/3.0.0/gems/readapt-1.4.1/lib/readapt/message/variables.rb:7:in `ru
n': no implicit conversion of String into Integer (TypeError)
    from C:/Ruby3/lib/ruby/gems/3.0.0/gems/readapt-1.4.1/lib/readapt/message.rb:38:in `process'
    from C:/Ruby3/lib/ruby/gems/3.0.0/gems/readapt-1.4.1/lib/readapt/adapter.rb:68:in `process'
    from C
:/Ruby3/lib/ruby/gems/3.0.0/gems/readapt-1.4.1/lib/readapt/adapter.rb:39:in `block in opening'
    from C:/Ruby3/lib/ruby/gems/3.0.0/gems/readapt-1.4.1/lib/readapt/data_reader.rb:51:in `parse_message_from_buffer'
    from C:/Ruby3/lib/ruby/gems/3.0.0/gems/reada
pt-1.4.1/lib/readapt/data_reader.rb:29:in `block in receive'
    from C:/Ruby3/lib/ruby/gems/3.0.0/gems/readapt-1.4.1/lib/readapt/data_reader.rb:24:in `each_char'
    from C:/Ruby3/lib/ruby/gems/3.0.0/gems/readapt-1.4.1/lib/readapt/data_reader.rb:24:in `receive
'
    from C:/Ruby3/lib/ruby/gems/3.0.0/gems/readapt-1.4.1/lib/readapt/adapter.rb:48:in `receiving'
    from C:/Ruby3/lib/ruby/gems/3.0.0/gems/backport-1.2.0/lib/backport/client.rb:66:in `tick'
    from C:/Ruby3/lib/ruby/gems/3.0.0/gems/backport-1.2.0/lib/backport
/server/stdio.rb:23:in `update'
    from C:/Ruby3/lib/ruby/3.0.0/observer.rb:222:in `block in notify_observers'
    from C:/Ruby3/lib/ruby/3.0.0/observer.rb:221:in `each'
    from C:/Ruby3/lib/ruby/3.0.0/observer.rb:221:in `notify_observers'
    from C:/Ruby3/lib/rub
y/gems/3.0.0/gems/backport-1.2.0/lib/backport/client.rb:124:in `read_input'
    from C:/Ruby3/lib/ruby/gems/3.0.0/gems/backport-1.2.0/lib/backport/client.rb:105:in `block in run_input_thread'
dap> 
castwide commented 3 years ago

Based on the error logs in https://github.com/mfussenegger/nvim-dap/issues/254, it appears the problem is the variables request with the empty body, represented as an empty array instead of an empty hash. I might be able to convert the value to avoid this particular error, but even given that change, I think the request is invalid according to the DAP specification.

mfussenegger commented 3 years ago

Based on the error logs in mfussenegger/nvim-dap#254, it appears the problem is the variables request with the empty body, represented as an empty array instead of an empty hash. I might be able to convert the value to avoid this particular error, but even given that change, I think the request is invalid according to the DAP specification.

Agree that it is invalid according to the DAP specification. As far as I could tell the request isn't coming from nvim-dap itself, but must be coming from one of the extensions for it.

turboladen commented 3 years ago

FWIW, I'm also getting this, but using:

castwide commented 2 years ago

I'm closing this as it was likely an issue with the neovim plugin. If problems persist, please feel free to open a new issue.