ruby-lsp
AGENTS.md2k starsChanged 7 months agoMITView on GitHub
The Ruby LSP project aims to be a complete solution to provide an IDE-like experience for the Ruby language on VS Code. Its parts are: - ruby-lsp gem: language server implementation and extra custom functionality to support the VS Code extension. This is the top level of the repository - Ruby code indexer: static analysis engine to support features like go to definition, completion and workspace symbols. This is entirely implemented inside lib/ruby_indexer - Companion VS Code extension that includes…
Trending
Quiet since March.about the whole repository
Who's talking about Shopify/ruby-lsp
- zed-industries/zed“shopify/ruby-lsp as an alternate language server”GitHub · Apr 6, 2023 · 66 reactions
- zed-industries/zed“LSP: support for document links (textDocument/documentLink)”GitHub · Jun 28, 2025 · 26 reactions
- dense-analysis/ale“Add support for ruby-lsp”GitHub · Apr 5, 2023 · 15 reactions
- Shopify/rubydex“Ruby LSP adoption”GitHub · Mar 17, 2026 · 6 reactions
- actions/runner-images“Ubuntu-24.04 ships Rubygems directories that are world-writable”GitHub · Feb 10, 2026 · 6 reactions
The biggest 5 of 15 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 15
Talked about on GitHub (15 times).
On GitHub · 15
- Apr 6, 2023shopify/ruby-lsp as an alternate language server — zed-industries/zed66 reactions · 24 comments
- Jun 28, 2025LSP: support for document links (textDocument/documentLink) — zed-industries/zed26 reactions · 4 comments
- Apr 5, 2023Add support for ruby-lsp — dense-analysis/ale15 reactions · 2 comments
- Mar 17, 2026Ruby LSP adoption — Shopify/rubydex6 reactions
- Feb 10, 2026Ubuntu-24.04 ships Rubygems directories that are world-writable — actions/runner-images6 reactions · 6 comments
10 more on GitHub
- Jun 14, 2024feat(extras): improve ruby extra by letting user chose — LazyVim/LazyVim5 reactions · 6 comments
- May 12, 2024Option to disable `ruby-lsp-rails` server-dependent addon features [low-prio] — Shopify/ruby-lsp-rails4 reactions · 11 comments
- Feb 25, 2025Enable reusable Prism parse result — rubocop/rubocop-ast3 reactions · 9 comments
- Jun 27, 2023Remove custom bundle logic — Shopify/vscode-ruby-lsp3 reactions · 11 comments
- Feb 15, 2026Rename migration files when renaming migration class — Shopify/ruby-lsp-rails2 reactions · 1 comment
- Dec 29, 2025Implement basic schema goto definitions — Shopify/ruby-lsp-rails2 reactions · 1 comment
- Apr 23, 2025Return key does not trigger Language Server `onTypeFormatting` request (no `end` completion) — zed-extensions/ruby2 reactions · 7 comments
- Mar 29, 2025Add snippets — zed-extensions/ruby2 reactions · 17 comments
- Oct 3, 2024Support for range formatting — ruby-formatter/rufo2 reactions · 1 comment
- Apr 27, 2024Intellisense with Ruby-LSP — rapid7/metasploit-framework2 reactions · 11 comments
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,736 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- CLAUDE.mdCLAUDE.md
The file
We split this AGENTS.md into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 45
Document related information is saved in a hash stored of { uri => Document }.
≈ “Common” is an estimate: at least 1 in 5 of the 16,597 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Project Overview
The Ruby LSP project aims to be a complete solution to provide an IDE-like experience for the Ruby language on VS Code. Its parts are:
ruby-lspgem: language server implementation and extra custom functionality to support the VS Code extension. This is the top level of the repository- Ruby code indexer: static analysis engine to support features like go to definition, completion and workspace
symbols. This is entirely implemented inside
lib/ruby_indexer - Companion VS Code extension that includes several integrations. The extension is entirely implemented in the
vscodedirectory - Jekyll static documentation site. Fully implemented in
jekyll
Ruby LSP gem
Architecture
The Ruby LSP is organized in components that composed the full language server functionality.
Server plumbing
The basic server functionality for communicating with the LSP client, remembering client capabilities, handling requests and notifications.
lib/ruby_lsp/server.rblib/ruby_lsp/base_server.rblib/ruby_lsp/utils.rblib/ruby_lsp/client_capabilities.rblib/ruby_lsp/global_state.rb
Requests and notifications
Requests and notifications are implemented in an extensible way so that add-ons can contribute to the base features provided.
lib/ruby_lsp/requests/: base request implementationslib/ruby_lsp/listeners/: static analysis logic, implementing through listeners. Traversal of ASTs is performed by aPrism::Dispatcherand listeners register for the node events that they are interested in handling. This allows listeners to encapsulate distinct logic without having to perform multiple traversals of the ASTlib/ruby_lsp/response_builders/: builder pattern to allow multiple listeners to contribute to the same language server response
Document storage
Document related information is saved in a hash stored of { uri => Document }. The language server handles Ruby, RBS
and ERB files to provide Ruby features.
lib/ruby_lsp/store.rb: document storagelib/ruby_lsp/document.rb: base document classlib/ruby_lsp/ruby_document.rb: Ruby document handlinglib/ruby_lsp/erb_document.rb: ERB document handlinglib/ruby_lsp/rbs_document.rb: RBS document handling
Add-on system
The Ruby LSP includes an add-on system that allows other gems to define callbacks and listeners that can contribute to features provided in the editor.
Examples:
- Contributing a code lens button to jump from Rails controller action to corresponding view
- Contributing location results when trying to go to definition on the symbol used to define a Rails callback
- Contributing diagnostics and formatting for a specific linting tool
- Displaying a window message warning
lib/ruby_lsp/addon.rb: major implementation of the add-on system. Feature contributions are connected to listeners and response builders
Testing
The gem uses a mix of unit tests, which are pure Ruby, and a custom built framework that matches response expectation to fixture files.
For request or notification related tests that aren't using fixtures, the structure should use the provided test helpers:
def test_feature_name
source = <<~RUBY
# Ruby code to test
RUBY
with_server(source) do |server, _uri|
# Make LSP request
# Assert response
end
endThe custom built framework runs all language server features against the files in test/fixtures. If there's a file
with the same name under test/expectations, it will assert that the response matches what is expected for each request
that has an expectation file. If there aren't any expectation files, the feature will still run against the fixture to
verify that it does not raise. Fixture files are simply Ruby and expectation files are JSON ending in .exp.json.
Type checking
The Ruby LSP codebase is fully typed with Sorbet's typed strict sigils using inline comment RBS annotations and RBI files.
Common RBS Patterns:
# Method signatures (placed above method definition)
#: (String name) -> void
def process(name)
# ...
end
# Variable annotations (placed after assignment)
@documents = {} #: Hash[URI::Generic, Document]
# Attribute type declarations (placed above attribute)
#: String?
attr_reader :parent_class
# Generic types
#: [T] () { (String) -> T } -> T
def with_cache(&block)
# ...
end
# Union and nullable types
result = nil #: (String | Symbol)?Type syntax reference: https://sorbet.org/docs/rbs-support
Commands
# Run all tests
bundle exec rake
# Run specific test file
bin/test test/requests/completion_test.rb
# Run tests matching a pattern
bin/test test/requests/completion_test.rb test_name_pattern
# Type check with Sorbet
bundle exec srb tc
# Lint with RuboCop
bin/rubocop
# Auto-fix RuboCop violations
bin/rubocop -aVS Code extension
The VS Code extension provides several integrations, some of which interact with the language server.
Architecture
The extension's entrypoint is implemented in vscode/src/extension.ts and vscode/src/rubyLsp.ts. This is where we
handle activation, detecting workspaces, registering commands and subscribers.
Integrations
- Language server client:
vscode/src/client.ts - LLM chat agent:
vscode/src/chatAgent.ts - Debug gem client:
vscode/src/debugger.ts - Dependencies view:
vscode/src/dependenciesTree.ts(integrates with language server)
Version manager integrations
A critical part of the extension is integrating with version managers. This is necessary because the Ruby LSP server is
a Ruby process that requires gems from the user's application (such as their formatter or linter). In order to require
the correct version of the gems being used, the environment being used in the extension must match exactly the
environment of the user's shell. Otherwise, bundle install might fail or key environment variables like $GEM_HOME
might be pointing to the wrong path.
vscode/src/ruby.ts: the main Ruby environment handling objectvscode/src/ruby/*.ts: all supported version manager integrations
Test explorer
The Ruby LSP's implementation of the VS Code test explorer allows handling any Ruby test framework by add-on contributions. The explorer connects to the LSP client to be able to ask questions about test files and determine which groups and examples exist in the codebase. This infrastructure is all custom built with language server custom requests.
While tests are running, the Ruby LSP server hooks into the process with an LSP test reporter to stream events through a TCP socket, so that the explorer is able to show the status of each test (extension is the TCP server and the test process is the client).
vscode/src/testController.tsandvscode/src/streamingRunner.ts: extension side implementation of test explorer and streaming event serverlib/ruby_lsp/test_reporters/lsp_reporter.rb: LSP reporter implementationlib/ruby_lsp/test_reporters/minitest_reporter.rb: Minitest reporter integrationlib/ruby_lsp/test_reporters/test_unit_reporter.rb: Test Unit reporter integrationlib/ruby_lsp/listeners/test_style.rb: Minitest and Test Unit test discovery and command resolution for test style (classes with method definitions)lib/ruby_lsp/listeners/spec_style.rb: Minitest test discovery and command resolution for the spec style (describe, it)
Commands
pnpm run lint # Lint TypeScript code
pnpm run test # Run extension tests (compiles via the `pretest` hook, then runs vscode-test)Running targeted tests
Pass flags through pnpm run test -- so they reach vscode-test instead of being consumed by pnpm:
# Run a single compiled test file (use the .js path, not .ts)
pnpm run test -- --run out/test/suite/workspace.test.js
# Run several files at once
pnpm run test -- --run out/test/suite/workspace.test.js --run out/test/suite/client.test.js
# Filter by suite or test name (regex match against the full "suite > test" name)
pnpm run test -- --grep "Workspace"
pnpm run test -- --grep "does not restart when watched files"
# Literal string match (no regex) — useful when the test name has regex metacharacters
pnpm run test -- --fgrep "repeated rebase steps"
# Invert the match — run everything except what `--grep`/`--fgrep` selects
pnpm run test -- --grep "slow integration" --invert
# Combine file scoping with name filtering for the fastest feedback loop
pnpm run test -- --run out/test/suite/testController.test.js --grep "discovers tests"
# List which tests would run without executing them (great for verifying a filter)
pnpm run test -- --dry-run --grep "Workspace"
# Stop at the first failure
pnpm run test -- --bail --grep "Client"Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

