Skip to content

Commit 1b5b9f7

Browse files
committed
Fix lack of trailing italics.
1 parent 236bc08 commit 1b5b9f7

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

src/OmniSharp.Roslyn.CSharp/Helpers/MarkdownHelpers.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,11 @@ public static void TaggedTextToMarkdown(
198198
endBlock();
199199
}
200200

201+
if (!brokeLine && markdownFormat == MarkdownFormat.Italicize)
202+
{
203+
stringBuilder.Append("_");
204+
}
205+
201206
return;
202207

203208
void addText(string text)

tests/OmniSharp.Roslyn.CSharp.Tests/QuickInfoProviderFacts.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,23 @@ public static void A()
709709
Assert.Equal("```csharp\nvoid Program.B()\n```\n\n\\*This should be escaped\\*", response.Markdown);
710710
}
711711

712+
[Fact]
713+
public async Task NullableIsItalicized()
714+
{
715+
string content = @"
716+
#nullable enable
717+
class Program
718+
{
719+
public static void A(string s)
720+
{
721+
_ = s$$;
722+
}
723+
724+
}";
725+
var response = await GetTypeLookUpResponse(content);
726+
Assert.Equal("```csharp\n(local) string? s\n```\n\n_'s' is not null here._", response.Markdown);
727+
}
728+
712729
private async Task<QuickInfoResponse> GetTypeLookUpResponse(string content)
713730
{
714731
TestFile testFile = new TestFile("dummy.cs", content);

0 commit comments

Comments
 (0)