Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-436

Please change behaviour of commenting lines

    XMLWordPrintableJSON

    Details

      Description

      Atm, if you hit a shortcut to comment a like, it will end up this:

      if(whatever) {
         if(again) {
            console.log(42);
      //    System.out.println(42);
         }
      }
      

      I know it is not the same lang but it doesn't matter. As you can see, it will comment the line, but it will start the comments still on column 1 and not where the code is. This is a pain in the ass, because if you reformat the code, it looks like this:

      if(whatever) {
         if(again) {
            console.log(42);
            //    System.out.println(42);
         }
      }
      

      and if you uncomment the line, it looks like this:

      if(whatever) {
         if(again) {
            console.log(42);
            System.out.println(42);
         }
      }
      

      and you have to reformat it again or move it into the right direction. I know that it was easy to add the comments in column 1 but no editor or IDE does this. In VS Code and the JetBrains family it looks like this:

      if(whatever) {
         if(again) {
            console.log(42);
            // System.out.println(42);
         }
      }
      

      Which is more right, it only adds "// " in front of the code and removes it again. So in my opinion this is way better and even correct. It keeps the indentation too so no need to worry after you reformat the code.

      Cheers

      Chris

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              chrizzly Christian Lenz
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: