コード例 #1
0
        private static CompletionSyntax GetCompletionSyntax(SyntaxNodeOrToken nodeOrToken)
        {
            SyntaxNodeOrToken dot;
            SyntaxNode        prefix = null;

            if (nodeOrToken.IsNode)
            {
                prefix = nodeOrToken.AsNode();
                dot    = nodeOrToken.GetPreviousSibling();
                if (dot.Kind() != SyntaxKind.DotToken)
                {
                    return(new CompletionSyntax(null, prefix));
                }
            }
            else
            {
                if (nodeOrToken.Kind() != SyntaxKind.DotToken)
                {
                    return(new CompletionSyntax(null, prefix));
                }
                dot = nodeOrToken;
            }

            var previous = dot.GetPreviousSibling();

            return(previous.IsNode ? new CompletionSyntax(previous.AsNode(), prefix) : new CompletionSyntax(null, prefix));
        }