class RubyLsp::Requests::SignatureHelp
def adjust_for_nested_target(target, parent, position)
In that case, we want to provide signature help for `foo` and not `another_method_call`.
foo(another_method_call)
select the right target in a situation like this:
Adjust the target of signature help in the case where we have nested method calls. This is necessary so that we
def adjust_for_nested_target(target, parent, position) # If the parent node is not a method call, then make no adjustments return target unless parent.is_a?(Prism::CallNode) # If the parent is a method call, but the target isn't, then return the parent return parent unless target.is_a?(Prism::CallNode) # If both are method calls, we check the arguments of the inner method call. If there are no arguments, then # we're providing signature help for the outer method call. # # If there are arguments, then we check if the arguments node covers the requested position. If it doesn't # cover, then we're providing signature help for the outer method call. arguments = target.arguments arguments.nil? || !node_covers?(arguments, position) ? parent : target end