[vim/vim] No indentation of HTML tags in PHP files (Issue #14850)

已查看 6 次
跳至第一个未读帖子

lkintact

未读,
2024年5月25日 14:39:295月25日
收件人 vim/vim、Subscribed

Steps to reproduce

  1. Run gvim.exe --clean
  2. Put the following code into the buffer:
<html>
<body>

<?php
echo "in PHP";
?>

<div>
<span>
in span
</span>
</div> 
</body>
</html>
  1. Execute :set filetype=php
  2. Type =G to indent the code. No indentation happens.

Expected behaviour

The code should be indented like this:

<html>
<body>

<?php
echo "in PHP";
?>

<div>
	<span>
		in span
	</span>
</div> 
</body>
</html>

Version of Vim

9.1.443

Environment

OS: Windows 10 Home
Terminal: GUI

Logs and stack traces

No response


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14850@github.com>

Christian Brabandt

未读,
2024年5月25日 15:06:195月25日
收件人 vim/vim、Subscribed

well, this seems a bit strange, to expect that the php filetype does HTML indenting. Perhaps the PHP indent script can check the syntax and return the HTML indent for HTML parts in php files. Assuming the php syntax script does already detect HTML within a php filetype (which I didn't check). I think the HTML indent script does something similar for JS indenting, so perhaps this could be an example on how to do it.

https://github.com/vim/vim/blob/0076ddc07dc1d97afcf3252fd361885abbaf23d5/runtime/indent/php.vim#L1-L7

You may want to report over there and check with the maintainer if this is feasable.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14850/2131403957@github.com>

lkintact

未读,
2024年5月25日 16:13:205月25日
收件人 vim/vim、Subscribed

Thank you, turns out here the maintainer explicitly says he won't support HTML indenting, explains why and links a solution.
I guess the issue can be closed.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14850/2131425370@github.com>

lkintact

未读,
2024年5月25日 16:13:225月25日
收件人 vim/vim、Subscribed

Closed #14850 as completed.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/14850/issue_event/12933853470@github.com>

回复全部
回复作者
转发
0 个新帖子