We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thanks for your great work on this add-on!
I noticed that I don't see the Rails routes in controllers (https://shopify.github.io/ruby-lsp/rails-add-on.html#go-to-controller-action-route) due to the routes being inside constraints (https://guides.rubyonrails.org/routing.html#request-based-constraints). If I move the route outside of the constraint and reindex, the route shows up in the CodeLens. Is it possible to extend the support for these?
I think it fails because of not having the subdomain requirement present here: https://github.com/Shopify/ruby-lsp-rails/blob/main/lib/ruby_lsp/ruby_lsp_rails/server.rb#L193-L198
subdomain
For example one my routes has these
@defaults={:subdomain=>"app", :controller=>"health", :action=>"index"},
which would not match when requirements just have the controller and action present and comparing the full hash (route.requirements == requirements)
controller
action
route.requirements == requirements
::Rails.application.routes.from_requirements({ controller: "health", action: "index" }) => nil ::Rails.application.routes.from_requirements({ controller: "health", action: "index", subdomain: "app" }) => #<ActionDispatch::Journey::Route:0x0000000133e56e18
If the full hash comparison does not give any results, could there be a fallback that just checks with controller and action or something like that?
::Rails.application.routes.routes.find { |route| route.requirements[:controller] == requirements.fetch(:controller) && route.requirements[:action] == requirements.fetch(:action) }
Or is there a way to get the subdomain context somehow in the params?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Thanks for your great work on this add-on!
I noticed that I don't see the Rails routes in controllers (https://shopify.github.io/ruby-lsp/rails-add-on.html#go-to-controller-action-route) due to the routes being inside constraints (https://guides.rubyonrails.org/routing.html#request-based-constraints). If I move the route outside of the constraint and reindex, the route shows up in the CodeLens. Is it possible to extend the support for these?
I think it fails because of not having the
subdomain
requirement present here:https://github.com/Shopify/ruby-lsp-rails/blob/main/lib/ruby_lsp/ruby_lsp_rails/server.rb#L193-L198
For example one my routes has these
which would not match when requirements just have the
controller
andaction
present and comparing the full hash (route.requirements == requirements
)If the full hash comparison does not give any results, could there be a fallback that just checks with
controller
andaction
or something like that?Or is there a way to get the subdomain context somehow in the params?
The text was updated successfully, but these errors were encountered: