Feature #4222
Irb tab completion support for the valid (but rare) obj::method invocation syntax
| Status: | Closed | Start date: | 12/29/2010 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | lib | |||
| Target version: | 1.9.3 |
Description
class MyC
def my_method
true
end
end
a = MyC.new
# This is a valid method invocation syntax (rare, but valid)
a::my_method # => true
But when you type in irb
a::<press tab>
No tab-completion from irb.
a.<press tab> is working well.
So, I think the small patch bellow could implement this feature.
Index: lib/irb/completion.rb
===================================================================
--- lib/irb/completion.rb (revisão 30417)
+++ lib/irb/completion.rb (cópia de trabalho)
@@ -131,7 +131,8 @@
# when /^(\$?(\.?[^.]+)+)\.([^.]*)$/
# when /^((\.?[^.]+)+)\.([^.]*)$/
- when /^([^."].*)\.([^.]*)$/
+# when /^([^."].*)\.([^.]*)$/
+ when /^([^."].*)(?:\.|::)([^.]*)$/
# variable
receiver = $1
message = Regexp.quote($2)
I'm at
ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-linux]
Ubuntu 10.04 amd64
History
Updated by yugui (Yuki Sonoda) over 1 year ago
Thank you, Abinoam. On Wed, Dec 29, 2010 at 1:10 PM, Abinoam P. Marques Jr. <redmine@ruby-lang.org> wrote: > Feature #4222: Irb tab completion support for the valid (but rare) obj::method invocation syntax > http://redmine.ruby-lang.org/issues/show/4222 Keiju, Is it an intended feature or just a lack of implementation? -- Yuki Sonoda (Yugui) yugui@yugui.jp http://yugui.jp
Updated by yugui (Yuki Sonoda) over 1 year ago
- Category set to lib
- Status changed from Open to Assigned
- Assignee set to keiju (Keiju Ishitsuka)
- Priority changed from Low to Normal
- Target version set to 1.9.3
Updated by yugui (Yuki Sonoda) over 1 year ago
石塚さん、 [ruby-core:33987]の件、現状が意図した仕様という訳でないならばマージしようかと思いますが、どうでしょうか。 ---------- Forwarded message ---------- From: Abinoam P. Marques Jr. <redmine@ruby-lang.org> Date: Wed, Dec 29, 2010 at 1:10 PM Subject: [ruby-core:33987] [Ruby 1.9-Feature#4222][Open] Irb tab completion support for the valid (but rare) obj::method invocation syntax To: ruby-core@ruby-lang.org Feature #4222: Irb tab completion support for the valid (but rare) obj::method invocation syntax http://redmine.ruby-lang.org/issues/show/4222 Author: Abinoam P. Marques Jr. Status: Open, Priority: Low class MyC def my_method true end end a = MyC.new # This is a valid method invocation syntax (rare, but valid) a::my_method # => true But when you type in irb a::<press tab> No tab-completion from irb. a.<press tab> is working well. So, I think the small patch bellow could implement this feature. Index: lib/irb/completion.rb =================================================================== --- lib/irb/completion.rb (revisão 30417) +++ lib/irb/completion.rb (cópia de trabalho) @@ -131,7 +131,8 @@ # when /^(\$?(\.?[^.]+)+)\.([^.]*)$/ # when /^((\.?[^.]+)+)\.([^.]*)$/ - when /^([^."].*)\.([^.]*)$/ +# when /^([^."].*)\.([^.]*)$/ + when /^([^."].*)(?:\.|::)([^.]*)$/ # variable receiver = $1 message = Regexp.quote($2) I'm at ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-linux] Ubuntu 10.04 amd64 ---------------------------------------- http://redmine.ruby-lang.org -- Yuki Sonoda (Yugui) yugui@yugui.jp http://yugui.jp Attachment: tab-completion-for-rare-method-invocation-syntax.patch
Updated by keiju (Keiju Ishitsuka) over 1 year ago
けいじゅ@いしつかです. Yugui <yugui@yugui.jp> wrote: > 石塚さん、 どもです. > [ruby-core:33987]の件、現状が意図した仕様という訳でないならばマージ > しようかと思いますが、どうでしょうか。 これで良いような気もしますが, ちょっと微妙なのでもうちょっと待ってくだ さい. :: と . って微妙に振る舞いが違うようなんですよねぇ... __ ---------------------------------------------------->> 石塚 圭樹 <<--- ---------------------------------->> e-mail: keiju@ishitsuka.com <<---
Updated by keiju (Keiju Ishitsuka) over 1 year ago
けいじゅ@いしつかです. In [ruby-dev:43049] the message: "[ruby-dev:43049] Re: Fwd: [ruby-core:33987] [Ruby 1.9-Feature#4222][Open] Irb tab completion support for the valid (but rare) obj::method invocation syntax", on Jan/17 13:27(JST) keiju ISHITSUKA writes: >けいじゅ@いしつかです. > >> [ruby-core:33987]の件、現状が意図した仕様という訳でないならばマージ >> しようかと思いますが、どうでしょうか。 > >これで良いような気もしますが, ちょっと微妙なのでもうちょっと待ってくだ >さい. :: と . って微妙に振る舞いが違うようなんですよねぇ... 対応しました. var::xxx は varがmoduleでxxxが大文字から始まっていると定数参照になるの でその対応と, 変数以外の xxx:: に対応しました. __ ---------------------------------------------------->> 石塚 圭樹 <<--- ---------------------------------->> e-mail: keiju@ishitsuka.com <<---
Updated by keiju (Keiju Ishitsuka) 11 months ago
- Status changed from Assigned to Closed
これはすでに対応していました。