Skip to content

Renaming redefined variables doesn't work #1033

@gpanago

Description

@gpanago

Describe the Bug

Consider the following:

i = 0
while i < 10:
    i = i + 1

For me, when I ask pyrefly to rename the first occurrence of i to j (via a textDocument/rename), it produces:

j = 0
while j < 10:
    i = j + 1

i.e., it does not rename the redefined i variable.

Note that, for me (using Emacs lsp-mode), when I hover over the first occurrence of i in the first snippet, pyrefly does not highlight the redefined i variable, although I cannot reproduce that in the Sandbox.

Sandbox Link

No response

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions