lib/steep/services/signature_help_provider.rb in steep-1.8.0.dev.1 vs lib/steep/services/signature_help_provider.rb in steep-1.8.0.dev.2
- old
+ new
@@ -9,11 +9,11 @@
def parameters
if method_type.type.is_a?(RBS::Types::Function)
arguments = [] #: Array[String]
arguments.push(*method_type.type.required_positionals.map(&:to_s))
arguments.push(*method_type.type.optional_positionals.map {|p| "?#{p}"})
- arguments.push("*#{self.method_type.type.rest_positionals}") if method_type.type.rest_positionals
+ arguments.push("*#{method_type.type.rest_positionals}") if method_type.type.rest_positionals
arguments.push(*method_type.type.trailing_positionals.map(&:to_s))
arguments.push(*method_type.type.required_keywords.map {|name, param| "#{name}: #{param}" })
arguments.push(*method_type.type.optional_keywords.map {|name, param| "?#{name}: #{param}" })
arguments.push("**#{method_type.type.rest_keywords}") if method_type.type.rest_keywords
arguments
@@ -134,9 +134,10 @@
[items, index]
end
def active_parameter_for(method_type, argument_nodes, last_argument_nodes, node)
return unless method_type
+ return unless method_type.type.is_a?(RBS::Types::Function)
positionals = method_type.type.required_positionals.size + method_type.type.optional_positionals.size + (method_type.type.rest_positionals ? 1 : 0) + method_type.type.trailing_positionals.size
if argument_nodes.size == 1
# Cursor is not on the argument (maybe on comma after argument)