// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.Text; using Roslyn.Utilities; namespace dnSpy.Roslyn.EditorFeatures.Extensions { internal static class TextSpanExtensions { /// /// Convert a instance to an . /// public static Span ToSpan(this TextSpan textSpan) { return new Span(textSpan.Start, textSpan.Length); } /// /// Convert a to a on the given instance /// public static SnapshotSpan ToSnapshotSpan(this TextSpan textSpan, ITextSnapshot snapshot) { Contract.Requires(snapshot != null); var span = textSpan.ToSpan(); return new SnapshotSpan(snapshot, span); } } }