Shopify / Shopify/tapioca

LSP: Custom DSL Extensions not loading

Open
#2,238 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
873
Forks
164
Avg merge
4d 27m
Merged PRs (30d)
9

Description

I originally reported this on the ruby-dx slack.

I am using the tapioca add on for the ruby lsp in an application that has several custom dsl extensions. I am seeing errors on lsp reruns of tapioca that indicate to me that extensions are not loading, or the constants they are patching are being overwritten downstream.

I'm able to repro in this minimal rails app.

For reference, the error I am seeing in that app is

2025-03-12 09:29:12.089 [info] (ruby-lsp-extension-repro) Request dsl failed:
/Users/carlos.quinones/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-8.0.2/lib/active_record/dynamic_matchers.rb:22:in `method_missing': undefined method `__tapioca_test_method_calls' for User:Class (NoMethodError)
Did you mean?  __tapioca_stored_attributes
	from /Users/carlos.quinones/ruby-lsp-extension-repro/sorbet/tapioca/compilers/test_compiler.rb:18:in `decorate'

Indicating that the attr_reader defined in the extension is not defined on the constant when the associated compiler is run.

Other details:
Ruby LSP version 0.9.9
ruby-lsp gem version 0.23.12

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal Rails reproduction linked in the issue, especially sorbet/tapioca/extensions/test_extension.rb and sorbet/tapioca/compilers/test_compiler.rb. Reproduce the LSP rerun failure and trace why the extension's attr_reader is unavailable when the compiler runs. Done means the custom DSL extension loads for the rerun and the reported NoMethodError no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.