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

Add associations on Rails Models for Hover

Open rickcaudill opened this issue 1 year ago • 6 comments

This patch is to add associations to rails models:

Screenshot 2024-03-10 at 12 27 54

rickcaudill avatar Mar 10 '24 18:03 rickcaudill

A few more suggestions after talking with the team:

  • Rather than pushing line by line to @response_builder, let's build up the full string first, then we just need one call. It will probably help to extract a private method for this.
  • Let's avoid the nbsp characters in the markdown. Even thought it may look ok in VS Code, this has to work in other editors too, so we shouldn't assume too much about how it gets rendered.
  • Using heredocs rather the concatenating strings may improve readability.

andyw8 avatar Mar 11 '24 18:03 andyw8

Small suggestion after trying on a large model with many assocations: We could sort the list alphabetically within each 'group' (e.g. has_many).

andyw8 avatar Mar 12 '24 14:03 andyw8

A few more suggestions after talking with the team:

  • Rather than pushing line by line to @response_builder, let's build up the full string first, then we just need one call. It will probably help to extract a private method for this.
  • Let's avoid the nbsp characters in the markdown. Even thought it may look ok in VS Code, this has to work in other editors too, so we shouldn't assume too much about how it gets rendered.
  • Using heredocs rather the concatenating strings may improve readability.

I will see when I can get to all these. Probably won't be until late this week now. I am quite busy at work right now but will get it done ASAP.

rickcaudill avatar Mar 12 '24 16:03 rickcaudill

:wave: @rickcaudill

At RailsConf next week, there is going to be Hack Days session for Ruby LSP Rails.

Would you be ok with other people contributing to this PR to help complete it?

andyw8 avatar May 02 '24 14:05 andyw8

👋 @rickcaudill

At RailsConf next week, there is going to be Hack Days session for Ruby LSP Rails.

Would you be ok with other people contributing to this PR to help complete it?

Actually I was going to get to this this weekend. If I don't happen to I would appreciate some help. I have another one as well that I'm working on. The reason why its slow is because I'm in the middle of a big push at work and working with some additional clients right now. However I was planning to try to get this done this weekend. My team uses visual studio code as an IDE so these changes are quality of life changes for my team.

rickcaudill avatar May 02 '24 15:05 rickcaudill

Ok, no problem, I'll leave it with you 👍

andyw8 avatar May 02 '24 17:05 andyw8