You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature Request: Allow for hiding individual aliases #1859
My current process for renaming aliases looks like the following:
Create a new symbol (lets take an Option for example) with the new aliases I want
Mark the previous symbol IsHidden=true
When executing a command, I am not forced to pull both values and determine which gets precedence despite this really only being a single thing. This also makes doing things like validation more difficult.
Alternatively, I could always modify the help build to hide to aliases that I don't want displayed. However, at present, this would require more code, than the above solution.
What I would like is the ability to mark individual aliases as hidden so that I only have a single symbol to manage.
An IdentifierSymbol.AddHiddenAlias(string) method would be discoverable enough for this. No need to complicate the constructors.
Should the hidden aliases be entirely hidden from completions, typo corrections, and help; or should they be available from completions if the user has already typed part of the hidden alias and there is no other completion? I think I'd prefer hiding them entirely.
The implementation might then have public IReadOnlyCollection<string> HiddenAliases { get; } and this would be used only in:
ArgumentConversionResult.FormatErrorMessage(Argument argument, Type expectedType, string value, LocalizationResources localizationResources)
Command.GetCompletions(CompletionContext context)
CommandResultExtensions.TryGetValueForOption(this CommandResult commandResult, IValueDescriptor valueDescriptor, out object? value) -- i.e. do not match the hidden aliases to IValueDescriptor.ValueName
Should the hidden aliases be entirely hidden from completions, typo corrections, and help; or should they be available from completions if the user has already typed part of the hidden alias and there is no other completion? I think I'd prefer hiding them entirely.
Agreed. So far, IsHidden means it is hidden everywhere.
Yes given #133 and the seemingly lack of support for considering any case insensitivity say --Start vs --start we add aliases but this clutters up help and tab completion significantly. If we can hide those options that would be great.
As dotnet/runtime#68578 is labelled "api-approved", it seems the API is about to be frozen. If hiding individual aliases is not supported in 2.0 GA, can it be implemented later? It will no longer be possible to remove public ICollection<string> Aliases { get; } from CliOption, but perhaps public ICollection<CliAlias> CliAliases { get; } could be added on the side as a more detailed view to the same collection. I just worry that the two properties could be deemed too confusing in API review and then we'd never get the feature.
Activity
KalleOlaviNiemitalo commentedon Sep 23, 2022
An IdentifierSymbol.AddHiddenAlias(string) method would be discoverable enough for this. No need to complicate the constructors.
Should the hidden aliases be entirely hidden from completions, typo corrections, and help; or should they be available from completions if the user has already typed part of the hidden alias and there is no other completion? I think I'd prefer hiding them entirely.
The implementation might then have
public IReadOnlyCollection<string> HiddenAliases { get; }and this would be used only in:but not in:
jonsequitur commentedon Sep 23, 2022
Agreed. So far,
IsHiddenmeans it is hidden everywhere.Keboo commentedon Sep 23, 2022
Yes I would expect them to be hidden everywhere.
mitchcapper commentedon Oct 21, 2022
Yes given #133 and the seemingly lack of support for considering any case insensitivity say --Start vs --start we add aliases but this clutters up help and tab completion significantly. If we can hide those options that would be great.
KalleOlaviNiemitalo commentedon Mar 31, 2023
As dotnet/runtime#68578 is labelled "api-approved", it seems the API is about to be frozen. If hiding individual aliases is not supported in 2.0 GA, can it be implemented later? It will no longer be possible to remove
public ICollection<string> Aliases { get; }from CliOption, but perhapspublic ICollection<CliAlias> CliAliases { get; }could be added on the side as a more detailed view to the same collection. I just worry that the two properties could be deemed too confusing in API review and then we'd never get the feature.