Shopify / Shopify/ruby-lsp-rails
Through go to definition response returns the definition of the association instead of the through association
Open
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 688
- Forks
- 44
- PR merge metrics
- No merged PRs in 30d
Description
The following code snippet has a go to definition response on the :bar symbol in has_one :baz, through: :bar. It returns with the class location of baz, while I would expect to either got to the belongs_to :bar definition or the has_one :baz definition in Bar.
class Foo < ActiveRecord::Base
belongs_to :bar
has_one :baz, through: :bar
end
class Bar < ActiveRecord::Base
has_one :foo
has_one :baz
end
class Baz < ActiveRecord::Base
belongs_to :bar
end
Contributor guide
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
No file or test is named. Start at the go-to-definition handling for Rails associations and reproduce the response with the Foo, Bar, and Baz example; done means the :bar symbol resolves to an appropriate association definition rather than the Baz class location.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100