dotnet / dotnet/roslyn

Behavior of Edit.WordDeleteToEnd on single-line C# comment has changed

Open
#77,523 4 comments 0 reactions 0 assignees View on GitHub
Area-IDE
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

_This issue has been moved from [a ticket on Developer Community](https://developercommunity.visualstudio.com/t/Behavior-of-EditWordDeleteToEnd-on-sing/10862435)._

---
\[severity:It bothers me. A fix would be nice\] \[regression\] \[worked-in:16.11.4 for sure, not sure about VS2022\]
Previously, using Edit.WordDeleteToEnd (typically Ctrl+Del) with the cursor at the “//” of a single-line C# comment would delete the comment marks and spaces preceding the first word in the comment. E.g. if invoked on the line (^ indicates cursor position)

`^// This is a comment`

Ctrl+Del would yield

`This is a comment`

In recent versions of Visual Studio 2022 (I don’t remember exactly which version), this behavior has changed and in that situation the command now deletes the entire line. This happens only when the cursor is immediately before the “//” of the comment, if placed elsewhere the behavior is unchanged.

There is an analogous change in the behavior with a multi-line (/\* \*\/) comment, in this case if the cursor is positioned immediately preceding the "\/\/", Edit.WordDeleteToEnd results in the entire comment being deleted.

I have gotten used to using Ctrl-Del to remove comment marks, and whether by design or not, this change is very inconvenient. I have not found another command to achieve the previous behavior. Can the previous behavior either be restored, or can we have an alternative command that implements the previous behavior?

---
### Original Comments

#### Feedback Bot on 3/3/2025, 06:55 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

#### Feedback Bot on 3/11/2025, 07:33 AM:

This issue is currently being investigated. Our team will get back to you if either more information is needed, a workaround is available, or the issue is resolved.

Contributor guide

Open the contributing guide

Research direction

Reproduce the behavior in Visual Studio 2022 with Edit.WordDeleteToEnd (typically Ctrl+Del) at the start of single-line and multi-line C# comments. Compare the current deletion with the documented prior behavior, and consider the issue complete when the previous behavior is restored or an alternative command provides it.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.