RubyMine 2023.2 Help

Sorbet

RubyMine recognizes Sorbet type signatures stored in .rbi files. RubyMine can utilize them to determine types of Ruby objects and check if method arguments or return values match their signatures.

View the type info

  • To view the object type, place the caret at the desired Ruby object and go to View | Type Info Control+Shift+P.

    Viewing type info

Check the types match

  • RubyMine warns you when you try to use method arguments or return values with the types that don't agree with the corresponding Sorbet signatures. You can manage these warnings using the Mismatched argument type and Mismatched return type inspections.

    Incompatible types inspection

Navigate between Ruby and RBI files

RubyMine enables you to navigate from a Ruby declaration to its type signature, and vice versa.

Go to the type signature

  • Select a Ruby declaration and go to Navigate | Type Signature to navigate to its type signature.

    Navigate to RBI file

Go to the associated Ruby declaration

  • Select a type signature and go to Navigate | Associated Declaration to navigate to the associated Ruby declaration.

    Navigate to Associated Declaration
Last modified: 12 October 2021