Skip to content

Commit

Permalink
Filter on display name as well as value
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkMpn committed Aug 7, 2021
1 parent 9305e50 commit e441cf0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions MarkMpn.XmlSchemaAutoComplete/Autocomplete.cs
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ public AutocompleteSuggestion[] GetSuggestions(string text, out int length)
}

return suggestions
.Where(a => a.Value.StartsWith(element.Attributes[element.CurrentAttribute] ?? ""))
.Where(a => a.Value.StartsWith(element.Attributes[element.CurrentAttribute] ?? "") || a.DisplayName != null && a.DisplayName.StartsWith(element.Attributes[element.CurrentAttribute] ?? ""))
.ToArray<AutocompleteSuggestion>();
}
else if (parser.State == ReaderState.InText)
Expand Down Expand Up @@ -645,7 +645,9 @@ private AutocompleteSuggestion[] CompleteTextNode(Stack<ElementState> elements,
}

AutocompleteValue(this, new AutocompleteValueEventArgs(suggestions, currentElement.Element, schemaTypes, schemaElements));
return suggestions.ToArray<AutocompleteSuggestion>();
return suggestions
.Where(a => a.Value.StartsWith(text) || a.DisplayName != null && a.DisplayName.StartsWith(text))
.ToArray<AutocompleteSuggestion>();
}

return Array.Empty<AutocompleteSuggestion>();
Expand Down

0 comments on commit e441cf0

Please sign in to comment.