File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
Features/VisualBasicTest/InvertIf
Workspaces/VisualBasic/Portable/CodeGeneration Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
1616
1717Namespace 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
You can’t perform that action at this time.
0 commit comments