-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify inline hint tagging and fix duplicated tags. (#76525)
- Loading branch information
Showing
9 changed files
with
181 additions
and
192 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
src/EditorFeatures/Core.Wpf/InlineHints/CachedAdornmentTagSpan.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// 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.VisualStudio.Text.Editor; | ||
using Microsoft.VisualStudio.Text.Formatting; | ||
using Microsoft.VisualStudio.Text.Tagging; | ||
|
||
namespace Microsoft.CodeAnalysis.Editor.InlineHints; | ||
|
||
internal partial class InlineHintsTaggerProvider | ||
{ | ||
/// <summary> | ||
/// The computed adornment tag for an inline hint, along with information needed to determine if it can be reused. | ||
/// This is created and cached on <see cref="InlineHintDataTag{TAdditionalInformation}.AdditionalData"/> on demand | ||
/// so that we only create adornment tags once and reuse as long as possible. | ||
/// </summary> | ||
/// <param name="classified">Whether or not the adornment tag was classified. If the option for this changes, this | ||
/// cached tag should not be reused.</param> | ||
/// <param name="format">The text formatting used to create the hint. If this format no longer matches the current | ||
/// formatting, this should not be reused.</param> | ||
/// <param name="adornmentTagSpan">The actual adornment tag to render.</param> | ||
private sealed class CachedAdornmentTagSpan( | ||
bool classified, | ||
TextFormattingRunProperties format, | ||
TagSpan<IntraTextAdornmentTag> adornmentTagSpan) | ||
{ | ||
public bool Classified { get; } = classified; | ||
public TextFormattingRunProperties Format { get; } = format; | ||
public TagSpan<IntraTextAdornmentTag> AdornmentTagSpan { get; } = adornmentTagSpan; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.