Specify string comparison mode on CompletionItemSortComparer

SyntaxEditor for WPF Forum

Posted 8 years ago by Boleslaw
Avatar

Hello,

We just noticed that the default CompletionItemSortComparer comparer used by CompletionSession.SortItems appears to use orindal string sorting. We would like to switch to non-ordinal (ex. current culture) sorting so that characters such as "é" are sorted properly together with character "e", instead of being placed at the end just because of their numerical value used by ordinal sorting. I can easily use CompletionSession.SortItems with a custom comparer to achieve this, but I am wondering if you could possibly add an optional way to configure CompletionItemSortComparer with a different string comparison mode (ex. StringComparison enum value or IComparer<string>). The only reason I would ask for that is that so we do not have to figure out and duplicate any logic that your comparer has based on the completion session (since the comparer takes an argument of ICompletionSession), since the only thing we want to change is the actual string sort. Once the comparer would be configurable, we could just pass it in to SortItems instead of using the default behavior.

Thank you.

[Modified 8 years ago]

Comments (2)

Answer - Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Thanks for letting us know.  Since the completion items are display oriented, it should be using current culture instead of ordinal sorting.  We will update this for the next maintenance release.


Actipro Software Support

Posted 8 years ago by Boleslaw
Avatar

Great, that is even better because we won't have to make any changes to get the desired behavior. Thank you!

The latest build of this product (v24.1.3) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.