Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tooltip fix for hover and code completion on VS code #9862

Merged
merged 5 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ public override bool TryCreateTooltip(

var tagHelperType = descriptionInfo.TagHelperTypeName;
var reducedTypeName = ReduceTypeName(tagHelperType);

// If the reducedTypeName != tagHelperType, then the type is prefixed by a namespace
if (reducedTypeName != tagHelperType)
{
descriptionBuilder.Append(tagHelperType[..^reducedTypeName.Length]);
}

// We make the reducedTypeName bold while leaving the namespace intact
StartOrEndBold(descriptionBuilder, markupKind);
descriptionBuilder.Append(reducedTypeName);
StartOrEndBold(descriptionBuilder, markupKind);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void TryCreateTooltip_Markup_Element_SingleAssociatedTagHelper_ReturnsTru

// Assert
Assert.True(result);
Assert.Equal(@"**SomeTagHelper**
Assert.Equal(@"Microsoft.AspNetCore.**SomeTagHelper**

Uses `List<System.String>`s", markdown.Value);
Assert.Equal(MarkupKind.Markdown, markdown.Kind);
Expand All @@ -115,7 +115,7 @@ public void TryCreateTooltip_Markup_Element_PlainText_NoBold()

// Assert
Assert.True(result, "TryCreateTooltip should have succeeded");
Assert.Equal(@"SomeTagHelper
Assert.Equal(@"Microsoft.AspNetCore.SomeTagHelper

Uses `List<System.String>`s", markdown.Value);
Assert.Equal(MarkupKind.PlainText, markdown.Kind);
Expand Down Expand Up @@ -166,11 +166,11 @@ public void TryCreateTooltip_Markup_Element_MultipleAssociatedTagHelpers_Returns

// Assert
Assert.True(result);
Assert.Equal(@"**SomeTagHelper**
Assert.Equal(@"Microsoft.AspNetCore.**SomeTagHelper**

Uses `List<System.String>`s
---
**OtherTagHelper**
Microsoft.AspNetCore.**OtherTagHelper**

Also uses `List<System.String>`s", markdown.Value);
Assert.Equal(MarkupKind.Markdown, markdown.Kind);
Expand Down