martinvonz / jj

A Git-compatible VCS that is both simple and powerful
https://martinvonz.github.io/jj/
Apache License 2.0
9.32k stars 321 forks source link

Dynamic completions wishlist #4763

Open senekor opened 2 weeks ago

senekor commented 2 weeks ago

As dynamic completions are being worked on, let's use this issue to gather ideas for possible completions in one place. I'll try to keep the list in the issue description up to date according to the discussion below.

open questions:

places to scrape for ideas and implementations:

misc:

bnjmnt4n commented 2 weeks ago

Here's the features that I implemented for my custom Fish completions:

senekor commented 2 weeks ago

Awesome, thank you so much!

Otherwise, the list of files are read from the given working copy.

Is this different from telling the shell to use its built-in file path completion? clap has some specific hints that don't require dynamic completions. I guess the difference would be the inclusion of gitignored files?

Should we allow snapshotting of the working copy, so that e.g. jj commit/squash/split works without having to run another jj command first?

I have currently disabled it in my PR. We could allow it for those commands specifically, so we don't incur the performance overhead on commands where it doesn't matter. I have never tried it, but there is the file watcher option for snapshotting too, right? So if users run into performance problems, they could solve it for themselves that way.

bnjmnt4n commented 2 weeks ago

Otherwise, the list of files are read from the given working copy.

Is this different from telling the shell to use its built-in file path completion? clap has some specific hints that don't require dynamic completions. I guess the difference would be the inclusion of gitignored files?

To clarify, here's the full original statement:

  • If the command uses a -r or --from flag, the list of files is read from the given revision.
  • Otherwise, the list of files are read from the given working copy.

This will allow file completion of paths at a different revision e.g. jj restore --from XXX file[TAB] can provide a completion if the file doesn't exist in the current working directory but exists in the given revision. Additionally, jj also permits sparse working copies which means that a file might not be checked out in the working directory, but it will still be helpful to do e.g. jj file show file[TAB].

senekor commented 2 weeks ago

Aah, I didn't think about sparse checkouts, that makes sense!

senekor commented 5 days ago

Alright, I'm just about out of steam here. I'll carry the currently open PRs across the finish line, but I'm not planning to do more than that.

The only thing remaining on the list right now is dynamic configuration keys. (e.g. jj config get --user aliases.<TAB> completes your user-defined aliases) While I did come up with that, it doesn't seem very useful to me now. I would probably just open the config file in an editor if I needed to check my aliases.

If people come up with other cool completions, anyone should feel free to claim the work and not wait for me :slightly_smiling_face:

martinvonz commented 5 days ago

Alright, I'm just about out of steam here. I'll carry the currently open PRs across the finish line, but I'm not planning to do more than that.

Thank you!

If people come up with other cool completions, anyone should feel free to claim the work and not wait for me 🙂

I think the most valuable next item might be completion of revision arguments.

senekor commented 5 days ago

I think the most valuable next item might be completion of revision arguments.

That one is actually already merged: https://github.com/martinvonz/jj/pull/4873

It just wasn't on the list here. (fixed now) I constantly had issues with editing the issue text. GitHub would always reset previous edits I had made. Very frustration. I'm never going to use GitHub issues as a "living document" anymore. (That's what we have version control for, right? :smile:)

martinvonz commented 5 days ago

That one is actually already merged: #4873

Ah, I had missed that. So we just need to extend that to support completion of local and remote branches and tags then.

senekor commented 5 days ago

True, that must've slipped off the list as well...

edit: done #4900