Does PHPStorm not support code folding for Twig? Follow
I rely on code folding heavily to write code; I use it to remove things from my sight that are not relevant to the issue I'm working on - it helps remove distraction. I am finding that working with Twig in PHPStorm is far from optimal because I can't fold Twig properly.
For example, in the following code block I want to fold: The case block. The macro call. The form open tag.
In comparison with this same code, VSCode gets all this folding correct:
Please sign in to leave a comment.
Could you please share the code samples as text? I'll extract each case as a feature request, but there's no fun in re-typing code from a screenshot. Thank you!
Of course, no problem. Here's the complete twig file:
Thank you! I've extracted the switch case request:
https://youtrack.jetbrains.com/issue/WI-67995/Twig-Ability-to-fold-switch-case-blocks
Folding tag attributes isn't even supported in HTML; here's a feature request for that:
https://youtrack.jetbrains.com/issue/WEB-31463/Add-code-folding-for-wrapped-attributes-in-HTMLXML-tags-collapse-attributes
Do I get it right that when you say "macro call", you actually mean that you want to fold the hash you pass as an argument?
https://twig.symfony.com/doc/3.x/templates.html#literals
Great stuff, thank you.
I mean this block here:
so ideally it'd fold to
Which is what VSCode does.
Yep, it's a hash that has to be collapsed then. It makes sense to support it for arrays too.
Extracted: https://youtrack.jetbrains.com/issue/WI-68018/Twig-Folding-of-multiline-hashes-and-arrays