Me.xamSyntaxEditor1.Document.Language.SyntaxTreeCreated += Language_SyntaxTreeCreated
Private Sub Language_SyntaxTreeCreated(sender As Object, e As SyntaxTreeCreatedEventArgs)
Dim syntaxNode = e.SyntaxTree.RootNode.GetChild(0)
' 診断を追加
Dim newTree = e.SyntaxTree.AddDiagnostic(syntaxNode, New Diagnostic(New TextSpan(syntaxNode.LeadingIgnoredContentLength, syntaxNode.GetText().Trim().Length), "Something wrong happened!", DiagnosticSeverity.Warning))
' 注釈を追加
Dim anotherNewTree = newTree.AddAnnotation(newTree.RootNode.GetChild(0), New SyntaxAnnotation())
e.SyntaxTree = anotherNewTree
End Sub