|
| 1 | +// Licensed to the .NET Foundation under one or more agreements. |
| 2 | +// The .NET Foundation licenses this file to you under the MIT license. |
| 3 | +// See the LICENSE file in the project root for more information. |
| 4 | + |
| 5 | +using Microsoft.VisualStudio.Text.Editor; |
| 6 | +using Microsoft.VisualStudio.Text.Formatting; |
| 7 | +using Microsoft.VisualStudio.Text.Tagging; |
| 8 | + |
| 9 | +namespace Microsoft.CodeAnalysis.Editor.InlineHints; |
| 10 | + |
| 11 | +internal partial class InlineHintsTaggerProvider |
| 12 | +{ |
| 13 | + /// <summary>The computed adornment tag for an inline hint, along with information needed to determine if it can be |
| 14 | + /// reused. This is created and cached on <see cref="InlineHintDataTag.AdditionalData"/> on demand so that we only |
| 15 | + /// create adornment tags once and reuse as long as possible.</summary> |
| 16 | + /// <param name="classified">Whether or not the adornment tag was classified. If the option for this changes, this |
| 17 | + /// cached tag should not be reused.</param> |
| 18 | + /// <param name="format">The text formatting used to create the hint. If this format no longer matches the current |
| 19 | + /// formatting, this should not be reused.</param> |
| 20 | + /// <param name="adornmentTagSpan">The actual adornment tag to render.</param> |
| 21 | + private sealed class CachedAdornmentTagSpan( |
| 22 | + bool classified, |
| 23 | + TextFormattingRunProperties format, |
| 24 | + TagSpan<IntraTextAdornmentTag> adornmentTagSpan) |
| 25 | + { |
| 26 | + public bool Classified { get; } = classified; |
| 27 | + public TextFormattingRunProperties Format { get; } = format; |
| 28 | + public TagSpan<IntraTextAdornmentTag> AdornmentTagSpan { get; } = adornmentTagSpan; |
| 29 | + } |
| 30 | +} |
0 commit comments