leanprover / leanprover/vscode-lean4

The "Rename Symbol" code action fails to account for constructor/destructor tags

Open
#799 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
313
Forks
104
Avg merge
1h 56m
Merged PRs (30d)
1

Description

The "Rename Symbol" code action in VS Code seems to have issues with inductive types.

inductive Meow where
| mrow
| hiss

def foo : Meow -> Unit
| .mrow => ()
| Meow.hiss => ()

def bar := Meow.mrow

Placing the cursor on Meow in inductive Meow and renaming the symbol will rename it in : Meow, but leave the original symbol name in all destructors and constructors (| Meow.hiss, := Meow.mrow).

Placing the cursor on | mrow in inductive Meow and renaming the symbol (ex. to baz) will incorrectly rename it to | baz (missing the . prefix) in def foo and := baz in def bar (missing the Meow. prefix).

Placing the cursor on .mrow or Meow.hiss in def foo and renaming the symbol will let you rename the whole symbol (i.e. .mrow, Meow.hiss), rather than just the intended mrow or hiss.

vscode-lean4: 0.0.239
lean-toolchain: leanprover/lean4:v4.34.0
Fedora 44

Contributor guide

No contributing guide indexed for this repository

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 at the VS Code "Rename Symbol" code action and reproduce the issue with the Lean inductive-type snippet in the report. Trace how constructor and destructor references are selected and qualified; done means renaming the inductive type updates all references and renaming mrow or hiss preserves the appropriate . or Meow. qualification.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.