Since Geany 2.0 has recently been released I decided to switch back to it from Kate. I used to like Geany but it had some problems I couldn’t quite remember.

So I quickly remembered the problem. I can’t figure out how to configure it to properly comment and comment blocks of code. Say you have the following in a file of type shell script:

	# a comment
	echo $variable

I want to be able to select the above lines and use a keybinding to comment them out, so the result would be:

	## a comment
	#echo $variable

Edit > Format > Comment Lines works as anticipated.

But if I decide I want the lines back, how do that with the same keybinding? Using Comment Lines again adds a second level of comments, which is what I would expect (but not what I want):

	### a comment
	##echo $variable

Edit > Format > Toggle Line Commentation works and the file returns to the original state. But if you reselect the original lines and run it again, you get

	 a comment
	#echo $variable

Which would obviously lead to unpredictable results.

There doesn’t seem to be a way for Geany to look at the block of text and decide whether it should be commented or uncommented and act accordingly.

Kate editor has this functionality in Selection > Toggle Comment as do other editors I’ve encountered. If there is a mix of commented and uncommented text, it will never remove comments. It only removes comments when the entire block has commenting, and then it removes only 1 level of comments. Perfect. Of course if you really want to force the matter, there are the more aggressive Comment and Uncomment.

Using the Geany Toggle Line Commentation leads to strange results, especially if you are starting with multiple levels of comments. Is there a way to duplicate the standard comment toggle in Geany? I tried to train myself to use Comment Line(s) and Uncomment Lines(s) instead of a single command but I just made a lot of mistakes where I didn’t realize there were multiple levels of comments or whatever and things became uncommented that shouldn’t have and it created a giant mess.

I’m not a professional IT person, just someone who enjoys text files in their spare time. I do a lot of commenting and uncommenting trying to find out how things work. I thought it was a pretty normal thing to do. There must be a way to do it right?

I recall digging around a bunch in the Geany repo/docs and it ended up that some problem I was having was a limitation of the Scintilla lexer and there wasn’t much Geany could do about it. But I am not sure if it was this issue or something else.

  • russjr08@outpost.zeuslink.net
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 year ago

    I can’t speak for all developers, but personally I’d rather have a bug report that isn’t actually a bug, but rather a user error over nothing at all. Because that means that my expectation of how others might use a feature could be incorrect which is a bug to me - just not a programmatic bug.

    Some developers may of course not be as of appreciative of it, but I’d say so long as you have a cursory look at their issue tracker and no one else has reported it, then I’d say its worth it.

    • crank@beehaw.orgOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      OK I went to their tracker. Which jogs my memory even further on why I gave up on it and am unmotivated to open issues in this case.

      Here is a similar but not exactly the same issue: Tool to Comentent lines fail and can be more elegant · Issue #3554 · geany/geany. I suspect my issue is probably related to theirs. The developer response is:

      Since nobody has asked for this formatting before (@osergioabreu you did search for existing open or closed issues before you raised this didn’t you? 😁) users either don’t care because they only use it to temporarily comment out code and will remove it quickly, or they like it like that.

      So if “somebody” made a pull request which made the formatting an option it likely would be accepted so both tastes are accommodated.

      Or it was put in a plugin (if it isn’t in one already?)

      1. If my request is unique they are not interested because if it was important someone would already have posed it. If it isn’t unique than it would be a duplicate anyway. Unlike my problem, this issue #3554 is a real bug. The feature simply fails to work even on its own logic because it produces comments in such a way that the application itself does not recognize as comments. So impossible to later uncomment!

      2. They are basically open to PRs rather than suggestions. It isn’t just this particular case; it is the project as a a whole. It is a tool with a primary user base of developers so it is expected that many users will have the ability to do this. So-called “do-ocracy” I’ve heard described elsewhere. Which, fair enough, it is a FLOSS project and they have no responsibility to cater to me. I always am grateful for FLOSS developers and respect the right to runt heir project as they see fit. However I have no capacity to make a PR.

      3. Like me this dev wonders if it is a plugin. Also like me doesn’t have a way of finding out because the plugins are poorly described.

      Obviously we do not know each other but I will say that I have opened lots of issues like this in the past and will do so in the future. I don’t need a push to do it. That said, I appreciate the encouragement because for a long time I would never open issues and lots of people feel intimidated to do so. As I got more into FLOSS I came to understand that there is a sort of responsibility from users to give useful and constructive feedback to developers. And I have been blown away at how receptive developers are to my feedback, especially knowing that 90% of them are doing it on their own time. It really changes the way I look at commercial software when I have to use it at work. :) Where the relationship is transactional between my employer and the developers, rather than reciprocal between myself and the developers. My expectations are now so high based on FLOSS that commercial software seems so deficient. All that to say I understand what you are getting at.

      However I have also learned to evaluate the project prior to engaging with it to determine if my contribution would be welcome. When I am not the target user of the project, I find I am often wasting everyone’s time. The target user of this project is programmers.

      So in this case a forum post is more appropriate because the odds of a solution from the devs are like 1%. Maybe I will make an issue next time I’m logged in to github idk.

      A forum is a good place to learn from other users about undocumented features, or maybe there is a plugin someone knows about. That would actually be helpful.

      • russjr08@outpost.zeuslink.net
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        That’s plenty fair enough, and I apologize for not looking into their issues to see what their receptiveness was like - I originally replied while I was at work and my break was unfortunately coming to an end or else I probably would’ve caught that and not mentioned it, whoops!

        In retrospect I should’ve known, I forgot that Geany is a GNOME project and… well, they have a bit of a reputation for uh… let’s just say that I myself am always hesitant to submit bug reports myself. It’s a tough one, because I try to play devil’s advocate on why they tend to be like that and had even commented yesterday on a video about GNOME devs always getting a lot of hostility. On one hand, there’s certainly a reason why they tend to have that response, but it’s still a bad sign when it starts to color their whole team since I know there are plenty of devs there who don’t have that sort of response.

        Either way, I apologize if it came off pushy - it was definitely intended to be more on the encouragement side of things rather than a firm “you must do it!” so I hope that’s not how it translated to everyone else.

        For what it’s worth, I still believe that what you’ve run into is a bug based on my own guidelines of “it doesn’t have to be a programatic bug and can wholly be a UX/expectation bug” - it doesn’t seem that this dev has the same methodology which don’t get me wrong, that’s plenty fair enough - but they could’ve replied a bit more gracefully because otherwise it causes this exact problem, not only for Geany, but the entire open source world.

        • crank@beehaw.orgOP
          link
          fedilink
          English
          arrow-up
          2
          ·
          1 year ago

          Hi that is kind of you to reconsider. No offense taken or intended. :) It’s just that 3 people commented to tell me to make an issue as though asking a question about linux software was inappropriate. Whereas 0 people commented with anything about my question. I still wonder if I am doing commenting wrong somehow.

          I am pretty sure I opened some kind of issue with these folks in the past and it was closed because I couldn’t submit a PR. I thought it was some sort of policy but I can’t find anything about it; either I am misremembering or whatever I read before is gone.

          I really truly do not begrudge any devs for running their FLOSS projects how they feel is best for them. It takes all types to make up the world. I think on the whole it is better for the FLOSS community to be open to feedback even from those who aren’t able to provide a solution, in order that the needs of non-developers can be met. But when it comes to a project which is explicitly aimed at developers, idk what can I say? It’s probably better that people who prefer issues be in the form of PRs be creating tools for other developers rather than normy end users.

          • russjr08@outpost.zeuslink.net
            link
            fedilink
            English
            arrow-up
            2
            ·
            1 year ago

            Plenty fair enough! I haven’t used Geany in a long time, and never actually ended up trying it as a code editor (rather than just the every once in a while one-off-quick-texr-editor) unfortunately, otherwise I’d have tried to answer your question directly.

            I do think that it’s alright to only accept PRs, just so long as it’s made a bit more clear. If I ever ran into a problem with Geany, I’d be completely unable to do anything as I have very little experience with C, let alone GTK and all of the other libraries along with it. I could learn right to effectively flip a few values or even maybe try to correct a basic logic issue - but that’s about it.

            That all being said, I hope someone is able to answer your question one way or another! Normally I’d recommend trying to reach out to the project’s chat since they usually have an IRC channel, Matrix channel, or some other place - but in this specific case after seeing the issues you mentioned I’d definitely be hesitant to do that sadly…