steep 1.5.0.pre.5 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,21 @@ module Steep
3
3
  class SignatureHelpProvider
4
4
  MethodCall = TypeInference::MethodCall
5
5
 
6
- Item = _ = Struct.new(:method_type, :comment)
6
+ Item = _ = Struct.new(:method_type, :comment, :active_parameter) do
7
+ # @implements Item
8
+
9
+ def parameters
10
+ arguments = [] #: Array[String]
11
+ arguments.push(*method_type.type.required_positionals.map(&:to_s))
12
+ arguments.push(*method_type.type.optional_positionals.map {|p| "?#{p}"})
13
+ arguments.push("*#{self.method_type.type.rest_positionals}") if method_type.type.rest_positionals
14
+ arguments.push(*method_type.type.trailing_positionals.map(&:to_s))
15
+ arguments.push(*method_type.type.required_keywords.map {|name, param| "#{name}: #{param}" })
16
+ arguments.push(*method_type.type.optional_keywords.map {|name, param| "?#{name}: #{param}" })
17
+ arguments.push("**#{method_type.type.rest_keywords}") if method_type.type.rest_keywords
18
+ arguments
19
+ end
20
+ end
7
21
 
8
22
  attr_reader :source, :path, :subtyping, :typing, :buffer
9
23
 
@@ -23,12 +37,14 @@ module Steep
23
37
  return unless nodes
24
38
 
25
39
  typing = type_check!(line: line, column: column)
40
+ argument_nodes = [] #: Array[Parser::AST::Node]
26
41
 
27
42
  while true
28
43
  node = nodes.shift()
29
44
  parent = nodes.first
30
45
 
31
46
  node or return
47
+ argument_nodes << node
32
48
 
33
49
  if node.type == :send || node.type == :csend
34
50
  pos = buffer.loc_to_pos([line, column])
@@ -40,12 +56,13 @@ module Steep
40
56
  # Given position is between open/close parens of args of send node
41
57
 
42
58
  if parent && (parent.type == :block || parent.type == :numblock)
43
- send_node = parent.children[0]
59
+ send_node = parent
44
60
  else
45
61
  send_node = node
46
62
  end
47
63
 
48
- return signature_help_for(send_node, typing)
64
+ last_argument_nodes = last_argument_nodes_for(argument_nodes: argument_nodes, line: line, column: column)
65
+ return signature_help_for(send_node, argument_nodes, last_argument_nodes, typing)
49
66
  end
50
67
  end
51
68
  end
@@ -58,7 +75,24 @@ module Steep
58
75
  TypeCheckService.type_check(source: source, subtyping: subtyping, constant_resolver: resolver)
59
76
  end
60
77
 
61
- def signature_help_for(node, typing)
78
+ def last_argument_nodes_for(argument_nodes:, line:, column:)
79
+ return unless argument_nodes.last.children[2] # No arguments
80
+ return argument_nodes if argument_nodes.size > 1 # Cursor is on the last argument
81
+
82
+ pos = buffer.loc_to_pos([line, column])
83
+
84
+ while true
85
+ pos -= 1
86
+ line, column = buffer.pos_to_loc(pos)
87
+ nodes = source.find_nodes(line: line, column: column)
88
+ return unless nodes
89
+
90
+ index = nodes.index { |n| n.type == :send || n.type == :csend }
91
+ return nodes[..index] if index.to_i > 0
92
+ end
93
+ end
94
+
95
+ def signature_help_for(node, argument, last_argument, typing)
62
96
  call = typing.call_of(node: node)
63
97
  context = typing.context_at(line: node.loc.expression.line, column: node.loc.expression.column)
64
98
 
@@ -82,7 +116,8 @@ module Steep
82
116
  method.method_types.each.with_index do |method_type, i|
83
117
  defn = method_type.method_decls.to_a[0]&.method_def
84
118
 
85
- items << Item.new(subtyping.factory.method_type_1(method_type), defn&.comment)
119
+ active_parameter = active_parameter_for(defn&.type, argument, last_argument, node)
120
+ items << Item.new(subtyping.factory.method_type_1(method_type), defn&.comment, active_parameter)
86
121
 
