Skip to content

Commit

Permalink
Merge pull request #1894 from 333fred/fix-italics
Browse files Browse the repository at this point in the history
Fix lack of trailing italics
  • Loading branch information
JoeRobich authored Aug 18, 2020
2 parents 07c6898 + 1738c27 commit b28a4ae
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/OmniSharp.Roslyn.CSharp/Helpers/MarkdownHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ public static void TaggedTextToMarkdown(
stringBuilder.Append('`');
}
stringBuilder.Append(current.Text);
brokeLine = false;
break;
}
}
Expand All @@ -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)
{
Expand Down
17 changes: 17 additions & 0 deletions tests/OmniSharp.Roslyn.CSharp.Tests/QuickInfoProviderFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<QuickInfoResponse> GetTypeLookUpResponse(string content)
{
TestFile testFile = new TestFile("dummy.cs", content);
Expand Down

0 comments on commit b28a4ae

Please sign in to comment.