提交 c35c3e7c 编写于 作者: A Alireza Habibi

Add VB support.

上级 35e2459f
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports Microsoft.CodeAnalysis.Structure
Imports Microsoft.CodeAnalysis.VisualBasic.Structure
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Outlining
Public Class InterpolatedStringExpressionStructureTests
Inherits AbstractVisualBasicSyntaxNodeStructureProviderTests(Of InterpolatedStringExpressionSyntax)
Friend Overrides Function CreateProvider() As AbstractSyntaxStructureProvider
Return New InterpolatedStringExpressionStructureProvider()
End Function
<Fact, Trait(Traits.Feature, Traits.Features.Outlining)>
Public Async Function TestMultiLineStringLiteral() As Task
Const code = "
Class C
Sub M()
Dim v =
{|hint:{|textspan:$$$""
{123}
""|}|}
End Sub
End Class
"
Await VerifyBlockSpansAsync(code,
Region("textspan", "hint", "...", autoCollapse:=True))
End Function
<Fact, Trait(Traits.Feature, Traits.Features.Outlining)>
Public Async Function TestMissingOnIncompleteStringLiteral() As Task
Const code = "
Class C
Sub M()
Dim v =
$$$""
End Sub
End Class
"
Await VerifyNoBlockSpansAsync(code)
End Function
End Class
End Namespace
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Threading
Imports Microsoft.CodeAnalysis.Options
Imports Microsoft.CodeAnalysis.PooledObjects
Imports Microsoft.CodeAnalysis.Structure
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.Structure
Friend Class InterpolatedStringExpressionStructureProvider
Inherits AbstractSyntaxNodeStructureProvider(Of InterpolatedStringExpressionSyntax)
Protected Overrides Sub CollectBlockSpans(node As InterpolatedStringExpressionSyntax, spans As ArrayBuilder(Of BlockSpan), options As OptionSet, cancellationToken As CancellationToken)
If node.DollarSignDoubleQuoteToken.IsMissing OrElse
node.DoubleQuoteToken.IsMissing Then
Return
End If
spans.Add(New BlockSpan(
type:=BlockTypes.Expression,
isCollapsible:=True,
textSpan:=node.Span,
autoCollapse:=True,
isDefaultCollapsed:=False))
End Sub
End Class
End Namespace
......@@ -80,6 +80,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Structure
builder.Add(Of XmlElementSyntax, XmlExpressionStructureProvider)()
builder.Add(Of XmlProcessingInstructionSyntax, XmlExpressionStructureProvider)()
builder.Add(Of LiteralExpressionSyntax, StringLiteralExpressionStructureProvider)()
builder.Add(Of InterpolatedStringExpressionSyntax, InterpolatedStringExpressionStructureProvider)()
Return builder.ToImmutable()
End Function
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册