|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Microsoft.CodeAnalysis.Razor.Protocol;
namespace Microsoft.CodeAnalysis.Text;
internal static class TextSpanExtensions
{
internal static TextSpan TrimLeadingWhitespace(this TextSpan span, SourceText text)
{
for (var i = 0; i < span.Length; ++i)
{
if (!char.IsWhiteSpace(text[span.Start + i]))
{
return new TextSpan(span.Start + i, span.Length - i);
}
}
return span;
}
internal static RazorTextSpan ToRazorTextSpan(this TextSpan span)
{
return new RazorTextSpan()
{
Start = span.Start,
Length = span.Length
};
}
}
|