IEnumerable <ISymbol> GetRelatedSymbols(ISymbol entity) { var typeGraph = new Lazy <TypeGraph>(() => new TypeGraph(new [] { compilation.MainAssembly })); var symbolCollector = new SymbolCollector(); return(symbolCollector.GetRelatedSymbols(typeGraph, entity)); }
IList <AstNode> Rename(string fullyQualifiedName, string newName, bool includeOverloads) { var sym = GetSymbol(compilation, fullyQualifiedName); Assert.NotNull(sym); var graph = new TypeGraph(compilation.Assemblies); var col = new SymbolCollector(); col.IncludeOverloads = includeOverloads; col.GroupForRenaming = true; var scopes = findReferences.GetSearchScopes(col.GetRelatedSymbols(graph, sym)); List <AstNode> result = new List <AstNode>(); findReferences.RenameReferencesInFile( scopes, newName, new CSharpAstResolver(compilation, syntaxTree, unresolvedFile), delegate(RenameCallbackArguments obj) { result.Add(obj.NodeToReplace); }, delegate(Error obj) { }); return(result); }