Vscode: Empty Lines Not Getting Commented-Out

Created on 11 Jan 2020  路  10Comments  路  Source: microsoft/vscode

  • VSCode Version: 1.41.1
  • OS Version: Windows 10 64-bit

Steps to Reproduce:

  1. Sample code to be commented-out:
package com.mycompany.app;

public class MyApp {
    public static void main(String[] args) {
        SayHello();
    }

    static void SayHello() {
        System.out.println("Hello!");
    }
}
  1. Expected result:
// package com.mycompany.app;
// 
// public class MyApp {
//     public static void main(String[] args) {
//         SayHello();
//     }
// 
//     static void SayHello() {
//         System.out.println("Hello!");
//     }
// }
  1. Actual result:
// package com.mycompany.app;

// public class MyApp {
//     public static void main(String[] args) {
//         SayHello();
//     }

//     static void SayHello() {
//         System.out.println("Hello!");
//     }
// }

Does this issue occur when all extensions are disabled?: Yes

editor-comments feature-request insiders-released

Most helpful comment

@connor4312 I'm not going to request that this issue be reopened, but I would like to ask what benefits this gives developers.

When commenting-out lines of code, it helps that empty lines within your selections are commented-out to group commented sections together.

This makes it clear which lines need to be uncommented together when developers want to put them back.

Compare:

    // line 1
    // line 2
    // 
    // line 3
    // 
    // line 4

    // line 5
    // line 6
    // line 7
    // 
    // line 8
    // line 9
    // 
    // line 10

With:

    // line 1
    // line 2

    // line 3

    // line 4

    // line 5
    // line 6
    // line 7

    // line 8
    // line 9

    // line 10

_EDIT:_

In case this feature does get implemented, a setting can be added like "commenting.includeEmptyLines": true (with a default value of false).

This way, those who prefer to exclude empty lines from commenting will be unaffected.

All 10 comments

This is working as we intended it--empty lines don't get commented out.

The described behavior is how it is expected to work. If you disagree, please explain what is expected and what is not in more detail. See also our issue reporting guidelines.

Happy Coding!

@connor4312 I'm not going to request that this issue be reopened, but I would like to ask what benefits this gives developers.

When commenting-out lines of code, it helps that empty lines within your selections are commented-out to group commented sections together.

This makes it clear which lines need to be uncommented together when developers want to put them back.

Compare:

    // line 1
    // line 2
    // 
    // line 3
    // 
    // line 4

    // line 5
    // line 6
    // line 7
    // 
    // line 8
    // line 9
    // 
    // line 10

With:

    // line 1
    // line 2

    // line 3

    // line 4

    // line 5
    // line 6
    // line 7

    // line 8
    // line 9

    // line 10

_EDIT:_

In case this feature does get implemented, a setting can be added like "commenting.includeEmptyLines": true (with a default value of false).

This way, those who prefer to exclude empty lines from commenting will be unaffected.

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

:slightly_smiling_face: This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

This is causing major problems for me. Is there any way I can help make this happen?

@sunsp1der I think the code's been ready to merge for a while now, but I'm not sure why it hasn't yet.

@alvintangz, any updates on this issue? 馃檪

@FloatingSunfish you're right, it has been ready to merge for a while. All the CI tests passed and the assignee to the pull request from Microsoft hasn't looked at it.

Unfortunately, since the PR has been open for a while now, the new CI tests just failed. I'll need to fix this as soon as possible (hopefully this weekend) and then I'll mention the assignee in the pull request :shipit:

93160

Cheers,
Team DATA - @dharm1k987, @RhymeAccel, @privatejfx141, @jzp128

@alvintangz Many thanks for the quick reply! We're all thankful for all your hard work!
We look forward to using your feature soon! 馃槃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vsccarl picture vsccarl  路  3Comments

shanalikhan picture shanalikhan  路  3Comments

DovydasNavickas picture DovydasNavickas  路  3Comments

mrkiley picture mrkiley  路  3Comments

lukehoban picture lukehoban  路  3Comments