зеркало из https://github.com/github/ruby.git
[ruby/irb] Fixed sort of variables in completion
https://github.com/ruby/irb/commit/5842888255
This commit is contained in:
Родитель
107acbd9a4
Коммит
83a6213f31
|
@ -373,7 +373,7 @@ module IRB
|
||||||
if doc_namespace
|
if doc_namespace
|
||||||
"String.#{candidates.find{ |i| i == message }}"
|
"String.#{candidates.find{ |i| i == message }}"
|
||||||
else
|
else
|
||||||
select_message(receiver, message, candidates)
|
select_message(receiver, message, candidates.sort)
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -390,7 +390,7 @@ module IRB
|
||||||
else
|
else
|
||||||
candidates = (bind.eval_methods | bind.eval_private_methods | bind.local_variables | bind.eval_instance_variables | bind.eval_class_constants).collect{|m| m.to_s}
|
candidates = (bind.eval_methods | bind.eval_private_methods | bind.local_variables | bind.eval_instance_variables | bind.eval_class_constants).collect{|m| m.to_s}
|
||||||
candidates |= ReservedWords
|
candidates |= ReservedWords
|
||||||
candidates.grep(/^#{Regexp.quote(input)}/)
|
candidates.grep(/^#{Regexp.quote(input)}/).sort
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -208,5 +208,16 @@ module TestIRB
|
||||||
assert_include(IRB::InputCompletor.retrieve_completion_data("String.new", bind: binding), "String.new")
|
assert_include(IRB::InputCompletor.retrieve_completion_data("String.new", bind: binding), "String.new")
|
||||||
assert_equal(IRB::InputCompletor.retrieve_completion_data("String.new", bind: binding, doc_namespace: true), "String.new")
|
assert_equal(IRB::InputCompletor.retrieve_completion_data("String.new", bind: binding, doc_namespace: true), "String.new")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_complete_sort_variables
|
||||||
|
xzy, xzy_1, xzy2 = '', '', ''
|
||||||
|
|
||||||
|
xzy.clear
|
||||||
|
xzy_1.clear
|
||||||
|
xzy2.clear
|
||||||
|
|
||||||
|
candidates = IRB::InputCompletor.retrieve_completion_data("xz", bind: binding, doc_namespace: false)
|
||||||
|
assert_equal(candidates, %w[xzy xzy2 xzy_1])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Загрузка…
Ссылка в новой задаче