C# Class ICSharpCode.NRefactory.CSharp.Resolver.FindReferences

'Find references' implementation.
This class is thread-safe. The intended multi-threaded usage is to call GetSearchScopes() once, and then call FindReferencesInFile() concurrently on multiple threads (parallel foreach over all interesting files).
Show file Open project: 0xd4d/NRefactory Class Usage Examples

Public Methods

Method Description
FindLocalReferences ( IVariable variable, CSharpUnresolvedFile unresolvedFile, SyntaxTree syntaxTree, ICompilation compilation, FoundReferenceCallback callback, CancellationToken cancellationToken ) : void

Finds all references of a given variable.

FindReferencesInFile ( IFindReferenceSearchScope searchScope, ICSharpCode.NRefactory.CSharp.Resolver.CSharpAstResolver resolver, FoundReferenceCallback callback, CancellationToken cancellationToken ) : void

Finds all references in the given file.

FindReferencesInFile ( IFindReferenceSearchScope searchScope, CSharpUnresolvedFile unresolvedFile, SyntaxTree syntaxTree, ICompilation compilation, FoundReferenceCallback callback, CancellationToken cancellationToken ) : void

Finds all references in the given file.

FindReferencesInFile ( IList searchScopes, ICSharpCode.NRefactory.CSharp.Resolver.CSharpAstResolver resolver, FoundReferenceCallback callback, CancellationToken cancellationToken ) : void

Finds all references in the given file.

FindReferencesInFile ( IList searchScopes, CSharpUnresolvedFile unresolvedFile, SyntaxTree syntaxTree, ICompilation compilation, FoundReferenceCallback callback, CancellationToken cancellationToken ) : void

Finds all references in the given file.

GetEffectiveAccessibility ( IEntity entity ) : Accessibility

Gets the effective accessibility of the specified entity - that is, the accessibility viewed from the top level.

internal member in public class -> internal public member in internal class -> internal protected member in public class -> protected protected member in internal class -> protected and internal

GetInterestingFiles ( IFindReferenceSearchScope searchScope, ICompilation compilation ) : IEnumerable

Gets the file names that possibly contain references to the element being searched for.

GetNodeToReplace ( AstNode node ) : AstNode
GetSearchScopes ( IEnumerable symbols ) : IList
GetSearchScopes ( ISymbol symbol ) : IList
RenameReferencesInFile ( IList searchScopes, string newName, ICSharpCode.NRefactory.CSharp.Resolver.CSharpAstResolver resolver, Action callback, Action errorCallback, CancellationToken cancellationToken = default(CancellationToken) ) : void

Private Methods

Method Description
FindAwaiterIsCompletedReferences ( IProperty property ) : SearchScope
FindBinaryOperator ( IMethod op, BinaryOperatorType operatorType ) : SearchScope
FindChainedConstructorReferences ( IMethod ctor ) : SearchScope
FindEnumeratorCurrentReferences ( IProperty property ) : SearchScope
FindIndexerReferences ( IProperty indexer ) : SearchScope
FindMemberReferences ( IEntity member, FindMemberReferencesNavigator>.Func factory ) : SearchScope
FindObjectCreateReferences ( IMethod ctor ) : SearchScope
FindOperator ( IMethod op, FindReferenceNavigator>.Func factory ) : SearchScope
FindTypeDefinitionReferences ( ITypeDefinition typeDefinition, bool findTypeReferencesEvenIfAliased, SearchScope &additionalScope ) : SearchScope
FindTypeDefinitionReferences ( ITypeDefinition typeDefinition, string searchTerm ) : SearchScope
FindTypeParameterReferences ( IType typeParameter, CSharpUnresolvedFile unresolvedFile, SyntaxTree syntaxTree, ICompilation compilation, FoundReferenceCallback callback, CancellationToken cancellationToken ) : void
FindUnaryOperator ( IMethod op, UnaryOperatorType operatorType ) : SearchScope
GetInterestingFilesProtected ( ITypeDefinition referencedTypeDefinition ) : IEnumerable
GetSearchScopeForDestructor ( IMethod dtor ) : SearchScope
GetSearchScopeForLocalVariable ( IVariable variable ) : SearchScope
GetSearchScopeForMethod ( IMethod method ) : SearchScope
GetSearchScopeForNamespace ( INamespace ns ) : SearchScope
GetSearchScopeForOperator ( IMethod op ) : SearchScope
GetSearchScopeForParameter ( IParameter parameter ) : SearchScope
GetSearchScopeForTypeParameter ( ITypeParameter tp ) : SearchScope
GetTopLevelTypeDefinition ( IEntity entity ) : ITypeDefinition
IsMemberMatch ( IMember member, IMember referencedMember, bool isVirtualCall ) : bool
MergeAccessibility ( Accessibility outer, Accessibility inner ) : Accessibility
NormalizeMember ( IMember member ) : IMember

Method Details

FindLocalReferences() public method

