Upgraded to BashSupportPro - lost Code Folding of most things

I just upgraded and realised that I now only have code folding for comments and functions…

Using intellij IDEs

But now there is no code folding for:

If
Do While
For
Case

And I imagine a bunch of others.

I am really hoping this is just me being stupid, but having function level only code folding makes this plugin unusable for me…

Can anyone advise… thanks

Jeff

Hi,
thanks for your feedback. Folding is currently limited to the types you mentioned. As this seems like an important feature to you I could include the missing pieces with the next update.

Do you need folding similar to legacy BashSupport or is there something you‘re missing there as well?

Regards, Joachim

Hey Joachim

I would really really really appreciate this, without folding of all standard bash loops and control flows I am pretty much lost. I am constantly working on peoples bash that is wet and long, and the last few days have been troubling.

Legacy BashSupport folding would be great, any enhancement even better, although I never noticed before folding that was missing (until comment folding was introduced).

Thanks for your reply

Best

Jeff

Hi Jeff,
alright, I‘ll fix that for the next update.
I‘m tracking this at https://github.com/BashSupport-Pro/bashsupport-pro/issues/41 now.

Custom code folding might be a workaround until then, but is most likely not good enough for your needs.

Regards,
Joachim

@JeffCleverley
I’m back from vacation and started to implement this. Your feedback would help to get this done right.

Folding of subshell expression

For $(command arg arg), would you prefer $(...), or $(command...) or perhaps something else?

Folding of here documents

For

cat << EOF
  first line of content
  second line
  third line
EOF

Would you prefer something like

cat << EOF
...
EOF

or

cat << EOF
first line of content 
...
EOF

or perhaps something else?

Thanks!
Joachim

Hey Joachim

I am used to these:

$(...)

cat << EOF
...
EOF

But I can see the following as being an undeniable improvement, offering more information and no extra vertical space taken:

$(command...)

And I also think I would choose to use this if an option:

cat << EOF
first line of content 
...
EOF

Although in the case of HEREDOCs containing the first line, it is going to take more space so others might disagree.

And here is where I get cheeky, perhaps these could be optional settings… something like:

include context when folded

However, that’s just me wanting everything, either option would be a lifesaver right now.

Hi @JeffCleverley,
thanks for the feedback! An option to control the shown context is possible. I’m not sure yet if that’s a good idea, because it’ll have a bunch of edge-cases. I’ll think about it. For now it’s “just” the plain folding.

I’ve published a preview version with folding on the EAP channel:
2020.1: https://plugins.jetbrains.com/plugin/13841-bashsupport-pro/versions/eap/95801
2020.2: https://plugins.jetbrains.com/plugin/13841-bashsupport-pro/versions/eap/95802
Docs of all new folding options: https://preview.bashsupport.com/pro/editor/code-folding/

You need to “Download” and install from that file via Preferences>Plugins>Install from disk and restart.

I guess that this will ease your pain to work on shell scripts. At least I hope so!

I’d be glad for your feedback on the folding if you could spare a few minutes:

  • Is the folding of the then, and else branches of an if command useful enough? Personally, I liked this, but wasn’t sure if this is perhaps a bit too much folding
  • The same question on case-patterns. Do you think that the folding of case patterns is useful to ship this in a release?
  • Is there any missing or confusing folding?

Thanks!
Joachim

Oh man, thats amazing news…

The pain is real, we run our entire server control panel from a bash cli backend…

We are currently libbing everything out and moving to progressively replace things in Golang, but at the moment I am regularly working on shell scripts that are 30k plus lines with internal functions that are several k deep…

I will download that immediately and let you know how I go

This is awesome, thank you…

The granular folding of both If and Case commands is excellent.

I like the ability to be able to control the fold, it is much better than previously where I would only have the option to keep the tail/remainder folded as I progressed through, this allows me to just keep the control flow i need unfolded as I jump between code blocks.

Glad that it’s working and useful! If you noticed anything, just let me know. Also, if you notice any performance issues with the large scripts, I’d be glad for a note.

I hope that it’s okay that you’ll have to use the preview for a while, I don’t think that the next update will be out in the next two weeks.

for reference, version 1.5.8 has been released for everone and ships the improved code folding.