Implement basic schema goto definitions #671
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added basic "Go to Definition" support for Rails routes in
routes.rbfiles.This allows navigating from route strings like
'users#archive'to the corresponding controller action. This can be expanded in another PR (e.g. adding goto definiton support for things likeresource :special_user, only: [:show]- executing goto definition on:special_userwould take us toSpecialUserController)The implementation is limited in that it does not consider the exact position of the cursor. Ideally, hovering on the controller (
users) would jump to the first line of the controller file, while hovering on the action (archive) would jump directly to the method. Currently, we lack cursor information to differentiate these cases.When multiple controllers share the same name and action, for example if both
Admin::UsersController#archiveandUsersController#archiveexist, all matching methods are returned. This could potentially be improved by using Shopify/ruby-lsp#3863 and traversing the nesting nodes. But, I believe this is beyond the scope of the current PR and could be addressed in a separate one.recording.mp4