Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic refactoring: changing variable names #2209

Open
CameronBieganek opened this issue Jul 12, 2022 · 3 comments
Open

Automatic refactoring: changing variable names #2209

CameronBieganek opened this issue Jul 12, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@CameronBieganek
Copy link

It would be awesome if Pluto automatically (reactively) updated variable names when you change the name of a variable where it is first defined. For example, if I had these two cells,

Cell 1

a = 1

Cell 2

b = a + 42

and I changed the name of a to foo in Cell 1, it would be great if Pluto automatically updated Cell 2 to read b = foo + 42.

@Pangoraw Pangoraw added the enhancement New feature or request label Jul 12, 2022
@fonsp
Copy link
Owner

fonsp commented Sep 1, 2022

@Pangoraw or @dralletje have we worked on this before? How feasible is this? What about macros like @syms x y z?

@fonsp fonsp changed the title Automatic refactoring (e.g. changing variable names) Automatic refactoring: changing variable names Sep 1, 2022
@Pangoraw
Copy link
Collaborator

Pangoraw commented Sep 5, 2022

How feasible is this?

If we can add back something like #1925 with a smaller performance cost it should be quite easy to implement (not for macro defined symbols however).

@dralletje
Copy link
Collaborator

How feasible is this?

If we can add back something like #1925 with a smaller performance cost it should be quite easy to implement (not for macro defined symbols however).

Yeah, this would be best I think. We could add some special cases for @gensym and friends, but there is no way to backtrack what symbol in the code was used to create a variable in a macro result (sadly), so no automagic here :(

Would be cool if we had some flow for applying these kind of tasks to your notebook, where Pluto would present you with cases where it is not sure what to do (say, we know a variable is used in a cell, but we can't figure out where so we show it to you like "Hey you need to update something here!"), but that would be a whole project 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants