pdt
pdt copied to clipboard
HTML template near to unreadable after save action format
Describe the bug Format, on save actions, of HTML template near to unreadable
Describe the eclipse environment Eclipse PDT PDT Profiler UI Plug-in 8.0.0.202306050832 org.eclipse.php.profiler
Eclipse IDE for Java Developers (includes Incubating components) Version: 2023-03 (4.27.0) Build id: 20230309-1520 OS: Linux, *, x86_64 / gtk 3.24.38, WebKit 2.40.2 Java vendor: Eclipse Adoptium Java runtime version: 17.0.6+10 Java version: 17.0.6
To Reproduce Steps to reproduce the behavior:
- Create a template:
<html>
<head></head>
<body>
<p>
</p>
<?foreach (array('never','ever') as $i) :?>
<?='I can not read this thing ' . $i?>
<?endforeach;?>
</body>
</html>
- Click on Source > Format
<html>
<head></head>
<body>
<p></p>
<?foreach (array('never','ever') as $i) :?>
<?='I can not read this thing ' . $i?>
<?endforeach;?>
</body>
</html>
- Enable: Window > Preferences > PHP > Editor > Save Actions > Format source code (Apply and close)
- Ctrl + S
- Result unreadable
<html>
<head></head>
<body>
<p></p>
<?
foreach (array(
'never',
'ever'
) as $i) :
?>
<?='I can not read this thing ' . $i?>
<?
endforeach
;
?>
</body>
</html>
Expected behavior Formatted as expected in step 3
What about avoiding the short open php tag?
I mean, try to use <?php
instead of <?
I think we need extra settings for short open tags, especially with alternate control structure syntaxes
@zulus There have been several attempts to deprecate ASP-style tags and short-open-tags (even with its special control-structures):
- https://wiki.php.net/rfc/remove_alternative_php_tags
- https://wiki.php.net/rfc/deprecate_php_short_tags
- did not find the deprecation RFC regarding the constrol-structures
I didn't read that far, but one (you? 🤔 ) should consider the current state.
Not related to short tags, useful in my opinion. Related to something strange that occurs with "format source code" on save (Window > Preferences > PHP > Editor > Save Actions > Format source code). As you can see in step 3 after (Source > Format), code format is "normal". (Source > Format) code format different from (File > Save) with format source code enabled.