private IEnumerable <KeyValuePair <string, IList <DeclaredElementInstance <IMethod> > > > GetTaskMethods(ISymbolScope symbolScope) { var map = new OneToListMap <string, DeclaredElementInstance <IMethod> >(); foreach (var shortName in symbolScope.GetAllShortNames()) { if (!shortName.EndsWith("Tasks")) { continue; } var symbols = symbolScope.GetElementsByShortName(shortName); foreach (var symbol in symbols) { if (!(symbol is IClass @class)) { continue; } if ([email protected]().QualifiedName.StartsWith("Nuke")) { continue; } foreach (var classMethod in @class.Methods .Where(x => x.AccessibilityDomain.DomainType == AccessibilityDomain.AccessibilityDomainType.PUBLIC && x.IsStatic)) { map.Add(classMethod.ShortName, new DeclaredElementInstance <IMethod>(classMethod)); } } } return(map); }
private static List <IClrDeclaredElement> FindType(ISolution solution, string typeToFind) { ISymbolScope declarationsCache = solution.GetPsiServices().Symbols .GetSymbolScope(LibrarySymbolScope.FULL, false); List <IClrDeclaredElement> results = declarationsCache.GetElementsByShortName(typeToFind).ToList(); return(results); }
private static List <IClrDeclaredElement> FindType(ISolution solution, string typeToFind) { ISymbolScope declarationsCache = solution.GetPsiServices().Symbols .GetSymbolScope(LibrarySymbolScope.FULL, context: UniversalModuleReferenceContext.Instance, caseSensitive: false); List <IClrDeclaredElement> results = declarationsCache.GetElementsByShortName(typeToFind).ToList(); return(results); }
public static List <IClrDeclaredElement> FindClass(ISolution solution, string classNameToFind, IList <IProject> restrictToTheseProjects) { ISymbolScope declarationsCache = solution.GetPsiServices().Symbols .GetSymbolScope(LibrarySymbolScope.FULL, false); //, currentProject.GetResolveContext()); List <IClrDeclaredElement> results = declarationsCache.GetElementsByShortName(classNameToFind).ToList(); RemoveElementsNotInProjects(results, restrictToTheseProjects); return(results); }