Finds all references of a given variable.
public FindLocalReferences ( IVariable variable, CSharpUnresolvedFile unresolvedFile, SyntaxTree syntaxTree, ICompilation compilation, FoundReferenceCallback callback, CancellationToken cancellationToken ) : void
variable IVariable The variable for which to look.
unresolvedFile CSharpUnresolvedFile The type system representation of the file being searched.
syntaxTree SyntaxTree The syntax tree of the file being searched.
compilation ICompilation The compilation.
callback FoundReferenceCallback Callback used to report the references that were found.
cancellationToken System.Threading.CancellationToken Cancellation token that may be used to cancel the operation.
return void

FindReferencesInFile() public method

Finds all references in the given file.
public FindReferencesInFile ( IFindReferenceSearchScope searchScope, ICSharpCode.NRefactory.CSharp.Resolver.CSharpAstResolver resolver, FoundReferenceCallback callback, CancellationToken cancellationToken ) : void
searchScope IFindReferenceSearchScope The search scope for which to look.
resolver ICSharpCode.NRefactory.CSharp.Resolver.CSharpAstResolver AST resolver for the file to search in.
callback FoundReferenceCallback Callback used to report the references that were found.
cancellationToken System.Threading.CancellationToken CancellationToken that may be used to cancel the operation.
return void

FindReferencesInFile() public method

Finds all references in the given file.
public FindReferencesInFile ( IFindReferenceSearchScope searchScope, CSharpUnresolvedFile unresolvedFile, SyntaxTree syntaxTree, ICompilation compilation, FoundReferenceCallback callback, CancellationToken cancellationToken ) : void
searchScope IFindReferenceSearchScope The search scope for which to look.
unresolvedFile CSharpUnresolvedFile The type system representation of the file being searched.
syntaxTree SyntaxTree The syntax tree of the file being searched.
compilation ICompilation The compilation for the project that contains the file.
callback FoundReferenceCallback Callback used to report the references that were found.
cancellationToken System.Threading.CancellationToken CancellationToken that may be used to cancel the operation.
return void

FindReferencesInFile() public method

Finds all references in the given file.
public FindReferencesInFile ( IList searchScopes, ICSharpCode.NRefactory.CSharp.Resolver.CSharpAstResolver resolver, FoundReferenceCallback callback, CancellationToken cancellationToken ) : void
searchScopes IList The search scopes for which to look.
resolver ICSharpCode.NRefactory.CSharp.Resolver.CSharpAstResolver AST resolver for the file to search in.
callback FoundReferenceCallback Callback used to report the references that were found.
cancellationToken System.Threading.CancellationToken CancellationToken that may be used to cancel the operation.
return void

FindReferencesInFile() public method

Finds all references in the given file.
public FindReferencesInFile ( IList searchScopes, CSharpUnresolvedFile unresolvedFile, SyntaxTree syntaxTree, ICompilation compilation, FoundReferenceCallback callback, CancellationToken cancellationToken ) : void
searchScopes IList The search scopes for which to look.
unresolvedFile CSharpUnresolvedFile The type system representation of the file being searched.
syntaxTree SyntaxTree The syntax tree of the file being searched.
compilation ICompilation The compilation for the project that contains the file.
callback FoundReferenceCallback Callback used to report the references that were found.
cancellationToken System.Threading.CancellationToken CancellationToken that may be used to cancel the operation.
return void

GetEffectiveAccessibility() public static method

Gets the effective accessibility of the specified entity - that is, the accessibility viewed from the top level.
internal member in public class -> internal public member in internal class -> internal protected member in public class -> protected protected member in internal class -> protected and internal
public static GetEffectiveAccessibility ( IEntity entity ) : Accessibility
entity IEntity
return Accessibility

GetInterestingFiles() public method

Gets the file names that possibly contain references to the element being searched for.
public GetInterestingFiles ( IFindReferenceSearchScope searchScope, ICompilation compilation ) : IEnumerable
searchScope IFindReferenceSearchScope
compilation ICompilation
return IEnumerable

GetNodeToReplace() public static method

public static GetNodeToReplace ( AstNode node ) : AstNode
node AstNode
return AstNode

GetSearchScopes() public method

public GetSearchScopes ( IEnumerable symbols ) : IList
symbols IEnumerable
return IList

GetSearchScopes() public method

public GetSearchScopes ( ISymbol symbol ) : IList
symbol ISymbol
return IList

RenameReferencesInFile() public method

public RenameReferencesInFile ( IList searchScopes, string newName, ICSharpCode.NRefactory.CSharp.Resolver.CSharpAstResolver resolver, Action callback, Action errorCallback, CancellationToken cancellationToken = default(CancellationToken) ) : void
searchScopes IList
newName string
resolver ICSharpCode.NRefactory.CSharp.Resolver.CSharpAstResolver
callback Action
errorCallback Action
cancellationToken System.Threading.CancellationToken
return void