Repository navigation
Lazy subcommand registration - #2895
Closed
adamsitnik wants to merge 3 commits into
Closed
adamsitnik wants to merge 3 commits into
adamsitnik wants to merge 3 commits into
Conversation
Command.Subcommands is now a public CommandList that supports registering subcommands lazily. The parser creates only the subcommands that were matched. Co-authored-by: Copilot <[email protected]> Copilot-Session: 89664327-8eb4-43a6-8c7d-a21cc4d78084
Co-authored-by: Copilot <[email protected]> Copilot-Session: 89664327-8eb4-43a6-8c7d-a21cc4d78084
Co-authored-by: Copilot <[email protected]> Copilot-Session: 89664327-8eb4-43a6-8c7d-a21cc4d78084
Member
Author
|
Closing in favor of #2901 |
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.
Contributes to #2894, based on the idea from #2894 (comment).
Command.Subcommandsnow returns a new publicCommandListtype (still implementsIList<Command>) that allows registering subcommands lazily:The parser registers only the names and aliases of lazy subcommands and creates just the subcommands that were actually matched, so unused parts of a large symbol tree are never allocated. Public members of the list (indexer, enumeration etc.) create lazy subcommands on demand, so existing code (help, completions) keeps working.
Options and arguments are unchanged.
Benchmarks
Perf_LazySubcommandscreates the same symbol tree using eager (Subcommands.Add) and lazy (Subcommands.AddLazy) registration, and optionally parses it.