简体   繁体   English

VS Code 停止格式化之前创建的现有 HTML 文件。 新HTML文件可格式化

[英]VS Code stopped formatting existing HTML file created before. New HTML file can be formatted

The problem is VS code stopped formatting existing, working HTML file when I press hotkey.问题是当我按下热键时 VS 代码停止格式化现有的工作 HTML 文件。 However if I create a new HTML file I can format file easily.但是,如果我创建一个新的 HTML 文件,我可以轻松地格式化文件。 I have a problem with HTML files that I worked before, I was able to format files easily, then after pushing to GitHub HTML file stopped formatting, I am not sure that there is a link between them.我以前工作过的 HTML 文件有问题,我能够轻松地格式化文件,然后在推送到 GitHub HTML 文件停止格式化后,我不确定它们之间是否存在链接。 I tried to format HTML file by creating paragraph, screen is below.我尝试通过创建段落来格式化 HTML 文件,屏幕如下。 Screen from VS code来自 VS 代码的屏幕

I tried several things to solve the problem 1 Restarted VS code 2 Tried to format by using command pallete then chose format document with, then chose Prettier 3 Pressed Prettier in the bottom part of the VS code to see problems - no problems 4 If I create a new HTML file I can format HTML FILE, but existing ones I can't format我尝试了几件事来解决问题 1 重新启动 VS 代码 2 尝试使用命令pallete 格式化,然后选择格式文档,然后选择 Prettier 3 在 VS 代码底部按 Prettier 查看问题 - 没问题 4 如果我创建一个新的 HTML 文件我可以格式化 HTML 文件,但现有的我不能格式化

Please help if you know how to fix this problem, I am new to programming, tried to google.如果您知道如何解决此问题,请提供帮助,我是编程新手,尝试过 google。 watch videos but couldn't find the answer.看视频却找不到答案。 If possible please write steps how to fix the issue.如果可能,请写下如何解决问题的步骤。

The problem is fixed.问题已解决。 I made a mistake in tags, so be very very careful and check your tags on html file that you are working on.我在标签上犯了一个错误,所以要非常小心并检查您正在处理的 html 文件上的标签。 The problem was that I did incorrect order of the and tags.问题是我对 and 标签的顺序不正确。 That's why VS code wasn't able to format the HTML file.这就是为什么 VS 代码无法格式化 HTML 文件的原因。 So guys if you have same problem just, recheck the tags!因此,如果您有同样的问题,请重新检查标签! It might help!它可能会有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM