예제 #1
0
        public bool SyntaxNodeMatchesDeclaration(SyntaxNode syntaxNode)
        {
            if (string.IsNullOrWhiteSpace(_declarationFilter))
            {
                return(true);
            }

            // The semantics of CSharp and Visual Basic appear to be different (I.e., VB puts everything inside a "Block")
            if (syntaxNode.SyntaxTree is Microsoft.CodeAnalysis.CSharp.CSharpSyntaxTree)
            {
                if (SyntaxNodeWrapper.Get(syntaxNode).GetKind().EndsWith("Declaration"))
                {
                    return(InternalsHelper.GetIdentifierTokenValueText(syntaxNode) == _declarationFilter);
                }
            }
            else if (syntaxNode.SyntaxTree is Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxTree)
            {
                if (SyntaxNodeWrapper.Get(syntaxNode).GetKind().EndsWith("Block"))
                {
                    SyntaxNode firstChild = syntaxNode.ChildNodes().FirstOrDefault();
                    if (firstChild != null && SyntaxNodeWrapper.Get(firstChild).GetKind().EndsWith("Statement"))
                    {
                        return(InternalsHelper.GetIdentifierTokenValueText(firstChild) == _declarationFilter);
                    }
                }
            }

            return(false);
        }
예제 #2
0
 private void CreateTextBox()
 {
     _textBox = new TextBox()
     {
         Multiline = true,
         Dock      = DockStyle.Fill,
         Font      = InternalsHelper.GetDefaultFont()
     };
 }