leanprover / leanprover/lean4

VS Code F2 renaming goes too far

Open
#11,403 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Lean
Stars
9.2k
Forks
990
Avg merge
1d 17h
Merged PRs (30d)
175

Description

Prerequisites

Please put an X between the brackets as you perform the following steps:

Description

VS Code F2 renaming renames more than it should

Steps to Reproduce
  1. Open the following in VS Code
import Mathlib.Algebra.Lie.Nilpotent

universe u₁ u₂ u₃ u₄

variable {R : Type u₁} {L : Type u₂} {M : Type u₄}
variable [CommRing R] [LieRing L] [LieAlgebra R L]
variable [AddCommGroup M] [Module R M] [LieRingModule L M] [LieModule R L M]

namespace LieSubmodule

open LieModule

variable {I : LieIdeal R L} {x : L}

theorem exists_smul_add_of_span_sup_eq_top (y : L) : ∃ t : R, ∃ z ∈ I, y = t • x + z := by
  sorry

theorem lie_top_eq_of_span_sup_eq_top (N : LieSubmodule R L M) :
    (↑⁅(⊤ : LieIdeal R L), N⁆ : Submodule R M) =
      (N : Submodule R M).map (toEnd R L M x) ⊔ (↑⁅I, N⁆ : Submodule R M) := by
  sorry

end LieSubmodule
  1. Select the variable R on line 5
  2. Use VS Code F2 feature to rename

Expected behavior: Only the variable R should be renamed.

Actual behavior: The variable R and also the variable y appearing in y = t • x + z is renamed.

Versions

Lean: 4.26.0-rc2
OS: MacOS 15.6.1

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

Reproduce the F2 rename from the provided Lean snippet in VS Code, first reducing it to a minimal case without Mathlib or Batteries. Trace the F2 rename entry point and verify that renaming variable R changes only R, while the y in y = t • x + z remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
vscode
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.