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

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

Open
vfp9 opened this issue Oct 29, 2024 · 7 comments
Assignees

Comments

@vfp9
Copy link
Contributor

vfp9 commented Oct 29, 2024

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
Copy link
Member

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
Copy link
Contributor Author

vfp9 commented Oct 29, 2024

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
Copy link
Member

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

@cpyrgas
Copy link

cpyrgas commented Oct 30, 2024

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
Copy link
Contributor Author

vfp9 commented Oct 30, 2024

cpyrgas, Your understanding is correct.!

@RobertvanderHulst
Copy link
Member

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:

  • if the line starts with // or && then the whole line is uncommented regardless of where the cursor is located, as long as the cursor is on that line
  • if the line contains a /* ... */ then the block where the cursor is located is uncommented

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

@vfp9
Copy link
Contributor Author

vfp9 commented Oct 30, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants