public async Task Handle_Resolve_TagHelperAttribute_ReturnsCompletionItemWithDocumentation() { // Arrange var lspDescriptionFactory = new Mock <LSPTagHelperTooltipFactory>(MockBehavior.Strict); var markdown = new MarkupContent { Kind = MarkupKind.Markdown, Value = "Some Markdown" }; lspDescriptionFactory.Setup(factory => factory.TryCreateTooltip(It.IsAny <AggregateBoundAttributeDescription>(), MarkupKind.Markdown, out markdown)) .Returns(true); var endpoint = new RazorCompletionResolveEndpoint(lspDescriptionFactory.Object, VSLSPTagHelperTooltipFactory, CompletionListCache, LoggerFactory); endpoint.GetRegistration(DefaultClientCapability); var razorCompletionItem = new RazorCompletionItem("TestItem", "TestItem", RazorCompletionItemKind.TagHelperAttribute); razorCompletionItem.SetAttributeCompletionDescription(new AggregateBoundAttributeDescription(Array.Empty <BoundAttributeDescriptionInfo>())); var completionList = CreateLSPCompletionList(new[] { razorCompletionItem }); var completionItem = completionList.Items.Single(); var parameters = ConvertToBridgedItem(completionItem); // Act var newCompletionItem = await endpoint.Handle(parameters, default); // Assert Assert.NotNull(newCompletionItem.Documentation); }
public async Task Handle_Resolve_MarkupTransitionCompletion_ReturnsCompletionItemWithDocumentation() { // Arrange var endpoint = new RazorCompletionResolveEndpoint(LSPTagHelperTooltipFactory, VSLSPTagHelperTooltipFactory, CompletionListCache, LoggerFactory); endpoint.GetRegistration(DefaultClientCapability); var razorCompletionItem = new RazorCompletionItem("@...", "@", RazorCompletionItemKind.MarkupTransition); razorCompletionItem.SetMarkupTransitionCompletionDescription(new MarkupTransitionCompletionDescription("Test description")); var completionList = CreateLSPCompletionList(new[] { razorCompletionItem }); var completionItem = completionList.Items.Single(); var parameters = ConvertToBridgedItem(completionItem); // Act var newCompletionItem = await endpoint.Handle(parameters, default); // Assert Assert.NotNull(newCompletionItem.Documentation); }
public async Task Handle_Resolve_NonTagHelperCompletion_Noops() { // Arrange var lspDescriptionFactory = new Mock <LSPTagHelperTooltipFactory>(MockBehavior.Strict); var markdown = new MarkupContent { Kind = MarkupKind.Markdown, Value = "Some Markdown" }; lspDescriptionFactory.Setup(factory => factory.TryCreateTooltip(It.IsAny <AggregateBoundElementDescription>(), MarkupKind.Markdown, out markdown)) .Returns(true); var endpoint = new RazorCompletionResolveEndpoint(LSPTagHelperTooltipFactory, VSLSPTagHelperTooltipFactory, CompletionListCache, LoggerFactory); endpoint.GetRegistration(DefaultClientCapability); var completionItem = new CompletionItem(); var parameters = ConvertToBridgedItem(completionItem); // Act var newCompletionItem = await endpoint.Handle(parameters, default); // Assert Assert.Null(newCompletionItem.Documentation); }