Add cargo and rustc completion.#2409
Add cargo and rustc completion.#2409faho merged 1 commit intofish-shell:masterfrom bheesham:rustc-cargo-completion
Conversation
|
For the rustc completion: You can add descriptions to any completion option by separating the option and it's description with a tab character and the next option with a newline. I.e. something like this should give properly described options: printf "%s\t%s\n" box-pointers "some text that describes box-pointers" fat-ptr-transmutes "some description for fat-ptr-transmutes"(Note that I'm not a rust user, but to me some of these seem rather esoteric, so descriptions seem useful) |
|
Descriptions for flags have now been added. I ended up writing a Python script to help me out since I'm not entirely sure how to play with strings using Fish. |
|
Did you mean to commit and push that?
Can't say I'm a massive fan. Push it and I'll take a look. |
|
No I didn't since this was only for completions. The script is over here: https://github.com/bheesham/rust.fish/blob/master/gen.py |
Ah okay, it's for generating completion scripts. I thought you had written a helper that is called at runtime. This is kinda neat, but I'd still like it more if we could generate the completions on the user's machine since they then perfectly match the rust version (since that's apparently possible). What you basically do here is call I could also take a look, but I'll have to download rust first and my current internet connection won't allow for that, so I'll try to get to it over the weekend. |
|
Yep, that's exactly what the script does. Ah yeah. I saw the pull request for |
|
@bheesham: Any progress? |
|
Ah crap, nope. This completely escaped my mind for a bit. I'll pick this issue back up around Thursday. |
|
@faho , I'm now using the string commands. All I'm using the Python script for now is to not have to write I've been able to bring the filesize of |
|
How well does this perform? It does quite a lot of |
|
Not too well I think. The current version (run the I guess my next challenge is to find a way to generate completions without heavily relying on |
|
Cool. The time it takes to source is now significantly less than what it was before. It's around 88ms for me. Still not as fast as file Python generates, but hey, it's a major improvement. |
|
I did run into a strange problem though.
Output: Any ideas? I'm using |
Well, it looks like it just doesn't match on them, so it replaces nothing - the lines appear unchanged. |
That probably warrants the technical term "good enough" - unless you're running a monster rig. |
|
Okay, I tested it a bit and played a bit around, and while there's still plenty of micro-optimizations possible (e.g. the recurring The semantics of So unless you think there's anything missing, this seems about ready to merge. Okay? |
rustc.fish makes heavy use of the `string` commands.
|
Sounds like a plan. :-) Thanks for all the pointers! |
|
Merged, thanks! |
I've added completion for Rust and Cargo.