Shopify / Shopify/ruby-lsp

Add inline variable refactor

Open
#2,504 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help-wanted pinned server
Dominant language
Ruby
Stars
2k
Forks
281
Avg merge
2h 14m
Merged PRs (30d)
6

Description

[!NOTE]
This issue is aimed at those attending the RubyConf 2024 Hack Day

Add a new code action to inline a local variable. For example:

# BEFORE
def foo
  a = 5 * 10
  puts a
  b = a - 5
end

# AFTER
def foo
  puts 5 * 10
  b = 5 * 10 - 5
end

Here's an example PR adding a refactor end to end https://github.com/Shopify/ruby-lsp/pull/2372.

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 reviewing the end-to-end refactor example in PR #2372 and the Ruby LSP code-action entry points. Implement the inline-local-variable action shown in the issue, including the transformation from the BEFORE example to the AFTER example, and verify the action works for that case.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.