CodeEditSourceEditor icon indicating copy to clipboard operation
CodeEditSourceEditor copied to clipboard

✨ Comment out highlighted code

Open jenslys opened this issue 3 years ago • 10 comments

Description

/ should allows users to toggle between commented and uncommented for the line the cursor is currently on when you press /.

If a selection is made on a single line, a range comment should be used.

Comment placement styles…

/* Xcode - At leading end of leading whitespace */
func hi() {
    print("Hi")
//    print("Hi")
}

/* Android Studio - Inset at leading end of leading whitespace */
func hi() {
    print("Hi")
//  print("Hi")
}

/* VS Code - At trailing end of leading whitespace */
func hi() {
    print("Hi")
    // print("Hi")
}

/* Inset at trailing end of leading whitespace */
func hi() {
    print("Hi")
 // print("Hi")
}

We should allow for all three styles via a Setting:

Comment Placement:

  • At leading end of leading whitespace
  • Inset at leading end of leading whitespace
  • At trailing end of leading whitespace
  • Inset at trailing end of leading whitespace

Describe the solution you'd like

Ability to comment out code by highlighting some code and pressing: /

Additional context

hightlight

jenslys avatar Apr 24 '22 09:04 jenslys

Hi, I would like to work on this issue as my first contribuition :)

guga1109 avatar May 24 '22 22:05 guga1109

@lukepistrol does this depend on the new editor being in place or can this be worked on now? Different languages have different ways of commenting code, so will this depend on tree sitter, language grammars, or the LSP?

austincondiff avatar May 25 '22 05:05 austincondiff

This should be implemented in CodeEditTextView directly.

lukepistrol avatar Jun 01 '22 23:06 lukepistrol

Can you assign this issue to me? I would like to start contributing to this project

crpatil1901 avatar Jan 18 '24 04:01 crpatil1901

Done! Let me know if you have any questions.

austincondiff avatar Jan 18 '24 05:01 austincondiff