Strange indent logic of PHP code blocks inside the <script> tag

I have this PHP code I'm going to implement into html template:

<? if( true ) { ?>
<? echo 'true' ?>
<? } else{ ?>
<? echo 'false' ?>
<? } ?>

I want it looks exactly like that. But if I wrap the code in the <script> tag, it will be reformatted to this:

<script>
for( let i = 0; i < 10; i++ ) {
    <? if( true ) { ?>
    <? echo 'true' ?>
    <? } else{ ?>
    <? echo 'false' ?>
    <? } ?>
}
</script>

i.e. all PHP blocks are ignored. With the <html> tag things ok tho.

What I can do with that? I've been modifying Code Styles settings (PHP, JavaScript, Twig) but in vain :( Maybe not the mortal issue, but code automatic reformatting gets me mad coz of it. Thanks!

1

Thank you for reporting! It's a bug, and I don't see any way to work it around. Please vote for WI-73459.

1

请先登录再写评论。