Skip to content

Commit

Permalink
Merge pull request #69954 from dotnet/dev/jorobich/add-inlinehint-ran…
Browse files Browse the repository at this point in the history
…king

O# ExternalAccess: Provide InlineHint ranking to OmniSharp
  • Loading branch information
JoeRobich authored Sep 14, 2023
2 parents 1c4e67c + 5e583ef commit 71a7b5f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public static async Task<ImmutableArray<OmniSharpInlineHint>> GetInlineHintsAsyn
var hints = await service.GetInlineHintsAsync(document, textSpan, roslynOptions, displayAllOverride: false, cancellationToken).ConfigureAwait(false);
return hints.SelectAsArray(static h => new OmniSharpInlineHint(
h.Span,
h.Ranking,
h.DisplayParts,
h.ReplacementTextChange,
h.GetDescriptionAsync));
Expand All @@ -34,17 +35,20 @@ internal readonly struct OmniSharpInlineHint

public OmniSharpInlineHint(
TextSpan span,
double ranking,
ImmutableArray<TaggedText> displayParts,
TextChange? replacementTextChange,
Func<Document, CancellationToken, Task<ImmutableArray<TaggedText>>> getDescriptionAsync)
{
Span = span;
Ranking = ranking;
DisplayParts = displayParts;
ReplacementTextChange = replacementTextChange;
_getDescriptionAsync = getDescriptionAsync;
}

public readonly TextSpan Span { get; }
public readonly double Ranking { get; }
public readonly ImmutableArray<TaggedText> DisplayParts { get; }
public readonly TextChange? ReplacementTextChange { get; }

Expand Down
3 changes: 2 additions & 1 deletion src/Tools/ExternalAccess/OmniSharp/InternalAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.InlineHints.OmniSharpInlineHint
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.InlineHints.OmniSharpInlineHint.DisplayParts.get -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.TaggedText>
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.InlineHints.OmniSharpInlineHint.GetDescriptionAsync(Microsoft.CodeAnalysis.Document! document, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.TaggedText>>!
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.InlineHints.OmniSharpInlineHint.OmniSharpInlineHint() -> void
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.InlineHints.OmniSharpInlineHint.OmniSharpInlineHint(Microsoft.CodeAnalysis.Text.TextSpan span, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.TaggedText> displayParts, Microsoft.CodeAnalysis.Text.TextChange? replacementTextChange, System.Func<Microsoft.CodeAnalysis.Document!, System.Threading.CancellationToken, System.Threading.Tasks.Task<System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.TaggedText>>!>! getDescriptionAsync) -> void
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.InlineHints.OmniSharpInlineHint.OmniSharpInlineHint(Microsoft.CodeAnalysis.Text.TextSpan span, double ranking, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.TaggedText> displayParts, Microsoft.CodeAnalysis.Text.TextChange? replacementTextChange, System.Func<Microsoft.CodeAnalysis.Document!, System.Threading.CancellationToken, System.Threading.Tasks.Task<System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.TaggedText>>!>! getDescriptionAsync) -> void
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.InlineHints.OmniSharpInlineHint.Ranking.get -> double
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.InlineHints.OmniSharpInlineHint.ReplacementTextChange.get -> Microsoft.CodeAnalysis.Text.TextChange?
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.InlineHints.OmniSharpInlineHint.Span.get -> Microsoft.CodeAnalysis.Text.TextSpan
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.InlineHints.OmniSharpInlineHintsOptions
Expand Down

0 comments on commit 71a7b5f

Please sign in to comment.