ruby / debug

Debugging functionality for Ruby
BSD 2-Clause "Simplified" License
1.14k stars 127 forks source link

Fix DAP's completion request with new IRB's completor #1025

Closed st0012 closed 1 year ago

st0012 commented 1 year ago

In IRB 1.8.2, the completor's design and API has been changed and thus would break DAP server's completion request. This commit fixes the issue by introducing a Completor class that abstracts away the differences between the old and new completor.

cc @tompng

st0012 commented 1 year ago

With https://github.com/ruby/irb/pull/730, the request should not be broken anymore once it's released. And while it's still better not to use the deprecated InputCompletor, I think we can wait a while to see how the new API will evolve before updating it.

ko1 commented 1 year ago

I'm not sure but also LSP may need completion feature so different library is another idea for completion?

st0012 commented 1 year ago

You're right, LSP also needs completion feature and we're building one in ruby-lsp with a inhouse indexer, which we hope to extract into a gem when it's feature-completed.

But unlike a LSP server, IRB and debug both have access to binding objects and runtime information, which means it can get great completion result without going through the expensive indexing process. So I think it's still worth exploring a different completor for IRB and debug.