diff --git a/src/VisualStudio.Roslyn.SDK/SyntaxVisualizer/Roslyn.SyntaxVisualizer.DgmlHelper/ObjectInfoHelper.vb b/src/VisualStudio.Roslyn.SDK/SyntaxVisualizer/Roslyn.SyntaxVisualizer.DgmlHelper/ObjectInfoHelper.vb
index 1e05f5166..699994484 100644
--- a/src/VisualStudio.Roslyn.SDK/SyntaxVisualizer/Roslyn.SyntaxVisualizer.DgmlHelper/ObjectInfoHelper.vb
+++ b/src/VisualStudio.Roslyn.SDK/SyntaxVisualizer/Roslyn.SyntaxVisualizer.DgmlHelper/ObjectInfoHelper.vb
@@ -1,162 +1,164 @@
-' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+' 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
Imports System.Collections.Generic
Imports System.Linq
Imports Microsoft.CodeAnalysis
-Friend Module ObjectInfoHelper
- 'Helpers that use Reflection to return details pertaining to an object including
- 'its type + the types, names and values of properties on this object.
+Namespace Roslyn.SyntaxVisualizer.DgmlHelper
+ Friend Module ObjectInfoHelper
+ 'Helpers that use Reflection to return details pertaining to an object including
+ 'its type + the types, names and values of properties on this object.
#Region "GetObjectInfo"
- Friend Function GetObjectInfo(nodeOrToken As SyntaxNodeOrToken) As ObjectInfo
- Dim info As ObjectInfo = Nothing
+ Friend Function GetObjectInfo(nodeOrToken As SyntaxNodeOrToken) As ObjectInfo
+ Dim info As ObjectInfo = Nothing
- If nodeOrToken.IsNode Then
- info = GetObjectInfo(nodeOrToken.AsNode)
- Else
- info = GetObjectInfo(nodeOrToken.AsToken)
- End If
+ If nodeOrToken.IsNode Then
+ info = GetObjectInfo(nodeOrToken.AsNode)
+ Else
+ info = GetObjectInfo(nodeOrToken.AsToken)
+ End If
- Return info
- End Function
+ Return info
+ End Function
- Friend Function GetObjectInfo(node As SyntaxNode) As ObjectInfo
- Dim type = node.GetType()
+ Friend Function GetObjectInfo(node As SyntaxNode) As ObjectInfo
+ Dim type = node.GetType()
- Dim properties = type.GetProperties(System.Reflection.BindingFlags.Instance Or
+ Dim properties = type.GetProperties(System.Reflection.BindingFlags.Instance Or
System.Reflection.BindingFlags.Public)
- Dim propertyInfos = (From p In properties Where IsSimpleProperty(p)
- Select GetPropertyInfo(p, node)).ToList()
+ Dim propertyInfos = (From p In properties Where IsSimpleProperty(p)
+ Select GetPropertyInfo(p, node)).ToList()
- Return New ObjectInfo(type.Name, propertyInfos)
- End Function
+ Return New ObjectInfo(type.Name, propertyInfos)
+ End Function
- Friend Function GetObjectInfo(token As SyntaxToken) As ObjectInfo
- Dim type = token.GetType()
+ Friend Function GetObjectInfo(token As SyntaxToken) As ObjectInfo
+ Dim type = token.GetType()
- Dim properties = type.GetProperties(System.Reflection.BindingFlags.Instance Or
+ Dim properties = type.GetProperties(System.Reflection.BindingFlags.Instance Or
System.Reflection.BindingFlags.Public)
- Dim propertyInfos = (From p In properties Where IsSimpleProperty(p)
- Select GetPropertyInfo(p, token)).ToList()
+ Dim propertyInfos = (From p In properties Where IsSimpleProperty(p)
+ Select GetPropertyInfo(p, token)).ToList()
- Return New ObjectInfo(type.Name, propertyInfos)
- End Function
+ Return New ObjectInfo(type.Name, propertyInfos)
+ End Function
- Friend Function GetObjectInfo(trivia As SyntaxTrivia) As ObjectInfo
- Dim type = trivia.GetType()
+ Friend Function GetObjectInfo(trivia As SyntaxTrivia) As ObjectInfo
+ Dim type = trivia.GetType()
- Dim properties = type.GetProperties(System.Reflection.BindingFlags.Instance Or
+ Dim properties = type.GetProperties(System.Reflection.BindingFlags.Instance Or
System.Reflection.BindingFlags.Public)
- Dim propertyInfos = (From p In properties Where IsSimpleProperty(p)
- Select GetPropertyInfo(p, trivia)).ToList()
- Return New ObjectInfo(type.Name, propertyInfos)
- End Function
+ Dim propertyInfos = (From p In properties Where IsSimpleProperty(p)
+ Select GetPropertyInfo(p, trivia)).ToList()
+ Return New ObjectInfo(type.Name, propertyInfos)
+ End Function
#End Region
#Region "GetPropertyInfo"
- Private Function IsSimpleProperty(prop As System.Reflection.PropertyInfo) As Boolean
- Dim type = prop.PropertyType
- If type Is GetType(Char) OrElse
- type Is GetType(Boolean) OrElse
- type Is GetType(Short) OrElse
- type Is GetType(UShort) OrElse
- type Is GetType(Integer) OrElse
- type Is GetType(UInteger) OrElse
- type Is GetType(Long) OrElse
- type Is GetType(ULong) OrElse
- type Is GetType(Single) OrElse
- type Is GetType(Double) OrElse
- type Is GetType(Date) OrElse
- type Is GetType(Decimal) OrElse
- type Is GetType(String) OrElse
- type.IsEnum Then
- Return True
- Else
- Return False
- End If
- End Function
-
- 'Only called if IsSimpleProperty returns true.
- Private Function GetPropertyInfo(prop As System.Reflection.PropertyInfo,
- node As SyntaxNode) As ObjectInfo.PropertyInfo
- Return New ObjectInfo.PropertyInfo(prop.Name, prop.PropertyType,
- prop.GetValue(node, Nothing))
- End Function
-
- 'Only called if IsSimpleProperty returns true.
- Private Function GetPropertyInfo(prop As System.Reflection.PropertyInfo,
- token As SyntaxToken) As ObjectInfo.PropertyInfo
- Return New ObjectInfo.PropertyInfo(prop.Name, prop.PropertyType,
- prop.GetValue(token, Nothing))
- End Function
-
- 'Only called if IsSimpleProperty returns true.
- Private Function GetPropertyInfo(prop As System.Reflection.PropertyInfo,
- trivia As SyntaxTrivia) As ObjectInfo.PropertyInfo
- Return New ObjectInfo.PropertyInfo(prop.Name, prop.PropertyType,
- prop.GetValue(trivia, Nothing))
- End Function
-#End Region
-End Module
-
-'Encapsulates details pertaining to an object including its type + the types, names
-'and values of properties on this object.
-Friend Class ObjectInfo
- Private ReadOnly _typeName As String
- Private ReadOnly _propertyInfos As IEnumerable(Of PropertyInfo)
- Private Shared ReadOnly s_emptyPropertyInfos As IEnumerable(Of PropertyInfo) = Array.Empty(Of PropertyInfo)
-
- Friend ReadOnly Property TypeName As String
- Get
- Return _typeName
- End Get
- End Property
-
- Friend ReadOnly Property PropertyInfos As IEnumerable(Of PropertyInfo)
- Get
- If _propertyInfos Is Nothing Then
- Return s_emptyPropertyInfos
+ Private Function IsSimpleProperty(prop As System.Reflection.PropertyInfo) As Boolean
+ Dim type = prop.PropertyType
+ If type Is GetType(Char) OrElse
+ type Is GetType(Boolean) OrElse
+ type Is GetType(Short) OrElse
+ type Is GetType(UShort) OrElse
+ type Is GetType(Integer) OrElse
+ type Is GetType(UInteger) OrElse
+ type Is GetType(Long) OrElse
+ type Is GetType(ULong) OrElse
+ type Is GetType(Single) OrElse
+ type Is GetType(Double) OrElse
+ type Is GetType(Date) OrElse
+ type Is GetType(Decimal) OrElse
+ type Is GetType(String) OrElse
+ type.IsEnum Then
+ Return True
Else
- Return _propertyInfos
+ Return False
End If
- End Get
- End Property
-
- Friend Sub New(typeName As String, propertyInfos As IEnumerable(Of PropertyInfo))
- _typeName = typeName
- _propertyInfos = propertyInfos
- End Sub
-
- 'Encapsulates the name, type and value of a property on an object.
- Friend Class PropertyInfo
- Private ReadOnly _name As String
- Private ReadOnly _type As Type
- Private ReadOnly _value As Object
+ End Function
+
+ 'Only called if IsSimpleProperty returns true.
+ Private Function GetPropertyInfo(prop As System.Reflection.PropertyInfo,
+ node As SyntaxNode) As ObjectInfo.PropertyInfo
+ Return New ObjectInfo.PropertyInfo(prop.Name, prop.PropertyType,
+ prop.GetValue(node, Nothing))
+ End Function
+
+ 'Only called if IsSimpleProperty returns true.
+ Private Function GetPropertyInfo(prop As System.Reflection.PropertyInfo,
+ token As SyntaxToken) As ObjectInfo.PropertyInfo
+ Return New ObjectInfo.PropertyInfo(prop.Name, prop.PropertyType,
+ prop.GetValue(token, Nothing))
+ End Function
+
+ 'Only called if IsSimpleProperty returns true.
+ Private Function GetPropertyInfo(prop As System.Reflection.PropertyInfo,
+ trivia As SyntaxTrivia) As ObjectInfo.PropertyInfo
+ Return New ObjectInfo.PropertyInfo(prop.Name, prop.PropertyType,
+ prop.GetValue(trivia, Nothing))
+ End Function
+#End Region
+ End Module
- Friend ReadOnly Property Name As String
- Get
- Return _name
- End Get
- End Property
+ 'Encapsulates details pertaining to an object including its type + the types, names
+ 'and values of properties on this object.
+ Friend Class ObjectInfo
+ Private ReadOnly _typeName As String
+ Private ReadOnly _propertyInfos As IEnumerable(Of PropertyInfo)
+ Private Shared ReadOnly s_emptyPropertyInfos As IEnumerable(Of PropertyInfo) = Array.Empty(Of PropertyInfo)
- Friend ReadOnly Property Type As Type
+ Friend ReadOnly Property TypeName As String
Get
- Return _type
+ Return _typeName
End Get
End Property
- Friend ReadOnly Property Value As Object
+ Friend ReadOnly Property PropertyInfos As IEnumerable(Of PropertyInfo)
Get
- Return _value
+ If _propertyInfos Is Nothing Then
+ Return s_emptyPropertyInfos
+ Else
+ Return _propertyInfos
+ End If
End Get
End Property
- Friend Sub New(name As String, type As Type, value As Object)
- _name = name
- _type = type
- _value = value
+ Friend Sub New(typeName As String, propertyInfos As IEnumerable(Of PropertyInfo))
+ _typeName = typeName
+ _propertyInfos = propertyInfos
End Sub
+
+ 'Encapsulates the name, type and value of a property on an object.
+ Friend Class PropertyInfo
+ Private ReadOnly _name As String
+ Private ReadOnly _type As Type
+ Private ReadOnly _value As Object
+
+ Friend ReadOnly Property Name As String
+ Get
+ Return _name
+ End Get
+ End Property
+
+ Friend ReadOnly Property Type As Type
+ Get
+ Return _type
+ End Get
+ End Property
+
+ Friend ReadOnly Property Value As Object
+ Get
+ Return _value
+ End Get
+ End Property
+
+ Friend Sub New(name As String, type As Type, value As Object)
+ _name = name
+ _type = type
+ _value = value
+ End Sub
+ End Class
End Class
-End Class
+End Namespace
diff --git a/src/VisualStudio.Roslyn.SDK/SyntaxVisualizer/Roslyn.SyntaxVisualizer.DgmlHelper/Resources.Designer.vb b/src/VisualStudio.Roslyn.SDK/SyntaxVisualizer/Roslyn.SyntaxVisualizer.DgmlHelper/Resources.Designer.vb
index f97eb11be..683e765d1 100644
--- a/src/VisualStudio.Roslyn.SDK/SyntaxVisualizer/Roslyn.SyntaxVisualizer.DgmlHelper/Resources.Designer.vb
+++ b/src/VisualStudio.Roslyn.SDK/SyntaxVisualizer/Roslyn.SyntaxVisualizer.DgmlHelper/Resources.Designer.vb
@@ -13,7 +13,7 @@ Option Explicit On
Imports System
-Namespace My.Resources
+Namespace Roslyn.SyntaxVisualizer.DgmlHelper.My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
@@ -22,7 +22,7 @@ Namespace My.Resources
'''
''' A strongly-typed resource class, for looking up localized strings, etc.
'''
- _
Friend Class Resources
@@ -65,7 +65,7 @@ Namespace My.Resources
End Property
'''
- ''' Looks up a localized string similar to '{0}' Node.
+ ''' Looks up a localized string similar to {0} Node.
'''
Friend Shared ReadOnly Property SyntaxNodeLabel() As String
Get
diff --git a/src/VisualStudio.Roslyn.SDK/SyntaxVisualizer/Roslyn.SyntaxVisualizer.DgmlHelper/Roslyn.SyntaxVisualizer.DgmlHelper.vbproj b/src/VisualStudio.Roslyn.SDK/SyntaxVisualizer/Roslyn.SyntaxVisualizer.DgmlHelper/Roslyn.SyntaxVisualizer.DgmlHelper.vbproj
index f2e39cfcf..ea068593c 100644
--- a/src/VisualStudio.Roslyn.SDK/SyntaxVisualizer/Roslyn.SyntaxVisualizer.DgmlHelper/Roslyn.SyntaxVisualizer.DgmlHelper.vbproj
+++ b/src/VisualStudio.Roslyn.SDK/SyntaxVisualizer/Roslyn.SyntaxVisualizer.DgmlHelper/Roslyn.SyntaxVisualizer.DgmlHelper.vbproj
@@ -2,6 +2,7 @@
net472false
+
@@ -21,7 +22,7 @@
Designer
- My.Resources
+ Roslyn.SyntaxVisualizer.DgmlHelper.My.ResourcesResXFileCodeGeneratorResources.Designer.vb
diff --git a/src/VisualStudio.Roslyn.SDK/SyntaxVisualizer/Roslyn.SyntaxVisualizer.DgmlHelper/SyntaxDgmlHelper.vb b/src/VisualStudio.Roslyn.SDK/SyntaxVisualizer/Roslyn.SyntaxVisualizer.DgmlHelper/SyntaxDgmlHelper.vb
index 95de3183d..8940c50c1 100644
--- a/src/VisualStudio.Roslyn.SDK/SyntaxVisualizer/Roslyn.SyntaxVisualizer.DgmlHelper/SyntaxDgmlHelper.vb
+++ b/src/VisualStudio.Roslyn.SDK/SyntaxVisualizer/Roslyn.SyntaxVisualizer.DgmlHelper/SyntaxDgmlHelper.vb
@@ -10,374 +10,375 @@ Imports Microsoft.CodeAnalysis
Imports Microsoft.VisualBasic
Imports
-Public Class SyntaxDgmlOptions
- Public Property ShowTrivia As Boolean = True
- Public Property ShowSpan As Boolean = True
- Public Property ShowErrors As Boolean = True
- Public Property ShowText As Boolean = False
- Public Property ShowGroups As Boolean = False
-End Class
-
-Public Module SyntaxDgmlHelper
- Private ReadOnly s_defaultOptions As New SyntaxDgmlOptions
- Private Const s_MAX_LABEL_LENGTH = 30
-
- 'Helpers that return the DGML representation of a SyntaxNode / SyntaxToken / SyntaxTrivia.
- 'DGML is an XML-based format for directed graphs that can be rendered by Visual Studio.
+Namespace Roslyn.SyntaxVisualizer.DgmlHelper
+ Public Class SyntaxDgmlOptions
+ Public Property ShowTrivia As Boolean = True
+ Public Property ShowSpan As Boolean = True
+ Public Property ShowErrors As Boolean = True
+ Public Property ShowText As Boolean = False
+ Public Property ShowGroups As Boolean = False
+ End Class
+
+ Public Module SyntaxDgmlHelper
+ Private ReadOnly s_defaultOptions As New SyntaxDgmlOptions
+ Private Const s_MAX_LABEL_LENGTH = 30
+
+ 'Helpers that return the DGML representation of a SyntaxNode / SyntaxToken / SyntaxTrivia.
+ 'DGML is an XML-based format for directed graphs that can be rendered by Visual Studio.
#Region "ToDgml"
-
- Public Function ToDgml(nodeOrToken As SyntaxNodeOrToken,
+
+ Public Function ToDgml(nodeOrToken As SyntaxNodeOrToken,
Optional options As SyntaxDgmlOptions = Nothing) As XElement
- Dim dgml As XElement = Nothing
+ Dim dgml As XElement = Nothing
- If nodeOrToken.IsNode Then
- dgml = ToDgml(nodeOrToken.AsNode, options)
- Else
- dgml = ToDgml(nodeOrToken.AsToken, options)
- End If
+ If nodeOrToken.IsNode Then
+ dgml = ToDgml(nodeOrToken.AsNode, options)
+ Else
+ dgml = ToDgml(nodeOrToken.AsToken, options)
+ End If
- Return dgml
- End Function
+ Return dgml
+ End Function
-
- Public Function ToDgml(node As SyntaxNode,
+
+ Public Function ToDgml(node As SyntaxNode,
Optional options As SyntaxDgmlOptions = Nothing) As XElement
- If options Is Nothing Then
- options = s_defaultOptions
- End If
+ If options Is Nothing Then
+ options = s_defaultOptions
+ End If
- Dim dgml = GetDgmlTemplate(options)
- ProcessNode(options, node, dgml)
- Return dgml
- End Function
+ Dim dgml = GetDgmlTemplate(options)
+ ProcessNode(options, node, dgml)
+ Return dgml
+ End Function
-
- Public Function ToDgml(token As SyntaxToken,
+
+ Public Function ToDgml(token As SyntaxToken,
Optional options As SyntaxDgmlOptions = Nothing) As XElement
- If options Is Nothing Then
- options = s_defaultOptions
- End If
+ If options Is Nothing Then
+ options = s_defaultOptions
+ End If
- Dim dgml = GetDgmlTemplate(options)
- ProcessToken(options, token, dgml)
- Return dgml
- End Function
+ Dim dgml = GetDgmlTemplate(options)
+ ProcessToken(options, token, dgml)
+ Return dgml
+ End Function
-
- Public Function ToDgml(trivia As SyntaxTrivia,
+
+ Public Function ToDgml(trivia As SyntaxTrivia,
Optional options As SyntaxDgmlOptions = Nothing) As XElement
- If options Is Nothing Then
- options = s_defaultOptions
- End If
-
- Dim dgml = GetDgmlTemplate(options)
- ProcessTrivia(options, trivia, dgml)
- Return dgml
- End Function
+ If options Is Nothing Then
+ options = s_defaultOptions
+ End If
+
+ Dim dgml = GetDgmlTemplate(options)
+ ProcessTrivia(options, trivia, dgml)
+ Return dgml
+ End Function
#End Region
#Region "Process*"
- Private Sub ProcessNodeOrToken(options As SyntaxDgmlOptions, nodeOrToken As SyntaxNodeOrToken, dgml As XElement,
+ Private Sub ProcessNodeOrToken(options As SyntaxDgmlOptions, nodeOrToken As SyntaxNodeOrToken, dgml As XElement,
Optional ByRef count As Integer = 0,
Optional parent As XElement = Nothing,
Optional parentGroup As XElement = Nothing,
Optional properties As HashSet(Of String) = Nothing)
- If nodeOrToken.IsNode Then
- ProcessNode(options, nodeOrToken.AsNode, dgml, count, parent, parentGroup, properties)
- Else
- ProcessToken(options, nodeOrToken.AsToken, dgml, count, parent, parentGroup, properties)
- End If
- End Sub
-
- Private Sub ProcessNode(options As SyntaxDgmlOptions, node As SyntaxNode, dgml As XElement,
+ If nodeOrToken.IsNode Then
+ ProcessNode(options, nodeOrToken.AsNode, dgml, count, parent, parentGroup, properties)
+ Else
+ ProcessToken(options, nodeOrToken.AsToken, dgml, count, parent, parentGroup, properties)
+ End If
+ End Sub
+
+ Private Sub ProcessNode(options As SyntaxDgmlOptions, node As SyntaxNode, dgml As XElement,
Optional ByRef count As Integer = 0,
Optional parent As XElement = Nothing,
Optional parentGroup As XElement = Nothing,
Optional properties As HashSet(Of String) = Nothing)
- count += 1
-
- Dim current = Label=<%= GetLabelForNode(node) %>/>
- Dim currentID = count, parentID = -1, currentGroupID = -1, parentGroupID = -1
- Initialize(options, dgml, parent, parentGroup, current, properties, currentID, parentID, currentGroupID, parentGroupID)
- AddNodeInfo(options, node, current, dgml, properties)
- Dim currentGroup As XElement = parentGroup
-
- current.@Category = "0"
-
- If options.ShowGroups Then
count += 1
- currentGroup = Label=<%= GetLabelForNode(node) %>/>
- AddNodeInfo(options, node, currentGroup, dgml, properties)
- dgml..First.Add(currentGroup)
- currentGroupID = count
- dgml..First.Add( Target=<%= currentID %> Category="7">)
- If parentGroupID <> -1 Then
- dgml..First.Add( Target=<%= currentGroupID %> Category="7">)
+
+ Dim current = Label=<%= GetLabelForNode(node) %>/>
+ Dim currentID = count, parentID = -1, currentGroupID = -1, parentGroupID = -1
+ Initialize(options, dgml, parent, parentGroup, current, properties, currentID, parentID, currentGroupID, parentGroupID)
+ AddNodeInfo(options, node, current, dgml, properties)
+ Dim currentGroup As XElement = parentGroup
+
+ current.@Category = "0"
+
+ If options.ShowGroups Then
+ count += 1
+ currentGroup = Label=<%= GetLabelForNode(node) %>/>
+ AddNodeInfo(options, node, currentGroup, dgml, properties)
+ dgml..First.Add(currentGroup)
+ currentGroupID = count
+ dgml..First.Add( Target=<%= currentID %> Category="7">)
+ If parentGroupID <> -1 Then
+ dgml..First.Add( Target=<%= currentGroupID %> Category="7">)
+ End If
End If
- End If
- Dim kind = node.GetKind()
+ Dim kind = node.GetKind()
- If (node.IsMissing OrElse node.Span.Length = 0) AndAlso Not kind = "CompilationUnit" Then
- current.@Category = "4"
- End If
+ If (node.IsMissing OrElse node.Span.Length = 0) AndAlso Not kind = "CompilationUnit" Then
+ current.@Category = "4"
+ End If
- If kind.Contains("Bad") OrElse kind.Contains("Skipped") Then
- current.@Category = "5"
- End If
+ If kind.Contains("Bad") OrElse kind.Contains("Skipped") Then
+ current.@Category = "5"
+ End If
- If options.ShowErrors AndAlso node.ContainsDiagnostics Then
- AddErrorIcon(current)
- End If
+ If options.ShowErrors AndAlso node.ContainsDiagnostics Then
+ AddErrorIcon(current)
+ End If
- For Each childSyntaxNode In node.ChildNodesAndTokens()
- ProcessNodeOrToken(options, childSyntaxNode, dgml, count, current, currentGroup, properties)
- Next
- End Sub
+ For Each childSyntaxNode In node.ChildNodesAndTokens()
+ ProcessNodeOrToken(options, childSyntaxNode, dgml, count, current, currentGroup, properties)
+ Next
+ End Sub
- Private Sub ProcessToken(options As SyntaxDgmlOptions, token As SyntaxToken, dgml As XElement,
+ Private Sub ProcessToken(options As SyntaxDgmlOptions, token As SyntaxToken, dgml As XElement,
Optional ByRef count As Integer = 0,
Optional parent As XElement = Nothing,
Optional parentGroup As XElement = Nothing,
Optional properties As HashSet(Of String) = Nothing)
- count += 1
+ count += 1
- Dim current = Label=<%= GetLabelForToken(token) %>/>
- Initialize(options, dgml, parent, parentGroup, current, properties, count, 0, 0, 0)
- AddTokenInfo(options, token, current, dgml, properties)
- Dim currentGroup As XElement = parentGroup
+ Dim current = Label=<%= GetLabelForToken(token) %>/>
+ Initialize(options, dgml, parent, parentGroup, current, properties, count, 0, 0, 0)
+ AddTokenInfo(options, token, current, dgml, properties)
+ Dim currentGroup As XElement = parentGroup
- current.@Category = "1"
+ current.@Category = "1"
- Dim kind = token.GetKind()
+ Dim kind = token.GetKind()
- If (token.IsMissing OrElse token.Span.Length = 0) AndAlso Not kind = "EndOfFileToken" Then
- current.@Category = "4"
- End If
+ If (token.IsMissing OrElse token.Span.Length = 0) AndAlso Not kind = "EndOfFileToken" Then
+ current.@Category = "4"
+ End If
- If kind.Contains("Bad") OrElse kind.Contains("Skipped") Then
- current.@Category = "5"
- End If
+ If kind.Contains("Bad") OrElse kind.Contains("Skipped") Then
+ current.@Category = "5"
+ End If
- If options.ShowErrors AndAlso token.ContainsDiagnostics Then
- AddErrorIcon(current)
- End If
+ If options.ShowErrors AndAlso token.ContainsDiagnostics Then
+ AddErrorIcon(current)
+ End If
- If options.ShowTrivia Then
- For Each triviaNode In token.LeadingTrivia
- ProcessTrivia(options, triviaNode, dgml, count, True, current, currentGroup, properties)
- Next
- For Each triviaNode In token.TrailingTrivia
- ProcessTrivia(options, triviaNode, dgml, count, False, current, currentGroup, properties)
- Next
- End If
- End Sub
+ If options.ShowTrivia Then
+ For Each triviaNode In token.LeadingTrivia
+ ProcessTrivia(options, triviaNode, dgml, count, True, current, currentGroup, properties)
+ Next
+ For Each triviaNode In token.TrailingTrivia
+ ProcessTrivia(options, triviaNode, dgml, count, False, current, currentGroup, properties)
+ Next
+ End If
+ End Sub
- Private Sub ProcessTrivia(options As SyntaxDgmlOptions, trivia As SyntaxTrivia, dgml As XElement,
+ Private Sub ProcessTrivia(options As SyntaxDgmlOptions, trivia As SyntaxTrivia, dgml As XElement,
Optional ByRef count As Integer = 0,
Optional isProcessingLeadingTrivia As Boolean = False,
Optional parent As XElement = Nothing,
Optional parentGroup As XElement = Nothing,
Optional properties As HashSet(Of String) = Nothing)
- count += 1
+ count += 1
- Dim current = Label=<%= GetLabelForTrivia(trivia) %>/>
- Initialize(options, dgml, parent, parentGroup, current, properties, count, 0, 0, 0)
- AddTriviaInfo(options, trivia, current, dgml, properties)
- Dim currentGroup As XElement = parentGroup
+ Dim current = Label=<%= GetLabelForTrivia(trivia) %>/>
+ Initialize(options, dgml, parent, parentGroup, current, properties, count, 0, 0, 0)
+ AddTriviaInfo(options, trivia, current, dgml, properties)
+ Dim currentGroup As XElement = parentGroup
- If isProcessingLeadingTrivia Then
- current.@Category = "2"
- Else
- current.@Category = "3"
- End If
+ If isProcessingLeadingTrivia Then
+ current.@Category = "2"
+ Else
+ current.@Category = "3"
+ End If
- Dim kind = trivia.GetKind()
+ Dim kind = trivia.GetKind()
- If kind.Contains("Bad") OrElse kind.Contains("Skipped") Then
- current.@Category = "5"
- End If
+ If kind.Contains("Bad") OrElse kind.Contains("Skipped") Then
+ current.@Category = "5"
+ End If
- If options.ShowErrors AndAlso trivia.ContainsDiagnostics Then
- AddErrorIcon(current)
- End If
+ If options.ShowErrors AndAlso trivia.ContainsDiagnostics Then
+ AddErrorIcon(current)
+ End If
- If options.ShowTrivia Then
- If trivia.HasStructure Then
- ProcessNode(options, trivia.GetStructure, dgml, count, current, currentGroup, properties)
+ If options.ShowTrivia Then
+ If trivia.HasStructure Then
+ ProcessNode(options, trivia.GetStructure, dgml, count, current, currentGroup, properties)
+ End If
End If
- End If
- End Sub
+ End Sub
#End Region
#Region "GetLabel*"
- Private Function GetLabelForNode(node As SyntaxNode) As String
- Return String.Format(My.Resources.Resources.SyntaxNodeLabel, node.GetKind())
- End Function
-
- Private Function GetLabelForToken(token As SyntaxToken) As String
- Dim label = token.GetKind()
- Dim text = token.ToString()
-
- If text.Trim <> String.Empty Then
- If text.Length <= s_MAX_LABEL_LENGTH Then
- label = text
- Else
- label = text.Remove(s_MAX_LABEL_LENGTH) & "..."
+ Private Function GetLabelForNode(node As SyntaxNode) As String
+ Return String.Format(My.Resources.Resources.SyntaxNodeLabel, node.GetKind())
+ End Function
+
+ Private Function GetLabelForToken(token As SyntaxToken) As String
+ Dim label = token.GetKind()
+ Dim text = token.ToString()
+
+ If text.Trim <> String.Empty Then
+ If text.Length <= s_MAX_LABEL_LENGTH Then
+ label = text
+ Else
+ label = text.Remove(s_MAX_LABEL_LENGTH) & "..."
+ End If
End If
- End If
- Return String.Format(My.Resources.Resources.SyntaxTokenLabel, label)
- End Function
+ Return String.Format(My.Resources.Resources.SyntaxTokenLabel, label)
+ End Function
- Private Function GetLabelForTrivia(trivia As SyntaxTrivia) As String
- Return trivia.GetKind()
- End Function
+ Private Function GetLabelForTrivia(trivia As SyntaxTrivia) As String
+ Return trivia.GetKind()
+ End Function
#End Region
#Region "Add*"
- Private Sub AddNodeInfo(options As SyntaxDgmlOptions, node As SyntaxNode,
+ Private Sub AddNodeInfo(options As SyntaxDgmlOptions, node As SyntaxNode,
current As XElement, dgml As XElement,
properties As HashSet(Of String))
- Dim nodeInfo = GetObjectInfo(node)
- AddDgmlProperty("Type", properties, dgml)
- current.@Type = nodeInfo.TypeName
- AddDgmlProperty("Kind", properties, dgml)
- current.@Kind = node.GetKind()
-
- If options.ShowSpan Then
- AddDgmlProperty("Span", properties, dgml)
- current.@Span = String.Format("{0} Length: {1}",
+ Dim nodeInfo = GetObjectInfo(node)
+ AddDgmlProperty("Type", properties, dgml)
+ current.@Type = nodeInfo.TypeName
+ AddDgmlProperty("Kind", properties, dgml)
+ current.@Kind = node.GetKind()
+
+ If options.ShowSpan Then
+ AddDgmlProperty("Span", properties, dgml)
+ current.@Span = String.Format("{0} Length: {1}",
node.Span.ToString,
node.Span.Length)
- AddDgmlProperty("FullSpan", properties, dgml)
- current.@FullSpan = String.Format("{0} Length: {1}",
+ AddDgmlProperty("FullSpan", properties, dgml)
+ current.@FullSpan = String.Format("{0} Length: {1}",
node.FullSpan.ToString,
node.FullSpan.Length)
- End If
-
- For Each field In nodeInfo.PropertyInfos
- Dim name = field.Name
- If Not (name.Contains("Span") OrElse name.Contains("Kind") OrElse name.Contains("Text")) Then
- AddDgmlProperty(name, properties, dgml)
- current.Add(New XAttribute(name, field.Value.ToString))
- End If
- Next
-
- Dim syntaxTree = node.SyntaxTree
- If syntaxTree IsNot Nothing AndAlso options.ShowErrors Then
- Dim syntaxErrors = syntaxTree.GetDiagnostics(node)
- AddDgmlProperty("Errors", properties, dgml)
- current.@Errors = String.Format("Count: {0}", syntaxErrors.Count)
- For Each syntaxError In syntaxErrors
- current.@Errors &= vbCrLf & syntaxError.ToString(Nothing)
+ End If
+
+ For Each field In nodeInfo.PropertyInfos
+ Dim name = field.Name
+ If Not (name.Contains("Span") OrElse name.Contains("Kind") OrElse name.Contains("Text")) Then
+ AddDgmlProperty(name, properties, dgml)
+ current.Add(New XAttribute(name, field.Value.ToString))
+ End If
Next
- End If
- If options.ShowText Then
- AddDgmlProperty("Text", properties, dgml)
- current.@Text = node.ToString()
- AddDgmlProperty("FullText", properties, dgml)
- current.@FullText = node.ToFullString()
- End If
- End Sub
+ Dim syntaxTree = node.SyntaxTree
+ If syntaxTree IsNot Nothing AndAlso options.ShowErrors Then
+ Dim syntaxErrors = syntaxTree.GetDiagnostics(node)
+ AddDgmlProperty("Errors", properties, dgml)
+ current.@Errors = String.Format("Count: {0}", syntaxErrors.Count)
+ For Each syntaxError In syntaxErrors
+ current.@Errors &= vbCrLf & syntaxError.ToString(Nothing)
+ Next
+ End If
- Private Sub AddTokenInfo(options As SyntaxDgmlOptions, token As SyntaxToken,
+ If options.ShowText Then
+ AddDgmlProperty("Text", properties, dgml)
+ current.@Text = node.ToString()
+ AddDgmlProperty("FullText", properties, dgml)
+ current.@FullText = node.ToFullString()
+ End If
+ End Sub
+
+ Private Sub AddTokenInfo(options As SyntaxDgmlOptions, token As SyntaxToken,
current As XElement, dgml As XElement,
properties As HashSet(Of String))
- Dim tokenInfo = GetObjectInfo(token)
- AddDgmlProperty("Type", properties, dgml)
- current.@Type = tokenInfo.TypeName
- AddDgmlProperty("Kind", properties, dgml)
- current.@Kind = token.GetKind()
-
- If options.ShowSpan Then
- AddDgmlProperty("Span", properties, dgml)
- current.@Span = String.Format("{0} Length: {1}",
+ Dim tokenInfo = GetObjectInfo(token)
+ AddDgmlProperty("Type", properties, dgml)
+ current.@Type = tokenInfo.TypeName
+ AddDgmlProperty("Kind", properties, dgml)
+ current.@Kind = token.GetKind()
+
+ If options.ShowSpan Then
+ AddDgmlProperty("Span", properties, dgml)
+ current.@Span = String.Format("{0} Length: {1}",
token.Span.ToString,
token.Span.Length)
- AddDgmlProperty("FullSpan", properties, dgml)
- current.@FullSpan = String.Format("{0} Length: {1}",
+ AddDgmlProperty("FullSpan", properties, dgml)
+ current.@FullSpan = String.Format("{0} Length: {1}",
token.FullSpan.ToString,
token.FullSpan.Length)
- End If
-
- For Each field In tokenInfo.PropertyInfos
- Dim name = field.Name
- If Not (name.Contains("Span") OrElse name.Contains("Kind") OrElse name.Contains("Text")) Then
- AddDgmlProperty(name, properties, dgml)
- current.Add(New XAttribute(name, field.Value.ToString))
- End If
- Next
-
- Dim syntaxTree = token.SyntaxTree
- If syntaxTree IsNot Nothing AndAlso options.ShowErrors Then
- Dim syntaxErrors = syntaxTree.GetDiagnostics(token)
- AddDgmlProperty("Errors", properties, dgml)
- current.@Errors = String.Format("Count: {0}", syntaxErrors.Count)
- For Each syntaxError In syntaxErrors
- current.@Errors &= vbCrLf & syntaxError.ToString(Nothing)
+ End If
+
+ For Each field In tokenInfo.PropertyInfos
+ Dim name = field.Name
+ If Not (name.Contains("Span") OrElse name.Contains("Kind") OrElse name.Contains("Text")) Then
+ AddDgmlProperty(name, properties, dgml)
+ current.Add(New XAttribute(name, field.Value.ToString))
+ End If
Next
- End If
- If options.ShowText Then
- AddDgmlProperty("Text", properties, dgml)
- current.@Text = token.ToString()
- AddDgmlProperty("FullText", properties, dgml)
- current.@FullText = token.ToFullString()
- End If
- End Sub
+ Dim syntaxTree = token.SyntaxTree
+ If syntaxTree IsNot Nothing AndAlso options.ShowErrors Then
+ Dim syntaxErrors = syntaxTree.GetDiagnostics(token)
+ AddDgmlProperty("Errors", properties, dgml)
+ current.@Errors = String.Format("Count: {0}", syntaxErrors.Count)
+ For Each syntaxError In syntaxErrors
+ current.@Errors &= vbCrLf & syntaxError.ToString(Nothing)
+ Next
+ End If
+
+ If options.ShowText Then
+ AddDgmlProperty("Text", properties, dgml)
+ current.@Text = token.ToString()
+ AddDgmlProperty("FullText", properties, dgml)
+ current.@FullText = token.ToFullString()
+ End If
+ End Sub
- Private Sub AddTriviaInfo(options As SyntaxDgmlOptions, trivia As SyntaxTrivia,
+ Private Sub AddTriviaInfo(options As SyntaxDgmlOptions, trivia As SyntaxTrivia,
current As XElement, dgml As XElement,
properties As HashSet(Of String))
- Dim triviaInfo = GetObjectInfo(trivia)
- AddDgmlProperty("Type", properties, dgml)
- current.@Type = triviaInfo.TypeName
- AddDgmlProperty("Kind", properties, dgml)
- current.@Kind = trivia.GetKind()
-
- If options.ShowSpan Then
- AddDgmlProperty("Span", properties, dgml)
- current.@Span = String.Format("{0} Length: {1}",
+ Dim triviaInfo = GetObjectInfo(trivia)
+ AddDgmlProperty("Type", properties, dgml)
+ current.@Type = triviaInfo.TypeName
+ AddDgmlProperty("Kind", properties, dgml)
+ current.@Kind = trivia.GetKind()
+
+ If options.ShowSpan Then
+ AddDgmlProperty("Span", properties, dgml)
+ current.@Span = String.Format("{0} Length: {1}",
trivia.Span.ToString,
trivia.Span.Length)
- AddDgmlProperty("FullSpan", properties, dgml)
- current.@FullSpan = String.Format("{0} Length: {1}",
+ AddDgmlProperty("FullSpan", properties, dgml)
+ current.@FullSpan = String.Format("{0} Length: {1}",
trivia.FullSpan.ToString,
trivia.FullSpan.Length)
- End If
-
- For Each field In triviaInfo.PropertyInfos
- Dim name = field.Name
- If Not (name.Contains("Span") OrElse name.Contains("Kind") OrElse name.Contains("Text")) Then
- AddDgmlProperty(name, properties, dgml)
- current.Add(New XAttribute(name, field.Value.ToString))
- End If
- Next
-
- Dim syntaxTree = trivia.SyntaxTree
- If syntaxTree IsNot Nothing AndAlso options.ShowErrors Then
- Dim syntaxErrors = syntaxTree.GetDiagnostics(trivia)
- AddDgmlProperty("Errors", properties, dgml)
- current.@Errors = String.Format("Count: {0}", syntaxErrors.Count)
- For Each syntaxError In syntaxErrors
- current.@Errors &= vbCrLf & syntaxError.ToString(Nothing)
+ End If
+
+ For Each field In triviaInfo.PropertyInfos
+ Dim name = field.Name
+ If Not (name.Contains("Span") OrElse name.Contains("Kind") OrElse name.Contains("Text")) Then
+ AddDgmlProperty(name, properties, dgml)
+ current.Add(New XAttribute(name, field.Value.ToString))
+ End If
Next
- End If
-
- If options.ShowText Then
- AddDgmlProperty("Text", properties, dgml)
- current.@Text = trivia.ToString()
- AddDgmlProperty("FullText", properties, dgml)
- current.@FullText = trivia.ToFullString()
- End If
- End Sub
+
+ Dim syntaxTree = trivia.SyntaxTree
+ If syntaxTree IsNot Nothing AndAlso options.ShowErrors Then
+ Dim syntaxErrors = syntaxTree.GetDiagnostics(trivia)
+ AddDgmlProperty("Errors", properties, dgml)
+ current.@Errors = String.Format("Count: {0}", syntaxErrors.Count)
+ For Each syntaxError In syntaxErrors
+ current.@Errors &= vbCrLf & syntaxError.ToString(Nothing)
+ Next
+ End If
+
+ If options.ShowText Then
+ AddDgmlProperty("Text", properties, dgml)
+ current.@Text = trivia.ToString()
+ AddDgmlProperty("FullText", properties, dgml)
+ current.@FullText = trivia.ToFullString()
+ End If
+ End Sub
#End Region
#Region "Other Helpers"
- Private Sub Initialize(options As SyntaxDgmlOptions,
+ Private Sub Initialize(options As SyntaxDgmlOptions,
dgml As XElement,
parent As XElement,
parentGroup As XElement,
@@ -387,111 +388,112 @@ Public Module SyntaxDgmlHelper
ByRef parentID As Integer,
ByRef currentGroupID As Integer,
ByRef parentGroupID As Integer)
- dgml..First.Add(current)
-
- parentGroupID = -1 : currentGroupID = -1
- parentID = -1
-
- If parent IsNot Nothing Then
- parentID = CInt(parent.@Id)
- End If
-
- If options.ShowGroups Then
- If parentGroup IsNot Nothing Then
- parentGroupID = CInt(parentGroup.@Id)
- End If
- currentGroupID = parentGroupID
- End If
-
- If parentID <> -1 Then
- dgml..First.Add( Target=<%= currentID %>>)
- End If
-
- If options.ShowGroups AndAlso parentGroupID <> -1 Then
- dgml..First.Add( Target=<%= currentID %> Category="7">)
- End If
-
- If properties Is Nothing Then
- properties = New HashSet(Of String)
- End If
- End Sub
-
- Private Function GetDgmlTemplate(options As SyntaxDgmlOptions) As XElement
- Dim dgml =
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <%= If(options.ShowTrivia,
+ dgml..First.Add(current)
+
+ parentGroupID = -1 : currentGroupID = -1
+ parentID = -1
+
+ If parent IsNot Nothing Then
+ parentID = CInt(parent.@Id)
+ End If
+
+ If options.ShowGroups Then
+ If parentGroup IsNot Nothing Then
+ parentGroupID = CInt(parentGroup.@Id)
+ End If
+ currentGroupID = parentGroupID
+ End If
+
+ If parentID <> -1 Then
+ dgml..First.Add( Target=<%= currentID %>>)
+ End If
+
+ If options.ShowGroups AndAlso parentGroupID <> -1 Then
+ dgml..First.Add( Target=<%= currentID %> Category="7">)
+ End If
+
+ If properties Is Nothing Then
+ properties = New HashSet(Of String)
+ End If
+ End Sub
+
+ Private Function GetDgmlTemplate(options As SyntaxDgmlOptions) As XElement
+ Dim dgml =
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <%= If(options.ShowTrivia,
, Nothing) %>
- <%= If(options.ShowTrivia,
+ <%= If(options.ShowTrivia,
, Nothing) %>
-
-
-
-
-
-
- dgml.AddAnnotation(SaveOptions.OmitDuplicateNamespaces)
-
- If options.ShowGroups Then
- dgml..First.Add()
- End If
- Return dgml
- End Function
-
- Private Sub AddDgmlProperty(propertyName As String, properties As HashSet(Of String), dgml As XElement)
- If Not properties.Contains(propertyName) Then
- dgml..First.Add( Label=<%= propertyName %> DataType="System.String"/>)
- properties.Add(propertyName)
- End If
- End Sub
-
- Private Sub AddErrorIcon(element As XElement)
- element.@Icon = "CodeSchema_Event"
- End Sub
+
+
+
+
+
+
+ dgml.AddAnnotation(SaveOptions.OmitDuplicateNamespaces)
+
+ If options.ShowGroups Then
+ dgml..First.Add()
+ End If
+ Return dgml
+ End Function
+
+ Private Sub AddDgmlProperty(propertyName As String, properties As HashSet(Of String), dgml As XElement)
+ If Not properties.Contains(propertyName) Then
+ dgml..First.Add( Label=<%= propertyName %> DataType="System.String"/>)
+ properties.Add(propertyName)
+ End If
+ End Sub
+
+ Private Sub AddErrorIcon(element As XElement)
+ element.@Icon = "CodeSchema_Event"
+ End Sub
#End Region
-End Module
+ End Module
+End Namespace
diff --git a/src/VisualStudio.Roslyn.SDK/SyntaxVisualizer/Roslyn.SyntaxVisualizer.DgmlHelper/SyntaxKindHelper.vb b/src/VisualStudio.Roslyn.SDK/SyntaxVisualizer/Roslyn.SyntaxVisualizer.DgmlHelper/SyntaxKindHelper.vb
index e8645ef9c..3c10faa23 100644
--- a/src/VisualStudio.Roslyn.SDK/SyntaxVisualizer/Roslyn.SyntaxVisualizer.DgmlHelper/SyntaxKindHelper.vb
+++ b/src/VisualStudio.Roslyn.SDK/SyntaxVisualizer/Roslyn.SyntaxVisualizer.DgmlHelper/SyntaxKindHelper.vb
@@ -1,61 +1,63 @@
-' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+' 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.Runtime.CompilerServices
Imports Microsoft.CodeAnalysis
-Friend Module SyntaxKindHelper
- 'Helpers that return the language-specific (C# / VB) SyntaxKind of a language-agnostic
- 'SyntaxNode / SyntaxToken / SyntaxTrivia.
-
-
- Friend Function GetKind(nodeOrToken As SyntaxNodeOrToken) As String
- Dim kind = String.Empty
-
- If nodeOrToken.IsNode Then
- kind = nodeOrToken.AsNode().GetKind()
- Else
- kind = nodeOrToken.AsToken().GetKind()
- End If
-
- Return kind
- End Function
-
-
- Friend Function GetKind(node As SyntaxNode) As String
- Dim kind = String.Empty
-
- If node.Language = LanguageNames.CSharp Then
- kind = CSharp.CSharpExtensions.Kind(node).ToString()
- Else
- kind = VisualBasic.VisualBasicExtensions.Kind(node).ToString()
- End If
-
- Return kind
- End Function
-
-
- Friend Function GetKind(token As SyntaxToken) As String
- Dim kind = String.Empty
-
- If token.Language = LanguageNames.CSharp Then
- kind = CSharp.CSharpExtensions.Kind(token).ToString()
- Else
- kind = VisualBasic.VisualBasicExtensions.Kind(token).ToString()
- End If
-
- Return kind
- End Function
-
-
- Friend Function GetKind(trivia As SyntaxTrivia) As String
- Dim kind = String.Empty
-
- If trivia.Language = LanguageNames.CSharp Then
- kind = CSharp.CSharpExtensions.Kind(trivia).ToString()
- Else
- kind = VisualBasic.VisualBasicExtensions.Kind(trivia).ToString()
- End If
-
- Return kind
- End Function
-End Module
+Namespace Roslyn.SyntaxVisualizer.DgmlHelper
+ Friend Module SyntaxKindHelper
+ 'Helpers that return the language-specific (C# / VB) SyntaxKind of a language-agnostic
+ 'SyntaxNode / SyntaxToken / SyntaxTrivia.
+
+
+ Friend Function GetKind(nodeOrToken As SyntaxNodeOrToken) As String
+ Dim kind = String.Empty
+
+ If nodeOrToken.IsNode Then
+ kind = nodeOrToken.AsNode().GetKind()
+ Else
+ kind = nodeOrToken.AsToken().GetKind()
+ End If
+
+ Return kind
+ End Function
+
+
+ Friend Function GetKind(node As SyntaxNode) As String
+ Dim kind = String.Empty
+
+ If node.Language = LanguageNames.CSharp Then
+ kind = CSharp.CSharpExtensions.Kind(node).ToString()
+ Else
+ kind = VisualBasic.VisualBasicExtensions.Kind(node).ToString()
+ End If
+
+ Return kind
+ End Function
+
+
+ Friend Function GetKind(token As SyntaxToken) As String
+ Dim kind = String.Empty
+
+ If token.Language = LanguageNames.CSharp Then
+ kind = CSharp.CSharpExtensions.Kind(token).ToString()
+ Else
+ kind = VisualBasic.VisualBasicExtensions.Kind(token).ToString()
+ End If
+
+ Return kind
+ End Function
+
+
+ Friend Function GetKind(trivia As SyntaxTrivia) As String
+ Dim kind = String.Empty
+
+ If trivia.Language = LanguageNames.CSharp Then
+ kind = CSharp.CSharpExtensions.Kind(trivia).ToString()
+ Else
+ kind = VisualBasic.VisualBasicExtensions.Kind(trivia).ToString()
+ End If
+
+ Return kind
+ End Function
+ End Module
+End Namespace