unisonweb / unison

A friendly programming language from the future
https://unison-lang.org
Other
5.74k stars 268 forks source link

renaming a term in ucm while you're editing it in the scratch file is a hassle, because you have to update the name in several places at once #4422

Open aryairani opened 10 months ago

aryairani commented 10 months ago

Idea: support a rename directive in the scratch file. On save, it would make the change to the namespace, and re-print the scratch file.

aryairani commented 10 months ago

Some ideas:

  1. renaming the term in UCM also rewrites your scratch file
  2. support a directive to the scratch file that renames a term in your branch (and probably also in the scratch file)

If we go with option 1, if you wanted to reuse a name, you'd have to rename first in UCM, then rename back manually in the scratch file? Or would we have a separate command for renaming in branch only, vs branch+scratch?

aryairani commented 10 months ago

@hojberg wdyt?

ceedubs commented 10 months ago

I also think that the update improvements will make this less of an issue. One of the reasons that I encountered it so much previously is that I basically had to keep all of the terms in my scratch file. If I'm back to editing fewer terms at a time, this is less of an issue.

hojberg commented 10 months ago

@aryairani and I met briefly and came to a similar conclusion to what @ceedubs is saying. We'll have to wait and see how things play out, but there's definitely going to be cases when this would be useful. In those cases, I think I'd lean to option 1. I do however also feel there's something powerful and interesting in option 2. It almost sounds like an interactive transcript and that might be a really cool UX.

SystemFw commented 9 months ago

Although I edit relatively few terms at the time, I'd still like Option 1 to exist