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
Creating a user defined snippet config file produces a broken file by default #2648
Comments
OK, I confirm this if the comment marker is set to a single space However, there indeed is a bug here; it looks like we're using the toggle comment feature, which has the side effect of possibly uncommenting lines, which is not wanted here. |
Well the toggle comment feature will only toggle comments with the comment marker in them, hence so long as its not space (as you identified) it will leave existing comments alone and simply comment all the uncommented lines, which is what we want. IIRC the discussions at the time, toggle comment was used so selected ranges can be uncommented easily in the resulting file without removing the original comments. But basically if the toggle comment character is set to space the whole toggle comment feature is broken everywhere, not just here. Thats a user problem (most likely a misunderstanding of how "toggle comment" differs from comment/uncomment). |
How so? It works fine when triggered, and leads to inserting what looks like a regular comment.
Fair enough, but we should make sure we only ever toggle on, e.g. consider all lines uncommented no matter what. |
You basically said it in the following sentence, the feature is for toggling blocks of code on/off during development without worrying about internal comments, its not for setting/unsetting comments for permanent use, which is why I made the note about users misunderstanding the feature and breaking it by setting the marker to something common in normal comments, like space. Perhaps the feature should be renamed so it isn't the same as comment/uncomment in other editors, so users don't assume its the same without understanding it.
Well, in this use that is all we need, so (without looking at how complex it is) we could add an extra parameter to the toggle comment code to limit it to on for uncommented lines only. Or make a separate function, YMMV.
Won't that double comment comments which is sure to cause issues full of commented comments comments. 😁 |
Well, IMO that's one possible usage of it (admittedly, the expected one), but it doesn't strike me as "wrong" to use it some other way.
Well, currently that's the case: lines commented get extra comment prefix, looking like |
Well, its the usage for which the feature is designed, if it is used in unintended ways and doesn't work that is not a bug. And since the feature expects a unique(ish) toggle marker it breaks this config file toggle feature. Using space for the toggle marker will likely uncomment comments inside the selection, but I guess if thats what the user expects its ok for them, they just have to be careful which lines they select.
Ahh, after RTFC the skipping comments only happens on languages that have multi-line comments so they don't try to nest. So it basically seems to me that there needs to be specific code for commenting Geany config files (which we know to be |
Agreed. My point was that it's perfectly OK to have whatever marker one on wants, and it shouldn't break the feature here. If it's not convenient for the user is not our problem, it's the user's; but if we let the user select a marker, it should not break anything (or we should forbid it). And in any case, relying on the marker not creating conflicts is IMO too optimistic for anything but user calling the feature and having a chance to see if it's wrong. |
Yes, I noticed that there is only one toggle comment marker, not one per filetype as I first thought. Given the increasing popularity of doc comments that use extra characters after the comment token to signify stuff for docomment purposes there is every chance one day different languages will need different toggle markers, but thats another issue, not this one. |
Geany version: 1.36
Attempting to create a
snippets.conf
by Tools -> Configuration Files -> snippets.conf brings up a file with comments that are all inverted.This makes it look like comment characters are required to define snippets.
The text was updated successfully, but these errors were encountered: