Shopify / Shopify/ruby-lsp-rails

Enhance our schema hover link to jump to the right table

Open
#52 6 comments 2 reactions 0 assignees View on GitHub

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

  1. Start returning the table name from our middleware
  2. During the activate call parse schema.rb and create a hash of table names to locations
  3. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.