87
122
  if call.is_a?(MethodCall::Typed)
88
123
  if method_type.method_decls.intersect?(call.method_decls)
@@ -98,6 +133,66 @@ module Steep
98
133
 
99
134
  [items, index]
100
135
  end
136
+
137
+ def active_parameter_for(method_type, argument_nodes, last_argument_nodes, node)
138
+ return unless method_type
139
+
140
+ 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
141
+
142
+ if argument_nodes.size == 1
143
+ # Cursor is not on the argument (maybe on comma after argument)
144
+ return 0 if last_argument_nodes.nil? # No arguments
145
+
146
+ case last_argument_nodes[-2].type
147
+ when :splat
148
+ method_type.type.required_positionals.size + method_type.type.optional_positionals.size + 1 if method_type.type.rest_positionals
149
+ when :kwargs
150
+ case last_argument_nodes[-3].type
151
+ when :pair
152
+ argname = last_argument_nodes[-3].children.first.children.first
153
+ if method_type.type.required_keywords[argname]
154
+ positionals + method_type.type.required_keywords.keys.index(argname).to_i + 1
155
+ elsif method_type.type.optional_keywords[argname]
156
+ positionals + method_type.type.required_keywords.size + method_type.type.optional_keywords.keys.index(argname).to_i + 1
157
+ elsif method_type.type.rest_keywords
158
+ positionals + method_type.type.required_keywords.size + method_type.type.optional_keywords.size
159
+ end
160
+ when :kwsplat
161
+ positionals + method_type.type.required_keywords.size + method_type.type.optional_keywords.size if method_type.type.rest_keywords
162
+ end
163
+ else
164
+ pos = node.children[2...].index { |c| c.location == last_argument_nodes[-2].location }.to_i
165
+ if method_type.type.rest_positionals
166
+ [pos + 1, positionals - 1].min
167
+ else
168
+ [pos + 1, positionals].min
169
+ end
170
+ end
171
+ else
172
+ # Cursor is on the argument
173
+ case argument_nodes[-2].type
174
+ when :splat
175
+ method_type.type.required_positionals.size + method_type.type.optional_positionals.size if method_type.type.rest_positionals
176
+ when :kwargs
177
+ case argument_nodes[-3].type
178
+ when :pair
179
+ argname = argument_nodes[-3].children.first.children.first
180
+ if method_type.type.required_keywords[argname]
181
+ positionals + method_type.type.required_keywords.keys.index(argname).to_i
182
+ elsif method_type.type.optional_keywords[argname]
183
+ positionals + method_type.type.required_keywords.size + method_type.type.optional_keywords.keys.index(argname).to_i
184
+ elsif method_type.type.rest_keywords
185
+ positionals + method_type.type.required_keywords.size + method_type.type.optional_keywords.size
186
+ end
187
+ when :kwsplat
188
+ positionals + method_type.type.required_keywords.size + method_type.type.optional_keywords.size if method_type.type.rest_keywords
189
+ end
190
+ else
191
+ pos = node.children[2...].index { |c| c.location == argument_nodes[-2].location }.to_i
192
+ [pos, positionals - 1].min
193
+ end
194
+ end
195
+ end
101
196
  end
102
197
  end
103
198
  end
data/lib/steep/source.rb CHANGED
@@ -330,13 +330,12 @@ module Steep
330
330
  def find_heredoc_nodes(line, column, position)
331
331
  each_heredoc_node() do |nodes, location|
332
332
  node = nodes[0]
333
+ loc = location.heredoc_body #: Parser::Source::Range
333
334
 
334
- range = location.heredoc_body&.yield_self do |r|
335
- r.begin_pos..r.end_pos
336
- end
337
-
338
- if range && (range === position)
339
- return nodes
335
+ if range = loc.to_range
336
+ if range.begin <= position && position <= range.end
337
+ return nodes
338
+ end
340
339
  end
341
340
  end
342
341
 
@@ -344,12 +343,10 @@ module Steep
344
343
  end
345
344
 
346
345
  def find_nodes_loc(node, position, parents)
347
- range = node.location.expression&.yield_self do |r|
348
- r.begin_pos..r.end_pos
349
- end
346
+ range = node.location.expression&.to_range
350
347
 
