[英]Prettier in VS Code formatting (new lines before arguments)
I'm using Angular Essentials by John Papa - in particular, Tslint and Prettier. 我正在使用John Papa撰写的Angular Essentials-特别是Tslint和Prettier。 For some reason, it transforms this code
由于某种原因,它会转换此代码
this.rM.hA = this.rM.startHA + 2 * diffX * 360 / size;
this.rM.vA = Math.max(Math.min(this.rM.startVA + 2 * diffY * 180 / size, 90), -90);
into this 进入这个
this.rM.hA =
this.rM.startHA + 2 * diffX * 360 / size;
this.rM.vA = Math.max(
Math.min(
this.rM.startVA + 2 * diffY * 180 / size,
90
),
-90
);
How can i avoid it? 我该如何避免呢? I've tried to play with tslint.json settings:
我尝试使用tslint.json设置:
"max-line-length": [true, 165]
“最大线长”:[true,165]
But that one does not affect in my case. 但这对我来说并没有影响。
EDIT: as following the similar issue I've tried to set both "prettier.printWidth"
and "editor.wordWrap"
, but none of them helped. 编辑:作为继类似的问题,我试图同时设置
"prettier.printWidth"
和"editor.wordWrap"
,但他们没有帮助。 I've removed max-line-length
, as suggested by @ConnorsFan, and my current Workspace Settings (which should override Users Settings, right?) is 我已经删除了@ConnorsFan建议的
max-line-length
,而我当前的工作区设置(应该覆盖用户设置,对吗?)是
{
{
"prettier.printWidth": 180,“ prettier.printWidth”:180,
"editor.wordWrap": "bounded",“ editor.wordWrap”:“有界”,
"editor.wordWrapColumn": 180 }“ editor.wordWrapColumn”:180}
EDIT2: it appears, problem is caused by Prettier extension (comes as dependency for Angular Essentials). EDIT2:看来,问题是由更漂亮的扩展引起的(作为Angular Essentials的依赖项)。 Now the problem is narrowed to realize, why
"prettier.printWidth": 180
is not working. 现在问题变得更加狭窄,为什么
"prettier.printWidth": 180
无法正常工作。 I've opened an issue https://github.com/prettier/prettier/issues/3228 我已经开了一个问题https://github.com/prettier/prettier/issues/3228
PS: The names have been changed to protect the innocent. PS:名称已更改,以保护无辜者。 (c)
(C)
"prettier.printWidth": 120
为我工作,在我的vscode中只有两个JavaScript格式扩展名'Prettier'&'ESlint'。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.