FZF on argument types - #4519
Conversation
|
Ooh the Sometimes I want to do an This PR gets a ❤️ from me. |
I missed how it would break the workflow, I don’t think it would? Also Lmk if I missed something. If not, we can include it or not — either way is ok, just let me know whether to go forward with review in light of this or wait. |
|
I was just thinking that if you're doing find; edit 1-1000 often you'd probably want to be able to press up to do it again rather than type out edit 1-1000, but I guess that's a question for Cody and Stew. Either way, this diff is getting pretty big, and that feature can easily be added independently, so I think we should probably move on without it for now. |
|
FWIW, I'm unlikely to hit up to try to run |
|
This is cool. I'm still reading through it, and it looks like I created a conflict by merging other stuff, but otherwise 👍 |
|
One possibility would be to sunset Globbing now that fzf is better integrated and use |
|
Good catch @ceedubs , yeah as part of this feature I've found 3-4 commands which had arguments mis-labeled as "Required", push is one of them apparently. |
|
I'll do a quick audit over all EDIT: Yup, found a bunch more |
|
Thanks, Chris. I've pulled your changes, but I'm stuck in yaml land for a while, so I'm not sure if I'll get to take it for much of a second test spin today. |
|
I definitely want the fzf support for missing Required args, but I’m uneasy about the What would splitting it out of this PR look like, (ie auto fzf support for missing Required args vs support for missing Required or Optional args)? What are other solutions to the issue @ceedubs described, which this fzf support for optional args addresses? Also if we add the feature in the first merge, maybe |
|
Doesn't need to hold up this PR, but |
It's easy to remove, and we can add it in later if we want; it just means that if removed it becomes impossible to fuzzy-select ANY of the optional args, and impossible to fuzzy-complete in situations where you want to complete a required arg that's followed by an optional arg. E.g. if you have a two argument merge, the second argument is optional, so it's impossible to fuzzy-complete the first arg while specifying the second like |
|
@ceedubs Ah, looks like there are a bunch more commands without any argument types at all 🙃 , patched any I could find that were missing (including dependents/dependencies) 👍🏼 |
|
It looks like a no-arg |
|
For optionals: Is there some way we can just make |
I tried this in an earlier iteration and Haskeline doesn't really like it. I did get it working, but since fzf overwrites a lot of the screen-space I couldn't get it to show the argument you completed properly, it would mess up the whole line. It's probably possible, but I doubt we could get it to work consistently in every terminal editor and on Windows :'( |
|
As of today the plan is to split off the |
|
I've been using a build off of this branch for a couple of days and it has been going really well. Admittedly I had forgotten about the |
aryairani
left a comment
There was a problem hiding this comment.
Over the finish line :DD
Overview
Adds FZF argument resolution to most commands that could support it.
The FZF resolver kicks in when:
An argument is filled with the!placeholder. We can bikeshed this, but it's invalid to call a definition just!so it seemed a reasonable choice.When triggered, the fuzzy-finder will load all the possible options and let you select one (or more) depending on the argument type, e.g. a
OnePlusargument lets you multi-select whereas anOptionalargument just lets you select zero or one arg.E.g.
UCM will also now re-print the command that you ran with all arguments from numerical and fzf expansion expanded so you can see what was actually executed, e.g.
Implementation notes
fzfResolveronto the ArgumentType.Adds a step AFTER numbered-arg expansion but BEFORE argument parsing where FZF can fill in any missing or!arguments.parseInputcommand so I can fetch projects, seems uncontroversial.debug.fuzzy-optionswhich allows listing fuzzy completion options in transcripts.Interesting/controversial decisions
Test coverage
debug.fuzzy-optionstranscriptsLoose ends
If FZF is 'ctrl-c'd we shouldn't continue to running the commandThe selected arguments are never actually printed in the terminal, so it's tough to tell what you did when you look back.edit.namespaceto make this change so we don't break theedit 1-1000workflow.