-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix DAP's completion request with new IRB's completor
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.
- Loading branch information
Showing
2 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# frozen_string_literal: true | ||
|
||
require "irb/completion" | ||
|
||
module DEBUGGER__ | ||
class Completor | ||
class << self | ||
# old IRB completion API | ||
if defined?(IRB::InputCompletor) | ||
def retrieve_completion_data(input, binding) | ||
IRB::InputCompletor.retrieve_completion_data(input, bind: binding).compact | ||
end | ||
else | ||
COMPLETOR = IRB::RegexpCompletor.new | ||
|
||
def retrieve_completion_data(input, binding) | ||
COMPLETOR.retrieve_completion_data(input, bind: binding, doc_namespace: false).compact | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters