martinvonz / jj

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

Dynamic completions wishlist #4763

Open senekor opened 2 days ago

senekor commented 2 days 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:

bnjmnt4n commented 2 days ago

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

senekor commented 2 days 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 days 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 days ago

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