Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix edge cases typing Enter before /**/ comments. #11073

Merged
merged 1 commit into from
May 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ private static bool IsCaretInsideBlockCommentSyntax(SnapshotPoint caretPosition)
var syntaxTree = document.GetSyntaxTreeAsync().WaitAndGetResult(CancellationToken.None);
var trivia = syntaxTree.FindTriviaAndAdjustForEndOfFile(caretPosition, CancellationToken.None);

return trivia.IsKind(SyntaxKind.MultiLineCommentTrivia) || trivia.IsKind(SyntaxKind.MultiLineDocumentationCommentTrivia);
var isBlockComment = trivia.IsKind(SyntaxKind.MultiLineCommentTrivia) || trivia.IsKind(SyntaxKind.MultiLineDocumentationCommentTrivia);
return isBlockComment && trivia.FullSpan.Start < caretPosition;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,62 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.BlockCommentEditing
{
public class BlockCommentEditingTests : AbstractBlockCommentEditingTests
{
[WorkItem(11057, "https://github.com/dotnet/roslyn/issues/11057")]
[WpfFact, Trait(Traits.Feature, Traits.Features.BlockCommentEditing)]
public async Task EdgeCase0()
{
var code = @"
$$/**/
";
var expected = @"

$$/**/
";
await VerifyAsync(code, expected);
}

[WorkItem(11057, "https://github.com/dotnet/roslyn/issues/11057")]
[WpfFact, Trait(Traits.Feature, Traits.Features.BlockCommentEditing)]
public async Task EdgeCase1()
{
var code = @"
/**/$$
";
var expected = @"
/**/
$$
";
await VerifyAsync(code, expected);
}

[WorkItem(11056, "https://github.com/dotnet/roslyn/issues/11056")]
[WpfFact, Trait(Traits.Feature, Traits.Features.BlockCommentEditing)]
public async Task EdgeCase2()
{
var code = @"
$$/* */
";
var expected = @"

$$/* */
";
await VerifyAsync(code, expected);
}

[WorkItem(11056, "https://github.com/dotnet/roslyn/issues/11056")]
[WpfFact, Trait(Traits.Feature, Traits.Features.BlockCommentEditing)]
public async Task EdgeCase3()
{
var code = @"
/* */$$
";
var expected = @"
/* */
$$
";
await VerifyAsync(code, expected);
}

[WpfFact, Trait(Traits.Feature, Traits.Features.BlockCommentEditing)]
public async Task InsertOnStartLine0()
{
Expand Down