如何在 Visual Studio Code 中格式化 PHP 文件中的 HTML

问题描述:

我试过了:

  • ALT + SHIFT + F
  • CTRL + K, CTRL + D
  • CTRL + K, CTRL + F
  • ALT + SHIFT + F
  • CTRL + K, CTRL + D
  • CTRL + K, CTRL + F

此外,当我通过 CTRL + SHIFT + P 搜索格式时,也没有搜索结果.

Also when I search for format via CTRL + SHIFT + P, there are no search results.

问题是如果文件具有 PHP 扩展名 (index.php),Visual Studio Code 将不会格式化 HTML.我将发布一个包含此信息的新问题.

The problem is that Visual Studio Code won't format HTML if the file has a PHP extension (index.php). I'm going to post a new question that includes this information.