Reformatting not working with too many lines?

Hi!

I have the problem that in a file with 1218 lines the reformatting doesn't work. Is there a way to increase the limit which is responsible for this?

Thanks!
Florian

6 comments
Comment actions Permalink

Hi there,


Settings/Preferences | Editor | Code Style | HTML | Other --> "or if tag size more than" -- try inceasing that/setting new value.

0
Comment actions Permalink

Hi Andriy,

thanke for your answer!
I have tried to set the value to 2.000 but it didn't work ... It's a PHP file.

0
Comment actions Permalink

I do not know any similar setting for PHP...

1) Your PhpStorm version?
2) Exact file name?

0
Comment actions Permalink

I use PhpStorm 9.0.2 and the file name is functions.php.

I have created a Gist with it's content: https://gist.github.com/FlorianBrinkmann/c9d89f7d9bcdb50d05af

0
Comment actions Permalink

Thanks for the file!

It's not a problem with number of lines ...

The problem is that it's a heavy mix of PHP + HTML (lots of ?> <?php blocks) that happening inside PHP functions (the later is important nuance)...

In you file you have a lot of  "PHP code ?> HTML CODE <?php  PHP code again" sections ... -- if I remove ALL of them .. and even copy-paste all remaining lines few times .. it's still gets reformatted.

Few suggestions:

1) Do not do that (if it's your code) -- better use echo "HTML HERE"; or HEREDOCS like

//bla-bla php code
echo <<<HTML
HTML EHRE
HTML;
// php code again

or

$html = <<<HTML
HTML EHRE
HTML;
echo $html;
// keep PHP code going


I've tried converting one of the functions ( bornholm_show_seperator() ) into such form (while removed such HTML+PHP mix in other places, of course) .. and reformat still worked.

2) Submit a bug ticket to the Issue Tracker --  I have no clue how long it will take devs to fix it -- quite possible that such complex case (of such "nasty" (as for my liking) style) will be put into some deep drawer.

0
Comment actions Permalink

Yes, it's my code :) Thanks for your time and the solution for my problem, I'll have a look at it.

0

Please sign in to leave a comment.