From 02697dcec7d818e71f95941950e244275f1c737d Mon Sep 17 00:00:00 2001 From: Fredric Silberberg Date: Mon, 17 Aug 2020 15:58:42 -0700 Subject: [PATCH] Fix lack of trailing italics. --- .../Helpers/MarkdownHelpers.cs | 7 +++++++ .../QuickInfoProviderFacts.cs | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/OmniSharp.Roslyn.CSharp/Helpers/MarkdownHelpers.cs b/src/OmniSharp.Roslyn.CSharp/Helpers/MarkdownHelpers.cs index 523929a766..56392a366c 100644 --- a/src/OmniSharp.Roslyn.CSharp/Helpers/MarkdownHelpers.cs +++ b/src/OmniSharp.Roslyn.CSharp/Helpers/MarkdownHelpers.cs @@ -189,6 +189,7 @@ public static void TaggedTextToMarkdown( stringBuilder.Append('`'); } stringBuilder.Append(current.Text); + brokeLine = false; break; } } @@ -198,10 +199,16 @@ public static void TaggedTextToMarkdown( endBlock(); } + if (!brokeLine && markdownFormat == MarkdownFormat.Italicize) + { + stringBuilder.Append("_"); + } + return; void addText(string text) { + brokeLine = false; afterFirstLine = true; if (!isInCodeBlock) { diff --git a/tests/OmniSharp.Roslyn.CSharp.Tests/QuickInfoProviderFacts.cs b/tests/OmniSharp.Roslyn.CSharp.Tests/QuickInfoProviderFacts.cs index c25bbe27e3..cc386326a9 100644 --- a/tests/OmniSharp.Roslyn.CSharp.Tests/QuickInfoProviderFacts.cs +++ b/tests/OmniSharp.Roslyn.CSharp.Tests/QuickInfoProviderFacts.cs @@ -709,6 +709,23 @@ public static void A() Assert.Equal("```csharp\nvoid Program.B()\n```\n\n\\*This should be escaped\\*", response.Markdown); } + [Fact] + public async Task NullableIsItalicized() + { + string content = @" +#nullable enable +class Program +{ + public static void A(string s) + { + _ = s$$; + } + +}"; + var response = await GetTypeLookUpResponse(content); + Assert.Equal("```csharp\n(parameter) string s\n```\n\n_'s' is not null here\\._", response.Markdown); + } + private async Task GetTypeLookUpResponse(string content) { TestFile testFile = new TestFile("dummy.cs", content);