The Ruby LSP is an implementation of the language server protocol for Ruby, used to improve rich features in editors. It is a part of a wider goal to provide a state-of-the-art experience to Ruby developers using modern standards for cross-editor features, documentation and debugging.
Want to discuss Ruby developer experience? Consider joining the public Ruby DX Slack workspace.
For VS Code users, you can start by installing the Ruby LSP extension from the VS Code marketplace.
For other editors, please refer to the EDITORS guide.
To learn more about Ruby LSP, please refer to the official documentation for supported features.
Ruby LSP includes an LSIF (Language Server Index Format) generator that pre-computes code navigation data for offline use. This is useful for:
- Code search platforms like Sourcegraph or GitHub Code Search
- Static documentation with code navigation features
- CI/CD pipelines that need code intelligence without running a language server
Generate LSIF output for your project:
# Basic usage - outputs to stdout
ruby-lsp-lsif
# Write output to a file
ruby-lsp-lsif -o project.lsif
# Index a specific workspace directory
ruby-lsp-lsif -w /path/to/project -o output.lsif
# Include gem dependencies in the index
ruby-lsp-lsif --include-dependencies -o output.lsifThe LSIF generator automatically uses the Composed Bundle mechanism to access your project's dependencies, ensuring accurate indexing. No additional setup is required - just run it in your project directory.
For more information about LSIF, see the LSIF specification.
This makes your fork available as the ruby-lsp gem on your system:
Build and install your fork
cd /workspace/ruby-lsp
gem build ruby-lsp.gemspec
gem install ruby-lsp-*.gem
# 2. Generate LSIF for the Rails app
ruby-lsp-lsif -w ../my-ruby-gem -o ../my-ruby-gem/index.lsif
# Clean up the built gem file (optional)
rm ruby-lsp-*.gemThe installed ruby-lsp-lsif executable will now use your fork's code.
Ruby LSP also includes a SCIP (Source Code Intelligence Protocol) generator. SCIP is a code intelligence format used by Sourcegraph for cross-repository navigation and code intelligence features. The output is in protobuf binary format as defined by the SCIP schema.
Generate SCIP output for your project:
# Basic usage - outputs to stdout (binary protobuf)
ruby-lsp-scip
# Write output to a file
ruby-lsp-scip -o project.scip
# Index a specific workspace directory
ruby-lsp-scip -w /path/to/project -o output.scip
# Include gem dependencies in the index
ruby-lsp-scip --include-dependencies -o output.scipThe SCIP generator automatically uses the Composed Bundle mechanism to access your project's dependencies, ensuring accurate indexing. No additional setup is required - just run it in your project directory.
For more information about SCIP, see the SCIP repository.
Bug reports and pull requests are welcome on GitHub at https://github.com/Shopify/ruby-lsp. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
If you wish to contribute, see Contributing for development instructions and check out our Design and roadmap for a list of tasks to get started.
The gem is available as open source under the terms of the MIT License.