Skip to content

Latest commit

 

History

History

vscode_extension

Ruby Sorbet for VS Code

Features:

Provides Ruby editor features using the Sorbet language server:

  • Live typechecking
  • Types and documentation on hover
  • Go-to-definition
  • Find all references in workspace
  • Workspace symbol search
  • Autocompletion of methods, local variables, keywords, and sigs.

Getting started

By default, this extension attempts to use a Sorbet language server that it launches using bundle exec srb typecheck --lsp.

In a Ruby environment that includes the sorbet gem, where srb init has been run as per Sorbet's "Getting Started" documentation, this is often sufficient to get started with the Sorbet language server in typed files (i.e., those marked as #typed: true or stricter).

Use sorbet.lspConfigs to customize how the Sorbet language server is launched. If VSCode settings are checked into source control, users may wish to set sorbet.userLspConfigs globally to avoid dirtying/modifying their local .vscode/settings.json. (Configs from sorbet.userLspConfigs override those from sorbet.lspConfigs with matching ids.)

Read the documentation on the Sorbet website for further information.

Caveats/Disclaimers

  • The Sorbet language server does not provide language support for symbols in untyped files (i.e., those ignored or effectively marked # typed: false). See the Sorbet CLI docs for more information about how to change the scope of files considered by Sorbet scope.

  • Sorbet's language server supports flags to enable beta-testing and experimental features; users should be aware that these features are constantly in flux, may occasionally be wildly incompatible with this extension, and are likely to change without notice.

Developing on this Extension

See docs/lsp-dev-guide.md for information on how to get started with LSP and VS Code extension development.