Conversation
48923d1 to
e4e8b92
Compare
| /// (e.g. StringComparer.InvariantCulture.Compare("\x0000 ZZZ \x0000"," ZZZ ")) returns 0). | ||
| /// This feature is not implement by this comparer. | ||
| /// </remarks> | ||
| internal sealed class SymbolStringComparer : IComparer<string> |
There was a problem hiding this comment.
It seems to be occurred when using "outputFormat": "mref" options.
When using apiPage or markdown options. It works as expected.
The apiPage output does not use a custom string comparer and seems to sort by name directly, does it work to sort by name also for mref output?
There was a problem hiding this comment.
ApiPage resolve names with SymbolFormatter.GetName(symbol, SyntaxLanguage.CSharp)
So name is represented as followings.
Class1
Class1.IRoutedView
Class1.IRoutedView<T>
Class1.IRoutedViewModel
Class1.IRoutedViewModelBase
So generics are sorted as expected when it's sorted by ordinal .
Because < char code is smaller than alphabet char.
On the other hand, when using Mref output format.
name is represented as followings.
BuildFromProject.Class1
BuildFromProject.Class1.IRoutedView
BuildFromProject.Class1.IRoutedViewModel
BuildFromProject.Class1.IRoutedViewModelBase
BuildFromProject.Class1.IRoutedView`1
So it requires SymbolStringComparer to get expected results.
I thought SymbolStringComparer should be also applied to ApiPage/Markdown output format.
eb07ed7 to
42e8d00
Compare
42e8d00 to
03bc8d6
Compare
03bc8d6 to
587eb47
Compare
587eb47 to
88bf305
Compare
a392dfb to
ba0d094
Compare
e8c5f0c to
ba0d094
Compare
Co-Authored-By: Yufei Huang <yufeih@live.com>
Co-authored-by: Yufei Huang <yufeih@live.com>
1df4866 to
3009d0f
Compare
This PR intended to fix issue #10332
Background
When using
Globalization Invariant Mode. string is sorted withordinalorders.And it will cause some order problems, which seems not to be natural orders.
What's changed in this PR
1. Add
SymbolStringComparer.csAdd custom StringComparer that sort ASCII chars.
It's similar to
StringComparer.InvariantCulture's order but have following differences.2. Modify
YamlViewModelExtensions.csModify toc /enum items sort logics to use custom
SymbolStringComparer.3. Add test class to that contains test for Issue10332
Confirmed generated web site symbols are ordered as expected.
And
enumSortOrder:alphabeticbehavior is confirmed by modifyingseed/docfx.jsonmanually.Additional apply formatter to
Class1.csfile content.4. Update snapshot files with
snapshot.yml