diff options
author | tomoya ishida <[email protected]> | 2023-03-06 14:52:41 +0900 |
---|---|---|
committer | git <[email protected]> | 2023-03-06 05:52:46 +0000 |
commit | 0463c5806ac63bbd082f4abb1e3ceeae6ffc39ce (patch) | |
tree | ff89816a2a08cc3d9d5af7ab7bb4b9d8c26ce756 /lib/irb/completion.rb | |
parent | 62e2b61607c04ff0d2543f0515b2171a24e66b4e (diff) |
[ruby/irb] Improve method completion for string and regexp that
includes word break characters
(https://github.com/ruby/irb/pull/523)
* Improve method completion for string and regexp that includes word break characters
* Remove completion-test's assert_not_include because candidates no longer include every possible methods
* Add comment about string's method completion regexp
Co-authored-by: Stan Lo <[email protected]>
* Add comment about regexp's method completion regexp
Co-authored-by: Stan Lo <[email protected]>
---------
https://github.com/ruby/irb/commit/aa8128c533
Co-authored-by: Stan Lo <[email protected]>
Diffstat (limited to 'lib/irb/completion.rb')
-rw-r--r-- | lib/irb/completion.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb index 76111393b6..c21ebfbdbd 100644 --- a/lib/irb/completion.rb +++ b/lib/irb/completion.rb @@ -166,10 +166,12 @@ module IRB def self.retrieve_completion_data(input, bind: IRB.conf[:MAIN_CONTEXT].workspace.binding, doc_namespace: false) case input - when /^((["'`]).*\2)\.([^.]*)$/ + # this regexp only matches the closing character because of irb's Reline.completer_quote_characters setting + # details are described in: https://github.com/ruby/irb/pull/523 + when /^(.*["'`])\.([^.]*)$/ # String receiver = $1 - message = $3 + message = $2 if doc_namespace "String.#{message}" @@ -178,7 +180,9 @@ module IRB select_message(receiver, message, candidates) end - when /^(\/[^\/]*\/)\.([^.]*)$/ + # this regexp only matches the closing character because of irb's Reline.completer_quote_characters setting + # details are described in: https://github.com/ruby/irb/pull/523 + when /^(.*\/)\.([^.]*)$/ # Regexp receiver = $1 message = $2 |