Flutter在VSCode上的格式化工具(Mac版)。

huangapple go评论76阅读模式
英文:

Flutter formater on VSCode Mac

问题

I just tried flutter in VSCode
I'm confused when the file is saved, why is the closing tag always one line

this is after I save the file:
Flutter在VSCode上的格式化工具(Mac版)。

my expectation:
Flutter在VSCode上的格式化工具(Mac版)。

VSCode Settings:
Flutter在VSCode上的格式化工具(Mac版)。

is there any extension or some settings to make as like my expectation?
thanks

英文:

I just tried flutter in VSCode
I'm confused when the file is saved, why is the closing tag always one line

this is after I save the file:
Flutter在VSCode上的格式化工具(Mac版)。

my expectation:
Flutter在VSCode上的格式化工具(Mac版)。

VSCode Settings:
Flutter在VSCode上的格式化工具(Mac版)。

is there any extension or some settings to make as like my expectation?
thanks

答案1

得分: 1

你的设置是正确的。这将使Dart在保存文件时真正格式化您的代码。

但是,如果您想让这种格式化换行,Dart希望在闭括号后看到一个逗号。例如:

...
backgroundColor: Colors.blueGrey[900],),),);

这样做,当您保存时,它将按您想要的方式格式化。

英文:

Your settings are right. This will make Dart really format your code when you save a file.

But if you want to this format break the lines, Dart expects to se a comma after the closing brackets. Example:

...
backgroundColor: Colors.blueGrey[900],),),);

Doing this, when you save, it will be formatted the way you want to.

huangapple
  • 本文由 发表于 2023年6月15日 18:06:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/76481402.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定