X-Sharp / XSharpPublic

Public repository for the source code for the XSharp Compiler, Runtime, Project System and Tools.
Apache License 2.0
113 stars 38 forks source link

[VS Integration]The “Uncomment Selected Lines” button in the toolbar does not work for single-line comments. #1617

Open vfp9 opened 2 weeks ago

vfp9 commented 2 weeks ago

To Reproduce Steps to reproduce the behavior:

  1. Select a line of code and click the “Comment Selected Line” button on the toolbar.
  2. Selecting the code that has just been commented and clicking the “Uncomment Selected Lines” button will not uncomment it.
RobertvanderHulst commented 2 weeks ago

Which version of X#? And which version of Visual Studio? Over here it works with VS 17.11.5 and X# 2,21.0.3, which will be released soon. It even works when the cursor is on the line and nothing is selected. I am using the menu options "Comment Selection" and "Uncomment Selection"

vfp9 commented 2 weeks ago

Visual Studio(Ver 17.11.5) and X# (Ver 2.21.0.3)

By “Select a line of code”, I mean, select a line of code(Just like selecting multiple lines of code), not “cursor is on the line and nothing is selected”.

RobertvanderHulst commented 1 week ago

Can you record a video to show what you're doing?

cpyrgas commented 1 week ago

If I understood correctly:

  1. type in an empty line:

sometext

  1. Select the whole word and choose comment, this puts block comments around the word

/*sometext*/

  1. Select again the full line, including the / / markers and choose uncomment, nothing happens, I assume because the caret is at the very end or very beginning of the line

  2. In order for the text to be actually uncommented, the caret needs to be put inside the block comment and then choose uncomment

vfp9 commented 1 week ago

cpyrgas, Your understanding is correct.!

RobertvanderHulst commented 1 week ago

Ok, but what do you expect to happen for a line of code like this, where the cursor is positioned at the start of the line

   x := Left( /*comment1*/ somevar, /*comment2*/ 10)

Should both comments be uncommented?

The idea behind the current behavior is:

This is also what the C# language service does for uncommenting.

vfp9 commented 1 week ago

Robert,I see no problem with handling it that way.