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

Uncomments real comments #291

Open
jalbalah opened this issue Mar 15, 2017 · 2 comments
Open

Uncomments real comments #291

jalbalah opened this issue Mar 15, 2017 · 2 comments

Comments

@jalbalah
Copy link

jalbalah commented Mar 15, 2017

Unfortunately the "toggle comment" shortcut uncomments existing comments.

E.g. toggling

if true:
    //comment
   foo();

-->

//if true:
    comment
    //foo();

This is an issue for any code with comments!
An ideal solution is un/commenting the way SlickEdit IDE works... recognizing start-line comments...
-->

// if true:
//     //comment
//     foo();

Here the commenter recognizes slash-slash-space at start of line.

Thanks!

@alerque
Copy link
Member

alerque commented Mar 15, 2017

Pardon me if I'm being dense, but I honestly don't see how this is unfortunate at all. It's done exactly what you asked it to and toggled the commented or not commented status of each line. This is a feature I use to my advantage, not one I would envision being a problem. If you have a block of mixed-format content and want to do something specific with it, why not use the comment function instead of the toggle function?

@jalbalah
Copy link
Author

jalbalah commented Mar 15, 2017

Personally, I prefer a "real toggle", but your solution of breaking the toggle into two steps (comment and uncomment) is apparently also buggy with the functions I tried.
What comment function would work?

Doing \ci then \cu has the same problem...
Doing \c<space> then \cu kind of works, unless the first line selected is a comment...

How do you comment using only // per line, then uncomment, without erasing existing comments?
Goal:

//comment
foo();

-->

////comment
//foo();

...
Note: Of course, \cc and \cu work, but they use block comments, which unfortunately cannot nest.
What I mean by nested comments by example:

#include<iostream>
using namespace std;
int main() {
  /*
   /**/
   */
  cout << "Hello World!" << endl;
  return 0;
}

Error: junk.cpp:6: error: expected primary-expression before ‘/’ token

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

No branches or pull requests

2 participants