-
Notifications
You must be signed in to change notification settings - Fork 6
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
Commenting out code #53
Comments
Interesting ideas. 99% of the time when I use
|
After using genemichaels for a while now, I have acquired a feel for what I like about formatting code and what I think genemichaels does best: it makes editing code easier. Given this, I personally think formatted comments should be opt-in, ie Docu-comments already entail writing in a special style, and typically one doesn't write a docu-comment then comment it out- they add newlines one at a time and type Even remembering to add the dot, it has to then be manually removed when the code is enabled again, incurring a second time penalty and detracting from my personal workflow. Meanwhile, I will never "de-comment" a docu-comment. I recommend pushing this overhead to docu-comments rather than code-disabling comments in order to enable a smoother workflow experience with genemichaels formatter. |
I think that's a good point, that while It's not entirely straightforward, there's a couple subtasks:
I'll make subissues for those. I'm not 100% sure how much time I'll have to work on them in the short term but I think they're reasonable requests and it won't make the codebase significantly more difficult to maintain. |
Remember that /* */ in Rust can be nested, it is horrible to work with in Java where they can't whenever you run into it. |
The convention I always use is that the first line of code in // comments has no space or more than one space in between the // and the code, while docs always have a single space. There is also the triple quote code block case where you want to apply this recursively to the code inside which can have /// // A good stress test is with https://github.com/AaronKutch/awint which has almost every kind of commenting. There might be a few places where I'm not following my own rules but the vast majority should be representative.
|
The main issue is that right now genemichaels treats |
I misread your entire comment earlier. Would this be a switch in the config? That's an acceptable compromise. Would it be too much to ask for "format prefixes" (ie only format comments with |
Oh yeah, sorry, I should have been more clear. Re: prefixes, so you want to have formatted non-doc comments but just have the default be unformatted? I think that's reasonable. It should probably be something other than I'll see if I can add the switch for that tomorrow, maybe release the fix for the macros at the same time. |
That sounds amazing! And if you don't want to leave it up to the user, might I recommend |
Not the whole thing, just the |
Okay have an mr for #103 (should be linked there), 104 will be a bit harder although I have an idea how it could be done now. |
The basic issue is
//
is ambiguous to whether what follows is for humans (markdown) or commenting out code (literal). So I chose the human one, since the former needs automatic formatting (and this project's all about formatting things automatically) and the latter is I feel probably rarer and kind of a WIP hack thing so I thought it was less important.One option is to treat
/*
as verbatim, but editors that have a hotkey for commenting blocks of code vary in whether they do//
or/*
which reduces the effectiveness, and it's not like people can't use/*
for human comments either.My current solution is I introduced a new
//.
verbatim comment style, but another solution would be good. At the very least adding/*.
for consistency would probably be a good move.This issue is about coming up with a full solution though.
The text was updated successfully, but these errors were encountered: