From 4ecf3b7832d4c9df641d333b68de2523a5bbd8af Mon Sep 17 00:00:00 2001 From: Aditya <152765789+adityawrk@users.noreply.github.com> Date: Sun, 29 Nov 2026 09:15:52 +0530 Subject: [PATCH] Ask IRB's RegexpCompletor for DAP completions IRB::InputCompletor is deprecated. Completion requests warned "constant IRB::InputCompletor is deprecated" whenever verbose warnings were enabled. The deprecated method only forwards to RegexpCompletor with doc_namespace: false, so call that directly. --- lib/debug/server_dap.rb | 5 +++- test/protocol/completion_deprecation_test.rb | 30 ++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 test/protocol/completion_deprecation_test.rb diff --git a/lib/debug/server_dap.rb b/lib/debug/server_dap.rb index 907db2d1f..3c7dbf535 100644 --- a/lib/debug/server_dap.rb +++ b/lib/debug/server_dap.rb @@ -982,7 +982,10 @@ def process_dap args frame = get_frame(fid) if (b = frame&.binding) && word = text&.split(/[\s\{]/)&.last - words = IRB::InputCompletor::retrieve_completion_data(word, bind: b).compact + # InputCompletor is deprecated and forwards here (debug#1079). + words = IRB::RegexpCompletor.new.retrieve_completion_data( + word, bind: b, doc_namespace: false + ).compact end event! :protocol_result, :completions, req, targets: (words || []).map{|phrase| diff --git a/test/protocol/completion_deprecation_test.rb b/test/protocol/completion_deprecation_test.rb new file mode 100644 index 000000000..6bc92ecb2 --- /dev/null +++ b/test/protocol/completion_deprecation_test.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +require_relative '../support/protocol_test_case' + +module DEBUGGER__ + class CompletionDeprecationTest < ProtocolTestCase + PROGRAM = <<~RUBY + 1| a = 1 + 2| a.itself + RUBY + + def test_completions_do_not_warn_about_input_completor + previous = ENV['RUBYOPT'] + # deprecate_constant is silent unless verbose warnings are on + ENV['RUBYOPT'] = [previous, '-w'].compact.join(' ') + run_protocol_scenario PROGRAM, cdp: false do + find_response :event, 'stopped', 'V