In FolderView : Comment Out Selected Lines Does Not Work
In both C# and VB.NET, I cannot comment out selected lines, either by keyboard shortcut (Ctrl+K, Ctrl+C) or by menu button/command. I also cannot format the document, again either by keyboard shortcut (Ctrl+K, Ctrl+D) or by menu button/command.
I am running Visual Studio Enterprise 2017 15.1 (26403.3) on an x64 machine, Windows 10 1703 (15063.138).
This issue has been moved from https://developercommunity.visualstudio.com/content/problem/43554/comment-out-selected-lines-does-not-work.html VSTS ticketId: 418523 These are the original issue comments:
Skyler Sedate on 4/12/2017, 00:32 PM (432 days ago):
I realize now that I was in "Folder View", even though I had the code file open and was editing it. Once I opened the solution, everything started working as expected. Not sure if this is a bug, or a feature.
Visual Studio Team on 4/14/2017, 02:28 PM (429 days ago): Thank you for your feedback! This is expected behaviour ...Designer category doesn't work very well in folder view. Adding the request in our backlog to see if we can improve the experience.
rymorris [MSFT] on 5/7/2018, 01:53 PM (41 days ago): Ctrl-k, Ctrl-c is not working on C# files to comment the selection. These are the original issue solutions: (no solutions)
Repro steps
- Create a console Application ( .net core)
- Make sure Comment/Uncomments are working
- Close the solution
- Open the same via File -> Open -> Folder
- check if comment/Uncomment works
Actual
- Currently its not working
I've got the same problem : I can't comment or uncomment code or format it.
I'm working with a web app .net core 2.0, and sometimes when i'm working inside of views my comment function stop working. however when i'm in a controller or a model it seems it's always fine, I've got no problem at all.
On this picture I can format or comment
But on the second I can't, note the line that disapear..
this is Jquery code in cshtml view
I have a similar issue - but with C#. The comment / uncomment shortcut keys (or when selected from the menu) don't work in C# - but they DO work with typescript, SQL, etc.
Also - Format Document doesn't work
FormatDocument would potentially be hard to provide (unless you have a .editorconfig), because it's not clear what formatting options should be used. Comment/Uncomment should be allowed though.
@jinujoseph I don't repro this myself. Even when i open a C# file from "Open Folder" i.e.:

I'm still able to comment/uncomment selected lines.
I've always open my project with Open --> folder I don't think it matters
This is still an issue. Oddly, in 'Quick Actions' window, I can see that my code is commented! Just not in the real code.
I'm seeing the same issue of today 2020/10/19. Any suggestion on how to recover?
Still an issue in Community Edition in 2022 for me in the editor.
Still an issue in Community Edition in 2022 for me in the editor.
Same for me, enterprise version.
Closing out as no repro for c#. If you're having an issue with another language (likke teh javascript examples above), then that's not roslyn.