unisonweb / unison

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

proposal to make renames more ergonomic #4356

Open ceedubs opened 11 months ago

ceedubs commented 11 months ago

Problem description per @SystemFw:

When doing code organisation stuff like moves and renames in a big project, typing the whole path for each term is quite cumbersome (move.term durable.SortedMap.internal.test.Sample.Percentiles.percentile durable.SortedMap.internal.test.Sample.Percentiles.percentiles)

Proposed solution (a simple low-hanging fruit proposal) per @ceedubs:

Accept a single-arg move command (move.term, move.type, move, or rename or whatever) like:

move durable.SortedMap.internal.test.Sample.Percentiles.percentile.

Then give a prompt like:

What should the new name be? Edit the second argument to the new name you would like:

.mylib> move.term durable.SortedMap.internal.test.Sample.Percentiles.percentile durable.SortedMap.internal.test.Sample.Percentiles.percentile

So it defaults to the current name, but you can use your cursor to edit the name.

Bonus points for accepting a no-arg move and allowing the user to search for the current name via fzf.

SystemFw commented 11 months ago

Fwiw, I do like the single move, but I still prefer a solution based on cd

aryairani commented 10 months ago

What's an example of a solution based on cd?

aryairani commented 9 months ago

^ @SystemFw 🙏

SystemFw commented 9 months ago

Oh sorry, I missed the first notification. For me it boils down to what we've talked about in some other thread: when you cd foo, names in commands are implicitly prefixed with foo, and you can use .bar.baz for absolute paths. So in this case:

> move.term durable.SortedMap.internal.test.Sample.Percentiles.percentile durable.SortedMap.internal.test.Sample.Percentiles.percentiles

I'd like to do:

 > cd durable.SortedMap.internal.test.Sample.Percentiles
 durable.SortedMap.internal.test.Sample.Percentiles> move percentile percentiles