Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用了prettier 或者 prettyHtml 格式化 保存时就会报错 #83

Closed
smalldice opened this issue Dec 31, 2020 · 15 comments · Fixed by #121
Closed

使用了prettier 或者 prettyHtml 格式化 保存时就会报错 #83

smalldice opened this issue Dec 31, 2020 · 15 comments · Fixed by #121
Labels
bug Something isn't working

Comments

@smalldice
Copy link

编辑器配置:
{
"minapp-vscode.wxmlFormatter": "prettier",
"minapp-vscode.prettier": {
"parser": "html",
"singleQuote": false
}
}

@smalldice
Copy link
Author

报错内容
prettier format error: Unexpected closing tag "text". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags (26:104)
24 |
25 | 易读错字:

26 | <text class='words {{ wrongWords.length === 0 ? 'no-word' : '' }}'>{{ wrongWords || '暂无' }}
| ^^^^^^^
27 |
28 | 班级报告
29 |

@gaozheng227
Copy link

报错内容
prettier format error: Unexpected closing tag "text". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags (26:104)
24 |
25 | 易读错字:

26 | <text class='words {{ wrongWords.length === 0 ? 'no-word' : '' }}'>{{ wrongWords || '暂无' }}
| ^^^^^^^
27 |
28 | 班级报告
29 |

我也遇到了,请问最后怎么解决的呢

@June-elisa
Copy link

我也遇到了

@iChenLei iChenLei added the bug Something isn't working label Aug 29, 2021
@iChenLei

This comment has been minimized.

@Gusiil
Copy link

Gusiil commented Sep 3, 2021

退到 2.1 版本就没问题。。

@iChenLei

This comment has been minimized.

@YeYbfwad
Copy link

我也遇到了,请问怎么解决

@iChenLei

This comment has been minimized.

@iChenLei
Copy link
Member

@JunVincetHuo @June-elisa @gz227
请提供可复现代码片段,我最近会着手修复这个问题!谢谢

@JserWang
Copy link

JserWang commented Nov 3, 2021

@iChenLei 请问能提供个属性来禁用wxml的格式化么?在wxml中增加了一部分yaml的内容,自动格式化会导致yaml格式出现问题,导致在解析yaml代码块中的内容时由于格式化后的错乱导致出现解析问题。 或者在使用prettier时,允许.prettierignore相关的配置生效。

@iChenLei
Copy link
Member

iChenLei commented Nov 3, 2021

@JserWang 格式化是手动的功能,不使用就可以吧? 可以提供具体的代码样例吗

@JserWang
Copy link

JserWang commented Nov 3, 2021

@JserWang 格式化是手动的功能,不使用就可以吧? 可以提供具体的代码样例吗

@iChenLei

<route lang="yaml">
meta:
  requiresLogin: true
</route>
<view>test</view>

当我在vscode编辑完保存之后,代码会变成

<route lang="yaml">meta:
  requiresLogin: true</route>
<view>test</view>

我的编译工具会解析<route>标签中的yaml内容来自动配置路由相关信息后将其移除,目前由于格式化导致yaml格式出现了问题。

我的vscode中有一项配置为"editor.formatOnSave": true,,我想大多数开发者应该都会默认打开这一项配置。但是目前使用这个插件后会对我的文件造成破坏性的影响。在没加入wxmlFormatter的版本之前,插件不会对我的wxml进行任何变更,所以我希望能提供一个配置开关来禁用wxmlFormatter

@iChenLei
Copy link
Member

iChenLei commented Nov 3, 2021

@JserWang 了解了,这两天释出一个加format开关的版本,感谢反馈
目前麻烦你要么 1.关闭自动format 或者 2.暂时回退到插件老版本吧

@JserWang
Copy link

JserWang commented Nov 3, 2021

@JserWang 了解了,这两天释出一个加format开关的版本,感谢反馈 目前麻烦你要么 1.关闭自动format 或者 2.暂时回退到插件老版本吧

@iChenLei thx

@iChenLei
Copy link
Member

iChenLei commented Nov 3, 2021

@JserWang v2.4.0 即将发布
minapp-disable-format

顺便说一句下一次请单独提issue,谢谢合作,有钉钉账号的话可以加到README.md里的钉钉群,可以实时答疑

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants