rebar3 icon indicating copy to clipboard operation
rebar3 copied to clipboard

completion provider

Open MarkoMin opened this issue 5 months ago • 3 comments

Provider to generate autocompletion files. Generates completion for plugins too, which is a big step forward! Previous completion also worked only for the first flag.

Currently only completion for bash is implemented. I'll first wait for comments on style/tests and then I'll implement zsh and maybe others.

Also, documentation is missing, but it will be written as soon as implementation gets reviewed and I manage to get some free time.

@ferd About testing, I did what I believe is convenient here - do you have more suggestions ? It ensures that file is written and that it contains some key parts such as function definition (loose regex) and completion definitions for "rebar3" and for all os-level aliases. I can't run a bash built-in (source) to run the completion function from CT...

Closes #2077

EDIT: #2754 can now be implemented as an oracle and it will be available in all supported shells! Actually, completion for rebar3 as <profile> and rebar3 clean --projects <project> could be implemented with small modifications. Current completion for rebar3 as is partly broken, so you can ignore it for now.

MarkoMin avatar Jan 22 '24 12:01 MarkoMin

Also, I use maps:groups_from_list/2 which is introduced in OTP 25.0, is that a problem?

MarkoMin avatar Jan 27 '24 16:01 MarkoMin

Also, I use maps:groups_from_list/2 which is introduced in OTP 25.0, is that a problem?

Yeah this is going to be an issue in the short term. We currently support 24, 25, and 26. Once 27 is out, we'll deprecate 24, though.

ferd avatar Jan 28 '24 01:01 ferd

Yeah this is going to be an issue in the short term. We currently support 24, 25, and 26. Once 27 is out, we'll deprecate 24, though.

Solved via macro, we can remove it when <25 gets deprecated.

Let me know if everything is good now so I can create support for zsh before merging this.

Sorry about crashdump, mistake... Will get purged when we squash commits

MarkoMin avatar Jan 29 '24 05:01 MarkoMin

Woops I hadn't seen the update. This looks okay for zsh now, and yeah, feel free to remove that crashdump whenever.

ferd avatar Feb 20 '24 16:02 ferd

Did it. Now only documentation is missing. I'll document it in commands section. Is it worth to move instructions on how to set up autocomplete to another section (probably in tutorials)? Because I don't wanna bloat commands page with setup instructions that might grow with different shells being supported.

What will be the number of the next version? It would be nice to mention from which version completion command became available

MarkoMin avatar Mar 02 '24 16:03 MarkoMin

Did it. Now only documentation is missing. I'll document it in commands section. Is it worth to move instructions on how to set up autocomplete to another section (probably in tutorials)? Because I don't wanna bloat commands page with setup instructions that might grow with different shells being supported.

I don't have an issue with that if you think it warrants the complexity. Having it in the commands for the list of arguments makes sense as well.

What will be the number of the next version? It would be nice to mention from which version completion command became available

3.23, since this is going to be a new feature, we'll be able to go up a number regardless.

ferd avatar Mar 05 '24 15:03 ferd

Fixed. I'll ping you when I'll submit docs PR to rebar3.org repo.

MarkoMin avatar Mar 05 '24 19:03 MarkoMin