ruby-lsp-rails icon indicating copy to clipboard operation
ruby-lsp-rails copied to clipboard

Add hover for model associations

Open vinistock opened this issue 1 year ago • 2 comments

In #358, definition support for associations was added. We can do the same thing for hover, which would be quite nice in my opinion.

Implementation

  1. Start returning the fully qualified name of the constant related to the association from the server here
  2. Generalize this API to return the full information about an association, rather than being specific about locations only
  3. Fix the API changes in definition.rb
  4. Then use a similar approach to produce hover content

vinistock avatar Oct 04 '24 14:10 vinistock

(implementation was in https://github.com/Shopify/ruby-lsp-rails/pull/373)

andyw8 avatar Oct 04 '24 17:10 andyw8

Hi Team, Im looking at this issue.

ro-gun avatar Apr 23 '25 14:04 ro-gun

Hi!. I also started working on this. Already have it working, but my question for the implementation is ¿Which kind of information should we show on hover?. I thought that we could start showing the same information as RubyLsp in constant hovering, copying the implementation from there.

Here is a demo:

https://github.com/user-attachments/assets/79f0eba4-c2cf-46e3-8c9e-7db903edc89d

It would be nice to have feedback on this.

domingo2000 avatar May 31 '25 18:05 domingo2000

Hey, @domingo2000! I think we can show what the LSP normally does for any class. So we'd just use the same process as definition to figure out which class represents the association and then we'd show the definition links + documentation for the class.

vinistock avatar Jun 18 '25 19:06 vinistock

Hi @vinistock!, This PR does just that, happy to receive feedback there 👌🏻. If some refactor to unify that common logic is necessary ping me in the PR and i should be able to work on these when i have time available.

domingo2000 avatar Jun 19 '25 00:06 domingo2000