2

I like to fold some parts of php code in PhpStorm IDE with in curly braces( {} ) A sample code:

$a='a';
$b='b';

{
$repeating_var1='1';
$repeating_var2='2';
}

How can I define to PhpStorm to fold those part that is in curly brace? As you know PhpStorm does not recognize these part (last lines in curly braces) as foldable.

Seyfi
  • 1,832
  • 1
  • 20
  • 35
  • 1
    https://www.jetbrains.com/help/phpstorm/2016.2/code-folding.html?search=fold#supported_comments – LazyOne Jul 16 '16 at 12:04
  • @LazyOne Yes it is ,but i want simple curly braces get in work – Seyfi Jul 16 '16 at 14:56
  • So .. submit a Feature Request (https://youtrack.jetbrains.com/issues/WI), because I personally see no reason for such instructions in first place. Why do you need to surround your code with just `{}`? – LazyOne Jul 16 '16 at 15:11
  • @LazyOne Just for shortest way to folding. As you now in languages like C++ and java it considers as a block, but in php it makes no change in code interpreting. I think since phpStorm have strong connection with intelliJ so it could recognize {curly braces} as foldable part or it has a disabled feature that we can enable it. I like some one STRONGLY say there is no feature due to some docs or it exists. – Seyfi Jul 16 '16 at 15:19
  • 1
    You have missed the point a bit. All folding is language specific .. so having it working for Java (for example) does not mean that the same exists for another (even partially similar) language (like PHP). ATM folding is provided for keywords and blocks (if/else/etc) -- having just `{}` is not enough in current implementation (because it does look at opening `{`). That's one of the reasons why custom folding regions/comments (like in the original link) were implemented. BTW: you can fold ANY lines/code block at any time -- `Ctrl+Period` – LazyOne Jul 16 '16 at 16:10
  • @LazyOne You are true. I think maybe {curly brace} in php also work(certainly just for folding, as every one knows it has no influence in code interpreting). I find best shotcut( Ctrl+period doesnt work on my phpStorm IDE). Best shortcut is Ctrl+Alt+T ,fast and you can add description. thank to your participate +2 – Seyfi Jul 16 '16 at 16:21

0 Answers0