private static bool IsBetterFilterMatch(
                CompletionHelper helper, CompletionItem item1, CompletionItem item2,
                string filterText, CompletionTrigger trigger,
                CompletionFilterReason filterReason, ImmutableArray<string> recentItems)
            {
                // For the deletion we bake in the core logic for how betterness should work.
                // This way deletion feels the same across all languages that opt into deletion 
                // as a completion trigger.
                if (filterReason == CompletionFilterReason.BackspaceOrDelete)
                {
                    var prefixLength1 = item1.FilterText.GetCaseInsensitivePrefixLength(filterText);
                    var prefixLength2 = item2.FilterText.GetCaseInsensitivePrefixLength(filterText);

                    // Prefer the item that matches a longer prefix of the filter text.
                    if (prefixLength1 > prefixLength2)
                    {
                        return true;
                    }

                    // If the lengths are the same, prefer the one with the higher match priority.
                    // But only if it's an item that would have been hard selected.  We don't want
                    // to aggressively select an item that was only going to be softly offered.
                    var item1Priority = item1.Rules.SelectionBehavior == CompletionItemSelectionBehavior.HardSelection
                        ? item1.Rules.MatchPriority : MatchPriority.Default;
                    var item2Priority = item2.Rules.SelectionBehavior == CompletionItemSelectionBehavior.HardSelection
                        ? item2.Rules.MatchPriority : MatchPriority.Default;

                    if (item1Priority > item2Priority)
                    {
                        return true;
                    }

                    return false;
                }

                return helper.IsBetterFilterMatch(item1, item2, filterText, trigger, recentItems);
            }