roslyn icon indicating copy to clipboard operation
roslyn copied to clipboard

In FolderView : Comment Out Selected Lines Does Not Work

Open vsfeedback opened this issue 7 years ago • 10 comments

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)

vsfeedback avatar Jun 18 '18 19:06 vsfeedback

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

jinujoseph avatar Jun 18 '18 19:06 jinujoseph

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 image But on the second I can't, note the line that disapear.. image this is Jquery code in cshtml view

aguayUmbt avatar Aug 07 '18 19:08 aguayUmbt

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

jtpolizzi avatar Aug 09 '18 19:08 jtpolizzi

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.

CyrusNajmabadi avatar Aug 10 '18 04:08 CyrusNajmabadi

@jinujoseph I don't repro this myself. Even when i open a C# file from "Open Folder" i.e.:

image

I'm still able to comment/uncomment selected lines.

CyrusNajmabadi avatar Aug 10 '18 04:08 CyrusNajmabadi

I've always open my project with Open --> folder I don't think it matters

aguayUmbt avatar Aug 10 '18 12:08 aguayUmbt

This is still an issue. Oddly, in 'Quick Actions' window, I can see that my code is commented! Just not in the real code.

mayoevelyn avatar Feb 24 '20 23:02 mayoevelyn

I'm seeing the same issue of today 2020/10/19. Any suggestion on how to recover?

nevsaynev avatar Oct 20 '20 00:10 nevsaynev

Still an issue in Community Edition in 2022 for me in the editor.

GalGreenfield avatar Jul 08 '22 23:07 GalGreenfield

Still an issue in Community Edition in 2022 for me in the editor.

Same for me, enterprise version.

phochstrasser avatar Aug 18 '24 10:08 phochstrasser

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.

CyrusNajmabadi avatar Nov 06 '24 02:11 CyrusNajmabadi