351
348
  if range
352
- if range === position
349
+ if range.begin <= position && position <= range.end
353
350
  parents.unshift node
354
351
 
355
352
  Source.each_child_node(node) do |child|
@@ -366,9 +363,7 @@ module Steep
366
363
  def find_nodes(line:, column:)
367
364
  return [] unless node
368
365
 
369
- position = (line-1).times.sum do |i|
370
- node.location.expression.source_buffer.source_line(i+1).size + 1
371
- end + column
366
+ position = buffer.loc_to_pos([line, column])
372
367
 
373
368
  if heredoc_nodes = find_heredoc_nodes(line, column, position)
374
369
  Source.each_child_node(heredoc_nodes[0]) do |child|
@@ -1950,10 +1950,6 @@ module Steep
1950
1950
  branch_results = [] #: Array[Pair]
1951
1951
 
1952
1952
  cond_type, constr = constr.synthesize(cond)
1953
- _, cond_vars = interpreter.decompose_value(cond)
1954
- SPECIAL_LVAR_NAMES.each do |name|
1955
- cond_vars.delete(name)
1956
- end
1957
1953
 
1958
1954
  var_name = :"_a[#{SecureRandom.alphanumeric(4)}]"
1959
1955
  var_cond, value_node = transform_condition_node(cond, var_name)
@@ -2621,7 +2617,26 @@ module Steep
2621
2617
  # @type var as_type: AST::Node::TypeAssertion
2622
2618
  asserted_node, as_type = node.children
2623
2619
 
2624
- if type = as_type.type?(module_context.nesting, checker, [])
2620
+ type = as_type.type(module_context.nesting, checker, [])
2621
+
2622
+ case type
2623
+ when Array
2624
+ type.each do |error|
2625
+ typing.add_error(
2626
+ Diagnostic::Ruby::RBSError.new(
2627
+ error: error,
2628
+ node: node,
2629
+ location: error.location || raise
2630
+ )
2631
+ )
2632
+ end
2633
+
2634
+ synthesize(asserted_node, hint: hint)
2635
+
2636
+ when nil, RBS::ParsingError
2637
+ synthesize(asserted_node, hint: hint)
2638
+
2639
+ else
2625
2640
  actual_type, constr = synthesize(asserted_node, hint: type)
2626
2641
 
2627
2642
  if no_subtyping?(sub_type: type, super_type: actual_type) && no_subtyping?(sub_type: actual_type, super_type: type)
@@ -2635,22 +2650,34 @@ module Steep
2635
2650
  end
2636
2651
 
2637
2652
  constr.add_typing(node, type: type)
2638
- else
2639
- synthesize(asserted_node, hint: hint)
2640
2653
  end
2641
2654
  end
2642
2655
 
2643
- when :block, :numblock, :send, :csend
2644
- synthesize_sendish(node, hint: hint, tapp: nil)
2645
-
2646
2656
  when :tapp
2647
2657
  yield_self do
2658
+ # @type var tapp: AST::Node::TypeApplication
2648
2659
  sendish, tapp = node.children
2660
+
2661
+ if (array = tapp.types(module_context.nesting, checker, [])).is_a?(Enumerator)
2662
+ array.each do |error|
2663
+ typing.add_error(
2664
+ Diagnostic::Ruby::RBSError.new(
2665
+ error: error,
2666
+ node: node,
2667
+ location: error.location || raise
2668
+ )
2669
+ )
2670
+ end
2671
+ end
2672
+
2649
2673
  type, constr = synthesize_sendish(sendish, hint: hint, tapp: tapp)
2650
2674
 
2651
2675
  constr.add_typing(node, type: type)
2652
2676
  end
2653
2677
 
2678
+ when :block, :numblock, :send, :csend
2679
+ synthesize_sendish(node, hint: hint, tapp: nil)
2680
+
2654
2681
  when :forwarded_args, :forward_arg
2655
2682
  add_typing(node, type: AST::Builtin.any_type)
2656
2683
 
@@ -3076,26 +3103,29 @@ module Steep
3076
3103
 
3077
3104
  type_hint = deep_expand_alias(type_hint) || type_hint
3078
3105
 
3079
- procs = flatten_union(type_hint).select do |type|
3080
- check_relation(sub_type: type, super_type: AST::Builtin::Proc.instance_type).success?
3081
- end
3106
+ unless type_hint.is_a?(AST::Types::Any)
3107
+ procs = flatten_union(type_hint).select do |type|
3108
+ check_relation(sub_type: type, super_type: AST::Builtin::Proc.instance_type).success? &&
3109
+ !type.is_a?(AST::Types::Any)
3110
+ end
3082
3111
 
3083
- proc_instances, proc_types = procs.partition {|type| AST::Builtin::Proc.instance_type?(type) }
3112
+ proc_instances, proc_types = procs.partition {|type| AST::Builtin::Proc.instance_type?(type) }
3084
3113
 
3085
- case
3086
- when !proc_instances.empty? && proc_types.empty?
3087
- # `::Proc` is given as a hint
3088
- when proc_types.size == 1
3089
- # Proc type is given as a hint
3090
- hint_proc = proc_types[0] #: AST::Types::Proc
3091
- params_hint = hint_proc.type.params
3092
- return_hint = hint_proc.type.return_type
3093
- block_hint = hint_proc.block
3094
- self_hint = hint_proc.self_type
3095
- else
3096
- typing.add_error(
3097
- Diagnostic::Ruby::ProcHintIgnored.new(hint_type: original_hint, node: node)
3098
- )
3114
+ case
3115
+ when !proc_instances.empty? && proc_types.empty?
3116
+ # `::Proc` is given as a hint
3117
+ when proc_types.size == 1
3118
+ # Proc type is given as a hint
3119
+ hint_proc = proc_types[0] #: AST::Types::Proc
3120
+ params_hint = hint_proc.type.params
3121
+ return_hint = hint_proc.type.return_type
3122
+ block_hint = hint_proc.block
3123
+ self_hint = hint_proc.self_type
3124
+ else
3125
+ typing.add_error(
3126
+ Diagnostic::Ruby::ProcHintIgnored.new(hint_type: original_hint, node: node)
3127
+ )
3128
+ end
3099
3129
  end
3100
3130
  end
3101
3131
 
@@ -280,20 +280,22 @@ module Steep
280
280
  when AST::Types::Logic::ReceiverIsNil
281
281
  if receiver && arguments.size.zero?
282
282
  receiver_type = typing.type_of(node: receiver)
283
- truthy_receiver, falsy_receiver = factory.partition_union(receiver_type)
283
+ unwrap = factory.unwrap_optional(receiver_type)
284
+ truthy_receiver = AST::Builtin.nil_type
285
+ falsy_receiver = unwrap || receiver_type
284
286
 
285
287
  truthy_env, falsy_env = refine_node_type(
286
288
  env: env,
287
289
  node: receiver,
288
- truthy_type: falsy_receiver || BOT,
289
- falsy_type: truthy_receiver || BOT
290
+ truthy_type: truthy_receiver,
291
+ falsy_type: falsy_receiver
290
292
  )
291
293
 
292
294
  truthy_result = Result.new(type: TRUE, env: truthy_env, unreachable: false)
293
- truthy_result.unreachable! unless truthy_receiver
295
+ truthy_result.unreachable! if unwrap == receiver_type
294
296
 
295
297
  falsy_result = Result.new(type: FALSE, env: falsy_env, unreachable: false)
296
- falsy_result.unreachable! unless falsy_receiver
298
+ falsy_result.unreachable! unless unwrap
297
299
 
298
300
  [truthy_result, falsy_result]
299
301
  end
@@ -500,7 +502,7 @@ module Steep
500
502
  type_case_select0(ty, klass)
501
503
  end
502
504
 
