Skip to content

Commit

Permalink
Fix refactoring AddUsingDirective (RR0013)
Browse files Browse the repository at this point in the history
  • Loading branch information
josefpihrt committed Jan 26, 2022
1 parent b6baf37 commit 199787b
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Josef Pihrt and Contributors. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
Expand Down Expand Up @@ -43,7 +44,7 @@ public static async Task ComputeRefactoringsAsync(RefactoringContext context, Id
node = prevNode;

if (node.IsParentKind(SyntaxKind.QualifiedName, SyntaxKind.AliasQualifiedName, SyntaxKind.SimpleMemberAccessExpression)
&& !node.IsDescendantOf(SyntaxKind.UsingDirective)
&& !node.Ancestors(ascendOutOfTrivia: true).Any(f => f.IsKind(SyntaxKind.UsingDirective, SyntaxKind.FileScopedNamespaceDeclaration))
&& !CSharpUtility.IsNamespaceInScope(node, namespaceSymbol, semanticModel, context.CancellationToken))
{
context.RegisterRefactoring(
Expand Down

0 comments on commit 199787b

Please sign in to comment.