lib/steep/services/signature_help_provider.rb in steep-1.8.0.dev.2 vs lib/steep/services/signature_help_provider.rb in steep-1.8.0.pre.1
- old
+ new
@@ -74,11 +74,12 @@
end
def type_check!(line:, column:)
source = self.source.without_unrelated_defs(line: line, column: column)
resolver = RBS::Resolver::ConstantResolver.new(builder: subtyping.factory.definition_builder)
- TypeCheckService.type_check(source: source, subtyping: subtyping, constant_resolver: resolver)
+ pos = self.source.buffer.loc_to_pos([line, column])
+ TypeCheckService.type_check(source: source, subtyping: subtyping, constant_resolver: resolver, cursor: pos)
end
def last_argument_nodes_for(argument_nodes:, line:, column:)
last = argument_nodes.last or raise
return unless last.children[2] # No arguments
@@ -97,11 +98,11 @@
end
end
def signature_help_for(node, argument, last_argument, typing)
call = typing.call_of(node: node)
- context = typing.context_at(line: node.loc.expression.line, column: node.loc.expression.column)
+ context = typing.cursor_context.context or raise
items = [] #: Array[Item]
index = nil #: Integer?
case call
@@ -111,17 +112,17 @@
if shape = subtyping.builder.shape(type, config)
shape = shape.public_shape if private_send?(node)
if method = shape.methods[call.method_name]
- method.method_types.each.with_index do |method_type, i|
- defn = method_type.method_decls.to_a[0]&.method_def
+ method.overloads.each.with_index do |overload, i|
+ defn = overload.method_defs[0]
active_parameter = active_parameter_for(defn&.type, argument, last_argument, node)
- items << Item.new(subtyping.factory.method_type_1(method_type), defn&.comment, active_parameter)
+ items << Item.new(subtyping.factory.method_type_1(overload.method_type), defn&.comment, active_parameter)
if call.is_a?(MethodCall::Typed)
- if method_type.method_decls.intersect?(call.method_decls)
+ if call.method_decls.intersect?(overload.method_decls(call.method_name).to_set)
index = i
end
end
end
end