Пример #1
0
        public static bool TryCreate(StatementsInfo statementsInfo, TextSpan span, out StatementsSelection selectedStatements)
        {
            selectedStatements = null;

            if (span.IsEmpty)
            {
                return(false);
            }

            SyntaxList <StatementSyntax> statements = statementsInfo.Statements;

            if (!statements.Any())
            {
                return(false);
            }

            (int startIndex, int endIndex) = GetIndexes(statements, span);

            if (startIndex == -1)
            {
                return(false);
            }

            selectedStatements = new StatementsSelection(statementsInfo, span, startIndex, endIndex);
            return(true);
        }
Пример #2
0
        public static bool TryCreate(BlockSyntax block, TextSpan span, out StatementsSelection selectedStatements)
        {
            StatementsInfo info = SyntaxInfo.StatementsInfo(block);

            if (!info.Success)
            {
                selectedStatements = null;
                return(false);
            }

            return(TryCreate(info, span, out selectedStatements));
        }
Пример #3
0
        public static bool TryCreate(SwitchSectionSyntax switchSection, TextSpan span, out StatementsSelection selectedStatements)
        {
            StatementsInfo info = SyntaxInfo.StatementsInfo(switchSection);

            if (!info.Success)
            {
                selectedStatements = null;
                return(false);
            }

            return(TryCreate(info, span, out selectedStatements));
        }