-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
Add helper in EnumSingleTypeConverter to get enum names-array #17785
base: master
Are you sure you want to change the base?
Conversation
Feels like random failures. Rerun? |
Just noticed that #17684 plan to replace this code. This PR can be closed if the other one is accepted. |
string enumString = LanguagePrimitives.EnumSingleTypeConverter.EnumValues(typeof(SwitchFlags)); | ||
string separator = CultureInfo.CurrentUICulture.TextInfo.ListSeparator; | ||
string[] enumArray = enumString.Split(separator, StringSplitOptions.RemoveEmptyEntries); | ||
string[] enumArray = LanguagePrimitives.EnumSingleTypeConverter.GetEnumNames(typeof(SwitchFlags)); |
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.
There is one more place where we can use the helper if I remember correctly.
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.
This is the one you mentioned, not covered by #17750 . I don't see other references besides log/exception-messages where they want this comma-separated string.
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.
Please fix both in the PR.
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.
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
PR Summary
Adds a helper in
EnumSingleTypeConverter
to get enum names-array.Updates switch statement completer to use the new helper instead of string joining + splitting.
PR Context
Related #17750 (comment)
There's another occurrence in
CompletionCompleters.cs
which is replaced as part of the PR above.PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.(which runs in a different PS Host).