did_you_mean icon indicating copy to clipboard operation
did_you_mean copied to clipboard

Suggest method signatures on wrong number of arguments

Open sho-h opened this issue 7 years ago • 1 comments

I want to add suggestion on wrong number of arguments. I added experimental class with refering experimental/ivar_name_correction.

require 'did_you_mean/experimental'

Dir.glob('*', 0, 1, 2)
# test.rb:n:in `glob': wrong number of arguments (given 4, expected 1..2) (ArgumentError)
# Did you mean?
#                  Dir.glob( pattern, [flags], [base: path] )
#                  Dir.glob( pattern, [flags], [base: path] ) { |filename| block }

Array.new(3, "foo", "bar")
# test.rb:n:in `initialize': wrong number of arguments (given 3, expected 0..2) (ArgumentError)
# Did you mean?
#                  Array.new(size=0, default=nil)
#                  Array.new(array)
#                  Array.new(size) {|index| block }

a = [1,2,3]
p a.slice(1, 2, 3)
# test.rb:n:in `slice': wrong number of arguments (given 3, expected 1..2) (ArgumentError)
# Did you mean?
#                  ary.slice(index)
#                  ary.slice(start, length)
#                  ary.slice(range)

sho-h avatar Mar 24 '18 14:03 sho-h

Thank for your PR. This is an interesting idea, but I think suggesting the correct method signature may go beyond the scope of the project. I'll have to take a bit of time to think about this more deeply.

yuki24 avatar Mar 25 '18 00:03 yuki24

Sadly, @sho-h passed away. We should creat the new pull-request for this feature.

hsbt avatar Sep 01 '22 10:09 hsbt