Skip to content
Permalink
Browse files

Ancsestor -> Ancestor

  • Loading branch information...
github-jane-doe committed Oct 13, 2019
1 parent b4a63c4 commit 5373cb26ad442ec3f44c40ea237ddf00d2a398c8
Showing with 3 additions and 3 deletions.
  1. +3 −3 ILSpy.AddIn/SyntaxNodeExtensions.cs
@@ -404,15 +404,15 @@ public static bool IsInStaticContext(this SyntaxNode node)

public static NamespaceDeclarationSyntax GetInnermostNamespaceDeclarationWithUsings(this SyntaxNode contextNode)
{
var usingDirectiveAncsestor = contextNode.GetAncestor<UsingDirectiveSyntax>();
if (usingDirectiveAncsestor == null)
var usingDirectiveAncestor = contextNode.GetAncestor<UsingDirectiveSyntax>();
if (usingDirectiveAncestor == null)
{
return contextNode.GetAncestorsOrThis<NamespaceDeclarationSyntax>().FirstOrDefault(n => n.Usings.Count > 0);
}
else
{
// We are inside a using directive. In this case, we should find and return the first 'parent' namespace with usings.
var containingNamespace = usingDirectiveAncsestor.GetAncestor<NamespaceDeclarationSyntax>();
var containingNamespace = usingDirectiveAncestor.GetAncestor<NamespaceDeclarationSyntax>();
if (containingNamespace == null)
{
// We are inside a top level using directive (i.e. one that's directly in the compilation unit).

0 comments on commit 5373cb2

Please sign in to comment.
You can’t perform that action at this time.