Skip to content
This repository was archived by the owner on Jul 12, 2022. It is now read-only.

Commit 1c36943

Browse files
committed
Fix an issue with usings
1 parent 385ea90 commit 1c36943

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Microsoft.DotNet.CodeFormatting/Rules/HasUsingsOutsideOfNamespaceFormattingRule.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ public async Task<Document> ProcessAsync(Document document, CancellationToken ca
3131
if (namespaceWithUsings == null)
3232
break;
3333

34+
// Moving a using with an alias out of a namespace is an operation which requires
35+
// semantic knowledge to get correct.
36+
if (namespaceWithUsings.Usings.Any(x => x.Alias != null))
37+
return document;
38+
3439
// Remove nested usings
3540

3641
var emptyUsingList = SyntaxFactory.List<UsingDirectiveSyntax>();

0 commit comments

Comments
 (0)