|
|
|
|
@ -41,7 +41,9 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring
@@ -41,7 +41,9 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring
|
|
|
|
|
Description = "Removes used declarations that are not required.", |
|
|
|
|
Category = IssueCategories.Redundancies, |
|
|
|
|
Severity = Severity.Hint, |
|
|
|
|
IssueMarker = IssueMarker.GrayOut)] |
|
|
|
|
IssueMarker = IssueMarker.GrayOut, |
|
|
|
|
ResharperDisableKeyword = "RedundantUsingDirective" |
|
|
|
|
)] |
|
|
|
|
public class RedundantUsingIssue : ICodeIssueProvider |
|
|
|
|
{ |
|
|
|
|
List<string> namespacesToKeep = new List<string>(); |
|
|
|
|
@ -87,6 +89,8 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring
@@ -87,6 +89,8 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring
|
|
|
|
|
public override void VisitUsingDeclaration(UsingDeclaration usingDeclaration) |
|
|
|
|
{ |
|
|
|
|
base.VisitUsingDeclaration(usingDeclaration); |
|
|
|
|
if (IsSuppressed(usingDeclaration.StartLocation)) |
|
|
|
|
return; |
|
|
|
|
var nrr = ctx.Resolve(usingDeclaration.Import) as NamespaceResolveResult; |
|
|
|
|
if (nrr != null) { |
|
|
|
|
isInUse[usingDeclaration] = IssueProvider.namespacesToKeep.Contains(nrr.NamespaceName); |
|
|
|
|
|