LSP: Custom DSL Extensions not loading
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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