From 3b88bee2b94c862d981a2e34155bdd042be97c74 Mon Sep 17 00:00:00 2001 From: Bela VanderVoort Date: Fri, 27 Dec 2024 20:12:33 -0600 Subject: [PATCH] Fixing issue with losing unsafe keyword on using statement (#1417) closes #1416 --- .../FormattingTests/TestFiles/cs/UsingDirectives.test | 1 + Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/UsingDirective.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives.test index d52e6a398..d4d1cb708 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives.test @@ -3,6 +3,7 @@ using A; // trailing // leading with space using // another trailing B; +using unsafe NvapiQueryInterface = delegate* unmanaged[Cdecl]; namespace Namespace { diff --git a/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/UsingDirective.cs b/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/UsingDirective.cs index 041c86f77..89f193c0d 100644 --- a/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/UsingDirective.cs +++ b/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/UsingDirective.cs @@ -12,6 +12,7 @@ public static Doc Print( printExtraLines ? ExtraNewLines.Print(node) : Doc.Null, Token.PrintWithSuffix(node.GlobalKeyword, " ", context, skipLeadingTrivia: true), Token.PrintWithSuffix(node.UsingKeyword, " ", context, skipLeadingTrivia: true), + Token.PrintWithSuffix(node.UnsafeKeyword, " ", context, skipLeadingTrivia: true), Token.PrintWithSuffix(node.StaticKeyword, " ", context, skipLeadingTrivia: true), node.Alias == null ? Doc.Null : NameEquals.Print(node.Alias, context), Node.Print(node.NamespaceOrType, context),