Skip to content

Commit

Permalink
Allow null langword fixer at the end of an XML tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Render committed Dec 22, 2024
1 parent 98ea496 commit 6647c17
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,25 @@ class C<TKey>
""");
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/76548")]
public async Task TestEndOfKeyword_XmlCloseTagFollowing()
{
await TestInRegularAndScriptAsync(
"""
/// <summary>Testing keyword null[||]</summary>
class C<TKey>
{
}
""",

"""
/// <summary>Testing keyword <see langword="null"/></summary>
class C<TKey>
{
}
""");
}

[Fact]
public async Task TestSelectedKeyword()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte
{
var (document, span, cancellationToken) = context;
var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
var token = root.FindToken(span.Start, findInsideTrivia: true);
var token = root.FindTokenFromEnd(span.Start, findInsideTrivia: true);

if (!IsXmlTextToken(token))
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,19 @@ class C(Of TKey)
end class")
End Function

<Fact, WorkItem("https://github.com/dotnet/roslyn/issues/76548")>
Public Async Function TestEndOfKeyword_XmlCloseTagFollowing() As Task
Await TestInRegularAndScriptAsync(
"
''' <summary>Testing keyword MustInherit[||]</summary>
class C(Of TKey)
end class",
"
''' <summary>Testing keyword <see langword=""MustInherit""/></summary>
class C(Of TKey)
end class")
End Function

<Fact>
Public Async Function TestSelectedKeyword() As Task
Await TestInRegularAndScriptAsync(
Expand Down

0 comments on commit 6647c17

Please sign in to comment.