Feature #4222

Irb tab completion support for the valid (but rare) obj::method invocation syntax

Added by Abinoam P. Marques Jr. over 3 years ago. Updated almost 3 years ago.

[ruby-core:33987]
Status:Closed
Priority:Normal
Assignee:Keiju Ishitsuka
Category:lib
Target version:1.9.3

Description

=begin
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::

No tab-completion from irb.

a. 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
=end

tab-completion-for-rare-method-invocation-syntax.patch Magnifier - Add irb tab completion support for the valid (but rare) obj::method invocation syntax (463 Bytes) Abinoam P. Marques Jr., 12/29/2010 01:10 PM

History

#1 Updated by Yuki Sonoda over 3 years ago

=begin
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

=end

#2 Updated by Yuki Sonoda over 3 years ago

  • Category set to lib
  • Status changed from Open to Assigned
  • Assignee set to Keiju Ishitsuka
  • Priority changed from Low to Normal
  • Target version set to 1.9.3

=begin

=end

#3 Updated by Yuki Sonoda over 3 years ago

=begin
石塚さん、

の件、現状が意図した仕様という訳でないならばマージしようかと思いますが、どうでしょうか。

---------- Forwarded message ----------
From: Abinoam P. Marques Jr. redmine@ruby-lang.org
Date: Wed, Dec 29, 2010 at 1:10 PM
Subject: [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::

No tab-completion from irb.

a. 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
=end

#4 Updated by Keiju Ishitsuka over 3 years ago

=begin
けいじゅ@いしつかです.

Yugui yugui@yugui.jp wrote:

石塚さん、

どもです.

の件、現状が意図した仕様という訳でないならばマージ
しようかと思いますが、どうでしょうか。

これで良いような気もしますが, ちょっと微妙なのでもうちょっと待ってくだ
さい. :: と . って微妙に振る舞いが違うようなんですよねぇ...

__
---------------------------------------------------->> 石塚 圭樹 <<---
---------------------------------->> e-mail: keiju@ishitsuka.com <<---

=end

#5 Updated by Keiju Ishitsuka over 3 years ago

=begin
けいじゅ@いしつかです.

In the message: " Re: Fwd:
[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:

けいじゅ@いしつかです.

の件、現状が意図した仕様という訳でないならばマージ
しようかと思いますが、どうでしょうか。

これで良いような気もしますが, ちょっと微妙なのでもうちょっと待ってくだ
さい. :: と . って微妙に振る舞いが違うようなんですよねぇ...

対応しました.

var::xxx は varがmoduleでxxxが大文字から始まっていると定数参照になるの
でその対応と, 変数以外の xxx:: に対応しました.

__
---------------------------------------------------->> 石塚 圭樹 <<---
---------------------------------->> e-mail: keiju@ishitsuka.com <<---

=end

#6 Updated by Keiju Ishitsuka almost 3 years ago

  • Status changed from Assigned to Closed

これはすでに対応していました。

Also available in: Atom PDF