Skip to content

Add hover for model associations #476

Open
@vinistock

Description

@vinistock
Member

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

Activity

andyw8

andyw8 commented on Oct 4, 2024

@andyw8
Contributor

(implementation was in #373)

rogancodes

rogancodes commented on Apr 23, 2025

@rogancodes
Contributor

Hi Team, Im looking at this issue.

domingo2000

domingo2000 commented on May 31, 2025

@domingo2000
Contributor

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:

Screencast.from.31-05-25.14.02.28.webm

It would be nice to have feedback on this.

linked a pull request that will close this issue on Jun 1, 2025
vinistock

vinistock commented on Jun 18, 2025

@vinistock
MemberAuthor

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.

domingo2000

domingo2000 commented on Jun 19, 2025

@domingo2000
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp-wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @andyw8@vinistock@domingo2000@rogancodes

      Issue actions

        Add hover for model associations · Issue #476 · Shopify/ruby-lsp-rails