AvalonEdit - Searching Completion Data
-
22-06-2021 - |
Question
I've wired up the CompletionData no problem, inserting etc into the Avalon Edit control.
The challenge is the searching algorithm.
In the example below, I want new-obj to "match" *New-Object**** in the list and not do a partial find on ***New-DataObject*.
Is there a flag I can set? Or do I need to override the search and implement my own?
Thank you
Doug
Solution
Unfortunately this behavior is currently not customizable. It's hard-coded in the private method CompletionList.GetMatchQuality
.
That said, I cannot reproduce your problem. The AvalonEdit matching logic doesn't work like your screenshot seems to suggest. AvalonEdit supports 8 types of matches (with the higher ones having priority over the others):
// 8 = full match case sensitive
// 7 = full match
// 6 = match start case sensitive
// 5 = match start
// 4 = match CamelCase when length of query is 1 or 2 characters
// 3 = match substring case sensitive
// 2 = match substring
// 1 = match CamelCase
"new-obj" is a type 5 match for "New-Object", and no match at all for "New-DataObject".
The completion window is displayed suspiciously far to the right of the word start. I think only "obj" is in your completion segment. You'll have to check your code that finds the word start and sets CompletionWindow.StartOffset
, I suspect it is considering the dash to be a word border.