Skip to content

Commit cc2a1c3

Browse files
Fix VB formatting
1 parent 4950029 commit cc2a1c3

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/Features/VisualBasicTest/InvertIf/InvertIfDirectiveTests.vb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.InvertIf
162162
end interface
163163
#end if
164164
", "
165-
#if (false)
165+
#if (False)
166166
interface I
167167

168168
end interface
@@ -185,7 +185,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.InvertIf
185185
end interface
186186
#end if
187187
", "
188-
#if (false)
188+
#if (False)
189189
interface I
190190

191191
end interface

src/Workspaces/VisualBasic/Portable/CodeGeneration/VisualBasicSyntaxGenerator.vb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
1616

1717
Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
1818
<ExportLanguageService(GetType(SyntaxGenerator), LanguageNames.VisualBasic), [Shared]>
19-
Friend Class VisualBasicSyntaxGenerator
19+
Friend NotInheritable Class VisualBasicSyntaxGenerator
2020
Inherits SyntaxGenerator
2121

2222
Public Shared ReadOnly Instance As SyntaxGenerator = New VisualBasicSyntaxGenerator()
@@ -248,7 +248,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
248248
End Function
249249

250250
Public Overrides Function LogicalNotExpression(expression As SyntaxNode) As SyntaxNode
251-
Return SyntaxFactory.NotExpression(ParenthesizeNonSimple(expression))
251+
' This helper is used in some locations where the formatter is not available. So try to ensure
252+
' that we generate proper code with a space between the 'Not' and the expression when necessary.
253+
Return SyntaxFactory.NotExpression(
254+
SyntaxFactory.Token(SyntaxKind.NotKeyword).WithTrailingTrivia(SyntaxFactory.ElasticSpace),
255+
ParenthesizeNonSimple(expression))
252256
End Function
253257

254258
Public Overrides Function LogicalOrExpression(left As SyntaxNode, right As SyntaxNode) As SyntaxNode

0 commit comments

Comments
 (0)