fix(commands): apply injection autocompleters to nested injections - #1578
Open
Sanjays2402 wants to merge 1 commit into
Open
fix(commands): apply injection autocompleters to nested injections#1578Sanjays2402 wants to merge 1 commit into
Sanjays2402 wants to merge 1 commit into
Conversation
Injection.autocomplete() registrations were only applied to injections directly attached to a command's callback. collect_nested_params() recursed into nested injections but never looked at their autocompleters, so an option belonging to an injection nested inside another injection was registered with "autocomplete": false and never autocompleted. The lookup/assign logic is extracted into apply_injection_autocompleters() and now also runs for each nested injection, so nested options behave the same as top-level ones (including the unknown-option ValueError). Closes DisnakeDev#982
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #982.
Injection.autocomplete()registrations were only applied to injections attacheddirectly to a command's callback.
collect_nested_params()recurses into nestedinjections but never looked at their
autocompleters, so an option belonging to aninjection nested inside another injection was registered with
"autocomplete": false.With the issue's example, only
cautocompleted;adid not.The lookup/assign logic is extracted into
apply_injection_autocompleters()and nowalso runs per nested injection, so nested options behave like top-level ones
(including the unknown-option
ValueError).Checklist
uv run nox -s lintuv run nox -s pyright