Sorbetto for VS Code
Sorbetto provides language support for Ruby by leveraging Sorbet, a type checker developed by Stripe.
It began as a fork of the official Ruby Sorbet extension to explore improvements, but its internals have since been largely rewritten. While it still serves as an experimentation platform, it now follows its own path. Both extensions rely on the same Sorbet Language Server, and neither ships with an embedded version of Sorbet, so any differences in behavior occur exclusively in the VS Code layer.
The following features are unique to Sorbetto:
- Multi-root workspace support, with separate Language Server instances per workspace folder.
- Language Status Item integration.
- New configuration model, including an improved experience for working with the
sorbet/config file.
- Getting-started experience:
- Set up a workspace for Ruby using the Setup Workspace command.
- Wider set of code snippets for common Sorbet constructs.
- Improved editor support:
- Ruby files:
require_relative autocomplete and linking.
- Syntax highlighting of RBS signature comments.
- Peek Usages supports the
sorbet/hierarchyReferences request.
- Improved selection expansion and shrinking.
sorbet/config:
- Autocomplete and inline documentation for
srb options.
- Syntax highlighting.
Gemfile:
- Diagnostics improvements:
- Compact layout for diagnostic messages.
- Expanded quick-fix actions, including the ability to fix all instances of a given error code across all files (documentation).
- Other tools.
From the internal implementation side, there are several improvements as well:
- Minimum VS Code version raised to 1.99, enabling newer extensibility APIs while maintaining Cursor compatibility.
- Language Client library upgraded to version 9.0.
- Switched to
esbuild for bundling and minification, significantly reducing the extension’s footprint.
Table of Contents
Getting Started
Sorbetto offers several standalone features—such as RBS syntax highlighting and Gemfile tooling—that work without any Sorbet installation. To access the full experience, including type checking, inline diagnostics, and related tooling, your project must be configured to use Sorbet. The Adopting Sorbet in an Existing Codebase guide outlines the essentials, but in practice you need Bundler, the Sorbet runtime installed locally, and a sorbet/config file in your project. The Sorbetto: Setup Workspace command automates setting up a workspace from scratch; see Setting Up a Workspace for details. With these pieces in place, the extension can launch the Sorbet Language Server and provide the complete feature set.
Sorbetto launches Sorbet in a standard mode by default, but you can configure additional flags or even custom command-lines, however. See the Sorbet Configuration section below for details.
For guidance on how to write typed Ruby, define signatures, and integrate Sorbet into your codebase, refer to the official Sorbet documentation. It provides a comprehensive overview of the type system, runtime behavior, and recommended workflows for adopting Sorbet effectively.
Platform Support: The extension uses cross-platform practices wherever possible. Compatibility is limited only by the platforms supported by Sorbet. As a result, Windows-specific codepaths are rarely exercised since Sorbet does not support the platform.
Setting Up a Workspace
- Open an existing workspace, or create a new one from an empty folder.
- Run the Sorbetto: Setup Workspace command.
- Once all Your workspace is ready.
You can verify the proper structure has been created. If anything looks off or doesn't work, check the installation terminal and the extension Logs for error messages.
Multi-root Workspaces: In multi-root setups, run the setup command once per workspace folder. Globally installed tools are detected, but the setup command always installs all required assets locally within each workspace folder.
Verifying Everything Works
A quick way to confirm that your workspace setup is functioning correctly is to create a small Ruby file and trigger a predictable type error.
Create a new file in your workspace, for example:
Example: Broken example.rb
# typed: strict
class Demo
def greet(name)
"Hello, #{name}"
end
end
You should immediately see a diagnostic error similar to:
The method 'greet' does not have a 'sig'
It will appear as a red wavy underline beneath def greet(name) line and as an entry in the Problems pane.
Add a minimal signature to fix the error, either manually or using the Sorbet‑provided quick fix:
Example: Fixed example.rb
# typed: strict
class Demo
extend T::Sig
sig { params(name: T.untyped).returns(String) }
def greet(name)
"Hello, #{name}"
end
end
The error should disappear.
↑ Back to top
Sorbet Configuration
Use the Settings Editor to modify the configuration values used by the extension.
The most important setting is the Sorbet Lsp Configuration which provides the following values:
- Stable: runs the Sorbet LSP using
bundle exec srb typecheck, and any other settings values you might have added.
- Custom: runs the Sorbet LSP using a custom command and arguments you provide in the Sorbet Lsp Custom Configuration setting.
- Disabled: disables Sorbet entirely.
When compared to the official extension, Beta and Experimental are not configuration modes here but instead settings you can enable separately. Additionally, a limited set of features are exposed as standalone settings, such as Enable RBS support and Enable require_ancestor support. It is expected over time the number of settings will grow. The extension attempts to de-duplicate configuration values whenever they might overlap.
sorbet/config
Support for sorbet/config receive editing support with syntax highlighting and limited autocompletion. The extension does not process this file at this point, however, so beware you may create conflicting configurations. For details, see the Sorbet: Config file documentation.
↑ Back to top
Sorbet Language Status Item
Sorbetto uses a Language Status Item for Ruby to report LSP status. This approach provides a unified, consistent UI that can display multiple status entries with associated actions. Specific entries can also be pinned to the status bar for quick access, preserving the familiar UX from the official extension.
The following entries are available on the language status item:
- Sorbet Configuration: shows the active Sorbet LSP configuration name as set via
sorbetto.sorbetLspConfiguration, along with a quick Configure action to modify it.
- Sorbet Status: displays the current status of the Sorbet LSP, including a busy indicator. The Output action brings the Sorbetto Output pane into view for checking log entries.
VS Code displays the language status item only when an editor for the matching language is open. You can extend this behavior to editors of any language by enabling the Sorbetto: Always Show Status Items setting. However, at least one editor must still be open for the item to appear.
When using multi-root workspaces, the currently focused editor determines which LSP instance's status is shown. At present, there is no mechanism to display status across all instances simultaneously.
↑ Back to top
Sorbet Snippets
Sorbetto provides snippets for standard Sorbet constructs on top of the ones offered by Sorbet already. In particular, a whole set of ruby language snippets are now available via the Snippet: Fill File with Snippet and Snippet: Insert Snippet commands.
All snippets have an associated trigger word recognized by IntelliSense while typing, making them easily accessible. For example, typing abstract will display the snippets for an abstract class, module, or method, allowing for quick and intuitive code insertion.
Multi-root Workspaces
Multi-root workspaces let developers work with multiple workspace folders within a single VS Code window. This model requires extensions to resolve all references relative to the correct project root, and to follow specific workspace-aware behaviors.
Starting with version 0.3.0, Sorbetto creates a dedicated Sorbet LSP client for each configured workspace folder. This is especially useful when working on multiple projects with distinct dependencies, or when those dependencies need to be isolated—such as separating frontend and backend environments.
There are two key aspects to be aware of:
Context resolution: When determining the target of an action—such as displaying language status items—Sorbetto uses the currently active text editor as a hint. If the target workspace cannot be inferred, a dropdown will prompt for selection. This typically occurs with VS Code stock commands that don’t accept a URI as context.
Configuration precedence: Settings are read in the following order: first from the workspace folder, then the overall workspace, and finally the user scope. Be sure to configure values at the appropriate level. Note that UI settings can only be set at the workspace or user level. This is often the most nuanced aspect of managing multi-root workspaces, so refer to the documentation if needed.
↑ Back to top
The set of RBI commands described in the RBI Files official documentation is supported by the Sorbetto: Update RBIs command. The DSL option is of particular relevance for Rails' users.
↑ Back to top
RBS Support
This extension adds some support for RBS comment signatures, such as syntax highlighting and simple activation through settings, while other language services are provided by Sorbet itself. Check the official documentation for details.
RBS signature comments can be enabled via the Enable RBS support setting. This controls whether Sorbet makes use of RBS signatures for typing information.
Inline RBS signature comments (#:) always receive targeted syntax highlighting for Sorbet‑supported constructs, including types, generics, tuples, records, and annotations such as @abstract, @final, @sealed, @interface, and @requires_ancestor.
In multi-root workspaces, each folder can independently choose whether to use RBS signatures or Sorbet‑generated signatures, allowing mixed setups within a single workspace.
↑ Back to top
Workspace Setup
The Setup Workspace command automates all steps from Adopting Sorbet in one convenient place. This command configures bundler to install gems locally via bundle config set --local path 'vendor/bundle'.
Note: Do not use this command if you prefer globally installed gems; instead, follow the linked documentation to set up your workspace.
↑ Back to top
If your workspace is not set up for Sorbet, the Sorbetto: Setup Workspace creates or updates the Gemfile file as necessary. You can then use the Install and Update CodeLens actions to easily install dependencies using bundler. And if you decide to manually uppdate the file, gem statements get gem-name autocompletion, queried in real-time from rubygems.org.
↑ Back to top
Extension Logs
Sorbetto uses a single output channel to log both its own exceptions and Sorbet’s. The log level can be controlled via the standard Developer: Set Log Level command, selecting Sorbetto from the dropdown. See documentation for details.
↑ Back to top