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

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

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

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

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.

Description

bug

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

Dominant language
TypeScript
Stars
327
Forks
109
Avg merge
2d 10h
Merged PRs (30d)
12

Getting set up

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.

More from leanprover/vscode-lean4

All issues in leanprover/vscode-lean4

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.