-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add autocomplete for nested examples #15574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -246,7 +246,7 @@ _get_examples(){ | |
local manifest=$(_locate_manifest) | ||
[ -z "$manifest" ] && return 0 | ||
|
||
local files=("${manifest%/*}"/examples/*.rs) | ||
local files=("${manifest%/*}"/examples/**/*.rs) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could pick up both examples and submodules. Unsure whether that is worth it or not There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would be a little worried that the false-positive rate would be too high. In bevy for example, this would auto-complete a ton of names that aren't examples. I think the only real solution here is to parse Cargo.toml, and I think native-completions is the only way to realistically do that. This bashcomp could do some json parsing of |
||
local names=("${files[@]##*/}") | ||
local names=("${names[@]%.*}") | ||
# "*" means no examples found | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we do something similar for zsh?
cargo/src/etc/_cargo
Lines 472 to 477 in c2c636a