tapioca
tapioca copied to clipboard
LSP: Custom DSL Extensions not loading
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