Shopify / Shopify/ruby-lsp-rails
Enhance our schema hover link to jump to the right table
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- Ruby
- Stars
- 688
- Forks
- 44
- PR merge metrics
- No merged PRs in 30d
Description
Currently, our schema link just points to the file. However, we can link to the specific table for the model, which is a richer experience.
One possibility of how we can do this is by
- Start returning the table name from our middleware
- During the
activatecall parseschema.rband create a hash of table names to locations - When executing hover, search the hash for the right line to jump to
Concerns
- If there are modifications in schema.rb, we would need to rebuild the hash. For that, we need file watching to be merged in the Ruby LSP and then we have to design a way in which extensions can ask the Ruby LSP to notify them when certain files are changed.
- This won't work for
structure.sql. We probably don't want a SQL parser, but we might be able to achieve something with regexes
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
Start by tracing the middleware response, the activate call, and the hover handling in the add-on. Review how schema.rb locations could be mapped and account for the noted file-watching dependency and structure.sql limitation. Done means a schema hover link jumps to the model's table rather than only to the schema file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100