/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/EditorFeatures/Core/CommentSelection/CommentTrackingSpan.cs
40 строк
2 KB
Cyrus Najmabadi
Remove unnecessary nullable directives
25 мар 2025, 20:32
25 мар 2025, 20:32
834ce57
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.CommentSelection; /// <summary> /// Wrapper around a TextSpan that holds extra data used to create a tracking span. /// </summary> internal readonly struct CommentTrackingSpan { public TextSpan TrackingTextSpan { get; } // In some cases, the tracking span needs to be adjusted by a specific amount after the changes have been applied. // These fields store the amount to adjust the span by after edits have been applied. // e.g. The selection begins in a comment - // /*Com[|ment*/ int i = 1;|] -> /*Com*//*ment*/ int i = 1;*/ // There are two new comment markers added inside the original comment, only the second should be selected. public int AmountToAddToTrackingSpanStart { get; } public int AmountToAddToTrackingSpanEnd { get; } public CommentTrackingSpan(TextSpan trackingTextSpan) { TrackingTextSpan = trackingTextSpan; AmountToAddToTrackingSpanStart = 0; AmountToAddToTrackingSpanEnd = 0; } public CommentTrackingSpan(TextSpan trackingTextSpan, int amountToAddToStart, int amountToAddToEnd) { TrackingTextSpan = trackingTextSpan; AmountToAddToTrackingSpanStart = amountToAddToStart; AmountToAddToTrackingSpanEnd = amountToAddToEnd; } public bool HasPostApplyChanges() => AmountToAddToTrackingSpanStart != 0 || AmountToAddToTrackingSpanEnd != 0; }