Sorbet

Sorbet

  • Get started
  • Docs
  • Try
  • Community
  • GitHub
  • Blog

›Editor Features

Getting Started

  • Overview
  • Adopting Sorbet
  • Tracking Adoption
  • Quick Reference
  • Visual Studio Code
  • TypeScript ↔ Sorbet

Static & Runtime

  • Gradual Type Checking
  • Enabling Static Checks
  • Enabling Runtime Checks
  • RBI Files
  • CLI Quickstart
  • CLI Reference
  • Runtime Configuration

Troubleshooting

  • Troubleshooting
  • Why type annotations?
  • FAQ
  • Error Reference
  • Unsupported Ruby Features

Type System

  • sig
  • Type Annotations (non-sig)
  • T.let, T.cast, T.must, T.bind
  • Class Types (Integer, String)
  • Arrays & Hashes
  • Nilable Types (T.nilable)
  • Union Types (T.any)
  • Flow-Sensitivity (is_a?, nil?)
  • T.type_alias
  • Exhaustiveness (T.absurd)
  • T::Struct
  • T::Enum
  • T.untyped
  • Blocks, Procs, & Lambdas
  • Abstract Classes & Interfaces
  • Final Methods & Classes
  • Override Checking
  • Sealed Classes
  • T.class_of
  • T.self_type
  • T.noreturn
  • T.anything
  • T.attached_class
  • Intersection Types (T.all)
  • Generics
  • T::NonForcingConstants
  • Banning untyped

Editor Features

  • Language Server (LSP)
  • Server Status
  • LSP & Typed Level
  • Go to Definition
  • Hover
  • Autocompletion
  • Find All References
  • Code Actions
  • Outline & Document Symbols
  • Documentation Comments
  • Suggesting sigs
  • Highlighting untyped
  • sorbet: URIs

Experimental Features

  • Tuples
  • Shapes
  • Overloads
  • Requiring Ancestors
  • RBS Comments
Edit

Find All References

Sorbet can show the types and documentation for parts of the program via the LSP Hover feature.

View on sorbet.run →

Troubleshooting

Find All References keeps spinning

Sorbet only begins to service “Find All References” requests when in the Idle state. (Sorbet does not run Find All References in the background. This is for simplicity in Sorbet’s implementation, and could be relaxed in the future.)

Read about all of Sorbet’s server statuses for more information on these states.

Some results are missing

Sorbet will only be able to find references on typed usage sites. In particular for methods calls, the file must be at least # typed: true and the method receiver must be typed.

See Feature support by strictness level for more information on how Find All References interacts with the # typed: level.

Note that Sorbet should never fail to find references to a constant (except those in # typed: ignore files). Report a bug if this is not the case.

Find All References is slow

The speed of Find All References depends on how many files contain an identifier with the same name, as we use that information as a first-pass filter over the source files before refining to actual references. For example, searching for references to a class’s initialize will involve a scan over most files in a project even if the specific initialize you are looking for is only used in one file.

Find All References brought me to a file that I cannot edit

These features may return results in type definitions for core Ruby libraries, which are baked directly into the Sorbet executable and are not present on the file system.

In order to display these files in your editor and to support navigating through them, the Sorbet extension displays them in a read-only view. Note that certain extension features, like Hover and Go to Definition, will not function in some of these special files.

See Working with Synthetic or Missing Files for more on this behavior.

I only want to see certain references

Neither the LSP specification nor VS Code provide the ability to filter the list of reference results. (See for example this issue in the VS Code issue tracker).

Other language clients (like Vim or Neovim) have better support for filtering the list of references, and there may be other VS Code extensions which provide third-party ways of filtering the list of references.

← AutocompletionCode Actions →
  • Troubleshooting
    • Find All References keeps spinning
    • Some results are missing
    • Find All References is slow
    • Find All References brought me to a file that I cannot edit
    • I only want to see certain references

Get started · Docs · Try · Community · Blog · Twitter