CodeEditApp / CodeEditSourceEditor

A code editor view written in Swift powered by tree-sitter.
https://codeeditapp.github.io/CodeEditSourceEditor/documentation/codeeditsourceeditor
MIT License
517 stars 84 forks source link

✨ Comment out highlighted code #38

Open jenslys opened 2 years ago

jenslys commented 2 years ago

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:

Describe the solution you'd like

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

Additional context

hightlight

guga1109 commented 2 years ago

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

austincondiff commented 2 years ago

@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?

lukepistrol commented 2 years ago

This should be implemented in CodeEditTextView directly.

crpatil1901 commented 9 months ago

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

austincondiff commented 9 months ago

Done! Let me know if you have any questions.

Sophiahooley commented 7 months ago

How is this going @crpatil1901 @austincondiff? I would be interesting in working on this also if no solution has been found yet.

austincondiff commented 7 months ago

@Sophiahooley I can assign it to you. This related PR is about to be merged just so you are aware.

Sophiahooley commented 6 months ago

Do you know if the PR is going to be merged soon? I am trying to see if I should start working now or if the related PR will completely change what I do.

austincondiff commented 5 months ago

Can we close this or do we still need to update CESE version in CodeEdit?

thecoolwinter commented 5 months ago

Still need to update, and this is 1/2 done. Still needs multi-line commenting implemented as well as detecting comment type in context.