List <IUnresolvedTypeDefinition> SearchClasses(string text) { List <IUnresolvedTypeDefinition> list = new List <IUnresolvedTypeDefinition>(); if (ProjectService.OpenSolution != null) { foreach (IProject project in ProjectService.OpenSolution.Projects) { IProjectContent projectContent = project.ProjectContent; if (projectContent != null) { foreach (IUnresolvedTypeDefinition c in projectContent.GetAllTypeDefinitions()) { string className = c.Name; if (className.Length >= text.Length) { if (GotoUtils.AutoCompleteWithCamelHumpsMatch(className, text)) { list.Add(c); } } } } } } return(list); }
static int GetMatchType(string searchText, string itemText) { if (itemText.Length < searchText.Length) { return(MatchType_NoMatch); } int indexInsensitive = itemText.IndexOf(searchText, StringComparison.OrdinalIgnoreCase); if (indexInsensitive < 0) { if (GotoUtils.AutoCompleteWithCamelHumpsMatch(itemText, searchText)) { return(MatchType_ContainsMatch_CaseInsensitive); } return(MatchType_NoMatch); } // This is a case insensitive match int indexSensitive = itemText.IndexOf(searchText, StringComparison.Ordinal); if (itemText.Length == searchText.Length) { // this is a full match if (indexSensitive == 0) { return(MatchType_FullMatch); } else { return(MatchType_FullMatch_CaseInsensitive); } } else if (indexInsensitive == 0) { // This is a starting match if (indexSensitive == 0) { return(MatchType_StartingMatch); } else { return(MatchType_StartingMatch_CaseInsensitive); } } else { if (indexSensitive >= 0) { return(MatchType_ContainsMatch); } else { return(MatchType_ContainsMatch_CaseInsensitive); } } }