Improving the Developer Experience with the Ruby LSP
Ruby LSP is a pure-Ruby language server from Shopify that provides editor features for Ruby without type checking or type annotations, aiming for performance and stability on large codebases like Shopify's Core monolith and leaning toward Rails-specific features. The post explains how the Language Server Protocol decouples editors from language tooling via JSON over STDIN/STDOUT, and how document synchronization keeps the server's view of open files current. It then walks through implementing a nonpositional Folding Range request by parsing files with the Syntax Tree gem (built on Ripper) and collecting class and method ranges with a visitor. The supported features are listed, and the post notes that YJIT gives a performance boost and that the YARP parser will add portability and error tolerance.
Related posts
- Building a ShopifyQL Code Editor
Shopify Engineering mediumAdeptShopify integrated ShopifyQL into the CodeMirror editor by writing an adapter that feeds its existing ANTLR-based, LSP-conforming TypeScript language server into CodeMirror's Lezer parse trees, avoiding a Lezer grammar rewrite. The hard part was converting LSP semantic tokens, whose line and character offsets are relative to the previous token and can go negative when comments are parsed on a separate ANTLR channel, into CodeMirror's absolute document offsets. A custom TokenIterator tracks line lengths and the current position to compute absolute start and end offsets for a Lezer buffer. The language server's validate, complete and hover functions were then wired to CodeMirror's linting, autocomplete and hover-tooltip plugins.
- Postgres Language Server: Initial Release
Supabase mediumAdeptPostgres Language Server is an LSP implementation for Postgres offering autocompletion, syntax error highlighting, type-checking via PREPARE/EXPLAIN against a live database, and a Squawk-inspired linter, available for VSCode, Neovim and as a CLI. Its architecture treats each SQL statement as an independent compilation unit with the database schema as the source of truth. A custom Pratt-parser statement splitter falls back to semicolons and double newlines. libpg_query handles precise parsing of valid SQL, while tree-sitter covers incomplete input for autocompletion. On edits, only changed statements are invalidated and later statements just have their ranges shifted, so cached ASTs survive. Completions are scored from a lazily loaded in-memory schema cache, so no database query is needed per keystroke.
- Enabling low-latency, syntax-aware editing using Tree-sitter
Zed mediumAdeptZed builds its syntax-aware features on Tree-sitter, a GLR-based incremental parsing framework with error recovery that produces concrete syntax trees. Syntax-aware selection uses the CST directly. Highlighting, symbol outlines, auto-indentation and language injections are each driven by declarative Tree-sitter queries, which compile to state machines matched in a single depth-first walk, so adding a language needs only a grammar and query files. Injected trees, such as JavaScript inside HTML or Rust macro arguments, are kept in a copy-on-write B-tree called a sum tree, which lets edits be re-parsed incrementally on a background thread while the main thread keeps reading the previous snapshot.
- Try Out YJIT for Faster Rubying
Shopify Engineering mediumAdeptYJIT, Shopify's just-in-time compiler built into CRuby and slated for Ruby 3.1, compiles frequently used Ruby code to native machine code, speeding up a simple Rails benchmark by 20% or more and a real Shopify web service by about 6% on canary traffic. Building it is the same as building CRuby from source: autoconf 2.69, OpenSSL 1.1 and a C toolchain, then enabling it with --enable-yjit or RUBY_YJIT_ENABLE=1. Compiling with YJIT_STATS or RUBY_DEBUG exposes detailed runtime statistics such as the share of instructions YJIT executed, generated code size and ISEQs compiled. YJIT passes Shopify's and GitHub's unit test suites but is still early, so the team asks users to report crashes and performance results.
- Ruby 3.2’s YJIT is Production-Ready
Shopify Engineering easyNoviceYJIT, Shopify's JIT compiler for CRuby, became production-ready in Ruby 3.2 after a port from C99 to Rust and a cut in memory overhead to about a third of Ruby 3.1 levels. The memory savings came from smaller metadata, garbage collection of unused machine code and lazily allocated code pages. YJIT now runs about 38% faster than the 3.2 interpreter on railsbench and supports ARM64. Deployed across Shopify's entire Storefront Renderer, it delivers 5–10% end-to-end request speedups, and its fast compilation suits continuous deployment. Planned work targets memory footprint, faster method calls via a new calling convention and inlining, and a register allocator.