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

* Update DefaultLSPTagHelperTooltipFactory.cs

- Make the tooltip show the full tagHelperTypeName instead of the reduced name in LSP factory. This method is used in both hover service and code completion service. I also made sure to make only the final tagHelperType name bold.

* Update  DefaultLSPTagHelperTooltipFactoryTest 

- changed three unit tests so we are testing for showing the full name space to reflect the desired behavior
This commit is contained in:
Jordi Ramos 2024-01-29 15:54:32 -08:00 коммит произвёл GitHub
Родитель cd121ffce7
Коммит 8742d80bf4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 12 добавлений и 4 удалений

Просмотреть файл

@ -51,6 +51,14 @@ internal class DefaultLSPTagHelperTooltipFactory(ISnapshotResolver snapshotResol
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);

Просмотреть файл

@ -92,7 +92,7 @@ World", cleanedSummary);
// 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);
@ -115,7 +115,7 @@ Uses `List<System.String>`s", markdown.Value);
// 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);
@ -166,11 +166,11 @@ Uses `List<System.String>`s", markdown.Value);
// 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);