st0012 / ruby-lsp-rspec

A Ruby LSP addon for RSpec tests
MIT License
127 stars 7 forks source link

Support go to `let`, `let!`, `subject`, and `subject!` definitions #38

Closed st0012 closed 1 month ago

st0012 commented 2 months ago

https://github.com/user-attachments/assets/edb4e8cc-4740-492a-a388-a708e18e74b2

This is a naive implementation that lists all definitions from the same file.

To better implement this, we need to create the RSpec::ExampleGroups class structures, add the declarations as its methods, and look up the definition based on the example's context.

st0012 commented 1 month ago

Actually, it's not possible to support the right way atm because Ruby LSP's index enhancement doesn't support on_call_node_enter|leave events. This means that it's not possible to track when a scope is entered/left, which we need to create the correct pseudo classes.