Skip to content

Add support for renaming local variables#1232

Open
lionel- wants to merge 3 commits into
oak/find-refs-intra-filefrom
oak/rename-intra-file
Open

Add support for renaming local variables#1232
lionel- wants to merge 3 commits into
oak/find-refs-intra-filefrom
oak/rename-intra-file

Conversation

@lionel-
Copy link
Copy Markdown
Contributor

@lionel- lionel- commented May 26, 2026

Branched from #1231

Addresses posit-dev/positron#13749
Part of #1149

Implements rename for local definitions. If a symbol is unbound locally, an error is emitted. Cross-file renaming will come along with the Salsa infrastructure.

See usage in screencast. The most surprising behaviour is with nested lazy contexts where the enclosing snapshot reaches definitions and uses below the context. That's a consequence of the over-approximation we inherit from ty. The alternative would be to perform full call analysis to determine exactly what a nested symbol can reach (intractable in general).

Screen.Recording.2026-05-26.at.08.56.49.mov

See user-facing errors in second screencast, when trying to rename something not renamable, or to an invalid identifier. There should be no backtraces in user visible popups.

Screen.Recording.2026-05-26.at.08.57.32.mov

@lionel- lionel- force-pushed the oak/rename-intra-file branch from 233e283 to 0bead42 Compare May 26, 2026 07:28
@lionel- lionel- requested a review from DavisVaughan May 26, 2026 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant