Class: RubyLsp::TypeGuessr::TypeInferrer
- Inherits:
-
RubyLsp::TypeInferrer
- Object
- RubyLsp::TypeInferrer
- RubyLsp::TypeGuessr::TypeInferrer
- Defined in:
- lib/ruby_lsp/type_guessr/type_inferrer.rb
Overview
Custom TypeInferrer that enhances ruby-lsp’s type inference with TypeGuessr’s IR-based heuristic inference. Used by Go to Definition and other features.
Instance Method Summary collapse
-
#infer_receiver_type(node_context) ⇒ GuessedType?
Override to add TypeGuessr’s heuristic type inference Returns nil when type cannot be determined (no fallback to ruby-lsp’s default).
-
#initialize(index, runtime_adapter) ⇒ TypeInferrer
constructor
A new instance of TypeInferrer.
Constructor Details
#initialize(index, runtime_adapter) ⇒ TypeInferrer
Returns a new instance of TypeInferrer.
16 17 18 19 |
# File 'lib/ruby_lsp/type_guessr/type_inferrer.rb', line 16 def initialize(index, runtime_adapter) super(index) @runtime_adapter = runtime_adapter end |
Instance Method Details
#infer_receiver_type(node_context) ⇒ GuessedType?
Override to add TypeGuessr’s heuristic type inference Returns nil when type cannot be determined (no fallback to ruby-lsp’s default)
26 27 28 |
# File 'lib/ruby_lsp/type_guessr/type_inferrer.rb', line 26 def infer_receiver_type(node_context) guess_type_from_ir(node_context) end |