Exemplo n.º 1
0
        private DocumentRange GetDocumentRange(INumericValue firstValue, INumericValue lastValue)
        {
            var startOffset = firstValue.GetDocumentStartOffset();
            var endOffset   = lastValue.GetDocumentEndOffset();

            return(OldMsBuildWorkarounds.CreateDocumentRange(startOffset, endOffset));
        }
Exemplo n.º 2
0
        public static DocumentRange GetParametersHighlightingRange(IMethodDeclaration methodDeclaration)
        {
            var nameRange = methodDeclaration.GetNameDocumentRange();

            if (!nameRange.IsValid())
            {
                return(DocumentRange.InvalidRange);
            }

            var @params = methodDeclaration.Params;

            if (@params == null)
            {
                return(nameRange);
            }

            var paramsRange = @params.GetDocumentRange();

            if (!paramsRange.IsValid())
            {
                return(nameRange);
            }

            if (!paramsRange.IsEmpty)
            {
                return(paramsRange);
            }

            var lparRange   = methodDeclaration.LPar?.GetDocumentRange();
            var rparRange   = methodDeclaration.RPar?.GetDocumentRange();
            var startOffset = lparRange != null && lparRange.Value.IsValid()
                ? lparRange.Value
                : paramsRange;
            var endOffset = rparRange != null && rparRange.Value.IsValid()
                ? rparRange.Value
                : paramsRange;

            return(OldMsBuildWorkarounds.CreateDocumentRange(startOffset.StartOffset, endOffset.EndOffset));
        }