Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UnknownNodeError in SignatureHelp #863

Merged
merged 1 commit into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/steep/services/signature_help_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def run(line:, column:)
# Given position is between open/close parens of args of send node

if parent && (parent.type == :block || parent.type == :numblock)
send_node = parent.children[0]
send_node = parent
else
send_node = node
end
Expand Down
17 changes: 17 additions & 0 deletions test/signature_help_provider_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,21 @@ def self.foo: (String, Integer) -> Array[Symbol]
end
end
end

def test_send__with_block
with_checker(<<~RBS) do
RBS
source = Source.parse(<<~RUBY, path: Pathname("a.rb"), factory: checker.factory)
[1].each() do |x|
end
RUBY

SignatureHelpProvider.new(source: source, subtyping: checker).tap do |provider|
items, index = provider.run(line: 1, column: 9)

assert_equal 0, index
assert_equal ["() { (::Integer) -> untyped } -> ::Array[::Integer]"], items.map(&:method_type).map(&:to_s)
end
end
end
end