503
- when AST::Types::Any, AST::Types::Top
505
+ when AST::Types::Any, AST::Types::Top, AST::Types::Var
504
506
  [
505
507
  [instance_type],
506
508
  [type]
@@ -681,7 +681,15 @@ module Steep
681
681
  when KeywordArgs::MissingKeyword
682
682
  missing_keywords.push(*error.keywords.to_a)
683
683
  when PositionalArgs::UnexpectedArg
684
- diagnostics << Diagnostic::Ruby::UnexpectedPositionalArgument.new(node: error.node, params: params)
684
+ if error.node.type == :kwargs
685
+ error.node.children.each do |kwarg|
686
+ if kwarg.type == :pair
687
+ diagnostics << Diagnostic::Ruby::UnexpectedKeywordArgument.new(node: kwarg, params: params)
688
+ end
689
+ end
690
+ else
691
+ diagnostics << Diagnostic::Ruby::UnexpectedPositionalArgument.new(node: error.node, params: params)
692
+ end
685
693
  when PositionalArgs::MissingArg
686
694
  diagnostics << Diagnostic::Ruby::InsufficientPositionalArguments.new(node: node, params: params)
687
695
  end
data/lib/steep/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Steep
2
- VERSION = "1.5.0.pre.5"
2
+ VERSION = "1.5.0"
3
3
  end
@@ -12,7 +12,7 @@ module Steep
12
12
 
13
13
  def initialize: (RBS::Location[untyped, untyped]) -> void
14
14
 
15
- def types: (RBS::Resolver::context, Subtyping::Check, Array[Symbol] type_vars) -> (Array[Types::t] | RBS::ParsingError | nil)
15
+ def types: (RBS::Resolver::context, Subtyping::Check, Array[Symbol] type_vars) -> (Array[Types::t] | RBS::ParsingError | Enumerator[Diagnostic::Signature::Base, void] | nil)
16
16
 
17
17
  def types?: (RBS::Resolver::context, Subtyping::Check, Array[Symbol] type_vars) -> Array[Types::t]?
18
18
 
@@ -10,7 +10,7 @@ module Steep
10
10
 
11
11
  def initialize: (RBS::Location[untyped, untyped]) -> void
12
12
 
13
- def type: (RBS::Resolver::context, Subtyping::Check, Array[Symbol] type_vars) -> (Types::t | RBS::ParsingError | nil)
13
+ def type: (RBS::Resolver::context, Subtyping::Check, Array[Symbol] type_vars) -> (Types::t | RBS::ParsingError | Array[Diagnostic::Signature::Base] | nil)
14
14
 
15
15
  def type?: (RBS::Resolver::context, Subtyping::Check, Array[Symbol] type_vars) -> Types::t?
16
16
 
@@ -77,13 +77,12 @@ module Steep
77
77
  # Returns a type that doesn't have `nil` in the union component
78
78
  #
79
79
  # * Returns `nil` if given type is `nil`
80
- # * **Doesn't expand type alias automatically**
80
+ # * Expand (unfold) the type aliases automatically
81
81
  #
82
82
  # ```ruby
83
83
  # unwrap_optional(`String?`) # => `String`
84
84
  # unwrap_optional(`String | Integer | false | nil`) # => `String | Integer | false`
85
85
  # unwrap_optional(`nil`) # => nil
86
- # unwrap_optional(`boolish`) # => `boolish`
87
86
  # ```
88
87
  #
89
88
  def unwrap_optional: (Types::t) -> Types::t?
@@ -495,7 +495,7 @@ module Steep
495
495
  # ```
496
496
  #
497
497
  # This diagnostic allows writing `raise` or `return`, by checking the type of the branch body is `bot` or not.
498
- #
498
+ #
499
499
  class UnreachableValueBranch < Base
500
500
  attr_reader type: AST::Types::t
501
501
 
@@ -622,6 +622,14 @@ module Steep
622
622
  def initialize: (hint_type: AST::Types::t, node: Parser::AST::Node) -> void
623
623
  end
624
624
 
625
+ # RBS embedded in the Ruby code has validation error
626
+ #
627
+ class RBSError < Base
628
+ attr_reader error: Signature::Base
629
+
630
+ def initialize: (error: Signature::Base, node: Parser::AST::Node, location: location) -> void
631
+ end
632
+
625
633
  # Argument forwarding `...` cannot be done safely, because of
626
634
  #
627
635
  # 1. The arguments are incompatible, or
@@ -654,21 +662,35 @@ module Steep
654
662
 
655
663
  ALL: Array[singleton(Base)]
656
664
 
657
- type template = Hash[singleton(Base), LSPFormatter::severity]
665
+ type template = Hash[singleton(Base), LSPFormatter::severity?]
658
666
 
659
667
  self.@all_error: template?
668
+ self.@default: template?
669
+ self.@strict: template?
670
+ self.@lenient: template?
671
+ self.@silent: template?
672
+
673
+ # This template reports everything as an error
674
+ #
660
675
  def self.all_error: () -> template
661
676
 
662
- self.@default: template?
677
+ # This template detects inconsistencies between RBS and Ruby code APIs
678
+ #
663
679
  def self.default: () -> template
664
680
 
665
- self.@strict: template?
681
+ # This template helps you keeping your codebase (almost) type-safe
682
+ #
683
+ # You can start with this template to review the problems reported on the project,
684
+ # and you can ignore some kind of errors.
685
+ #
666
686
  def self.strict: () -> template
667
687
 
668
- self.@lenient: template?
688
+ # This template detects inconsistent definition in Ruby code with respect to your RBS definition
689
+ #
669
690
  def self.lenient: () -> template
670
691
 
671
- self.@silent: template?
692
+ # This template reports nothing
693
+ #
672
694
  def self.silent: () -> template
673
695
  end
674
696
  end
@@ -65,5 +65,14 @@ module Steep
65
65
  def deconstruct_send_node!: (Node) -> [Node?, Symbol, Array[Node], send_loc]
66
66
 
67
67
  def test_send_node: (Node) { (Node?, Symbol, Array[Node], send_loc) -> bool } -> bool
68
+
69
+ # Deconstruct sendish node and it's associated block node
70
+ #
71
+ # Receives a sequence of node tree where the leaf node comes first.
72
+ # If the first node is `send`, `csend`, `super`, or `zsuper`, it is the sendish node.
73
+ #
74
+ # If the next node is a `block` or `numblock` that is associated to the *sendish node*, it is the block node.
75
+ #
76
+ def deconstruct_sendish_and_block_nodes: (*Parser::AST::Node) -> [Parser::AST::Node, Parser::AST::Node?]?
68
77
  end
69
78
  end
@@ -1,3 +1,5 @@
1
+ use Steep::Diagnostic::Ruby::template
2
+
1
3
  module Steep
2
4
  class Project
3
5
  class DSL
@@ -71,10 +73,13 @@ module Steep
71
73
  # D = Steep::Diagnostic
72
74
  #
73
75
  # configure_code_diagnostics(D::Ruby.lenient)
76
+ # configure_code_diagnostics(D::Ruby.strict) do |config|
77
+ # config[D::Ruby::NoMethod] = nil
78
+ # end
74
79
  # ```
75
80
  #
76
- def configure_code_diagnostics: (Hash[untyped, untyped] hash) -> void
77
- | () { (Hash[untyped, untyped]) -> void } -> void
81
+ def configure_code_diagnostics: (template hash) ?{ (template) -> void }-> void
82
+ | () { (template) -> void }-> void
78
83
 
79
84
  def collection_config: (Pathname path) -> void
80
85
 
@@ -4,6 +4,8 @@ use Steep::TypeInference::MethodCall
4
4
  module Steep
5
5
  module Services
6
6
  class CompletionProvider
7
+ include NodeHelper
8
+
7
9
  # Cursor position
8
10
  class Position
9
11
  attr_reader line: Integer
@@ -33,6 +35,14 @@ module Steep
33
35
  def initialize: (identifier: Symbol, range: Range, type: AST::Types::t) -> void
34
36
  end
35
37
 
38
+ class KeywordArgumentItem
39
+ attr_reader identifier: String
40
+
41
+ attr_reader range: Range
42
+
43
+ def initialize: (identifier: String, range: Range) -> void
44
+ end
45
+
36
46
  class LocalVariableItem
37
47
  attr_reader identifier: Symbol
38
48
 
@@ -169,6 +179,7 @@ module Steep
169
179
  end
170
180
 
171
181
  type item = InstanceVariableItem
182
+ | KeywordArgumentItem
172
183
  | LocalVariableItem
173
184
  | ConstantItem
174
185
  | SimpleMethodNameItem
@@ -216,6 +227,8 @@ module Steep
216
227
 
217
228
  def items_for_rbs: (position: Position, buffer: RBS::Buffer) -> Array[item]
218
229
 
230
+ def items_for_following_keyword_arguments: (String text, index: Integer, line: Integer, column: Integer, items: Array[item]) -> void
231
+
219
232
  def method_items_for_receiver_type: (AST::Types::t, include_private: bool, prefix: String, position: Position, items: Array[item]) -> void
220
233
 
221
234
  def word_name?: (String name) -> bool
@@ -226,12 +239,13 @@ module Steep
226
239
 
227
240
  def instance_variable_items_for_context: (TypeInference::Context context, position: Position, prefix: String, items: Array[item]) -> void
228
241
 
242
+ def keyword_argument_items_for_method: (call_node: Parser::AST::Node, send_node: Parser::AST::Node, position: Position, prefix: String, items: Array[item]) -> void
243
+
229
244
  def index_for: (String, line: Integer, column: Integer) -> Integer
230
245
 
231
246
  def disallowed_method?: (Symbol name) -> bool
232
247
 
233
248
  def unwrap_optional: (AST::Types::t) -> AST::Types::t
234
-
235
249
  end
236
250
  end
237
251
  end
@@ -10,7 +10,11 @@ module Steep
10
10
 
11
11
  attr_reader comment: RBS::AST::Comment?
12
12
 
13
- def initialize: (RBS::MethodType, RBS::AST::Comment?) -> void
13
+ attr_reader active_parameter: Integer?
14
+
15
+ def initialize: (RBS::MethodType, RBS::AST::Comment?, Integer?) -> void
16
+
17
+ def parameters: () -> Array[String]
14
18
  end
15
19
 
16
20
  attr_reader source: Source
@@ -31,7 +35,13 @@ module Steep
31
35
 
32
36
  private
33
37
 
34
- def signature_help_for: (Parser::AST::Node, Typing) -> [Array[Item], Integer?]?
38
+ def active_parameter_for: (RBS::MethodType?, Array[Parser::AST::Node], Array[Parser::AST::Node]?, Parser::AST::Node) -> Integer?
39
+
40
+ def arguments_for: (RBS::MethodType) -> Array[String]
41
+
42
+ def last_argument_nodes_for: (argument_nodes: Array[Parser::AST::Node], line: Integer, column: Integer) -> Array[Parser::AST::Node]?
43
+
44
+ def signature_help_for: (Parser::AST::Node, Array[Parser::AST::Node], Array[Parser::AST::Node]?, Typing) -> [Array[Item], Integer?]?
35
45
 
36
46
  def type_check!: (line: Integer, column: Integer) -> Typing
37
47
  end
@@ -38,7 +38,7 @@ module Steep
38
38
 
39
39
  def validate_type_application: (RBS::Types::t) -> void
40
40
 
41
- def validate_type: (RBS::Types::t `type`) -> untyped
41
+ def validate_type: (RBS::Types::t `type`) -> void
42
42
 
43
43
  def ancestor_to_type: (RBS::Definition::Ancestor::t ancestor) -> (AST::Types::Name::Interface | AST::Types::Name::Instance)
44
44
 
@@ -69,7 +69,7 @@ module Steep
69
69
  def validate_one_alias: (RBS::TypeName name, ?RBS::Environment::TypeAliasEntry entry) -> void
70
70
 
71
71
  def validate_one_class_decl: (RBS::TypeName) -> void
72
-
72
+
73
73
  def validate_one_class_alias: (RBS::TypeName, RBS::Environment::ClassAliasEntry | RBS::Environment::ModuleAliasEntry) -> void
74
74
 
75
75
  def validate_alias: () -> void
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steep
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0.pre.5
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-07 00:00:00.000000000 Z
11
+ date: 2023-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -782,9 +782,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
782
782
  version: 2.7.0
783
783
  required_rubygems_version: !ruby/object:Gem::Requirement
784
784
  requirements:
785
- - - ">"
785
+ - - ">="
786
786
  - !ruby/object:Gem::Version
787
- version: 1.3.1
787
+ version: '0'
788
788
  requirements: []
789
789
  rubygems_version: 3.4.10
790
790
  signing_key: