private DocumentRange GetDocumentRange(INumericValue firstValue, INumericValue lastValue) { var startOffset = firstValue.GetDocumentStartOffset(); var endOffset = lastValue.GetDocumentEndOffset(); return(OldMsBuildWorkarounds.CreateDocumentRange(startOffset, endOffset)); }
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)); }