格式化dart文件时如何更改vscode中的dart线长度? [英] how to change dart line length in vscode when formatting dart files?

查看:65
本文介绍了格式化dart文件时如何更改vscode中的dart线长度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 VS Code 进行 Flutter 开发,我遇到的一个问题是代码格式(样式),它不像在 android-studio 中那样可定制.我的问题是,每次 vs 代码保存 dart 文件时,它都会像下面这样把我的行打断:

i'm using VS Code for flutter development and one issue i have is code formatting (styling) which is not as customizable as it is in android-studio. my problem is that each time vs code saves dart files it will break my lines very short like below:

var tuple =
       settings.arguments as Tuple3<String, int, Field>;

显然这就是我想要的:

var tuple = settings.arguments as Tuple3<String, int, Field>;

我该如何解决这个问题?

how can i solve this problem?

推荐答案

您需要更改 settings.json 中的 2 个设置:

You need to change 2 settings in settings.json:

"dart.lineLength": 150,
"[dart]": {
    "editor.rulers": [
        150
    ],
}

如果您不更改第二个,您仍然会看到垂直的标尺"宽度为 80 个字符.

If you do not change the second one, you'll still see the vertical "ruler" at 80 chars width.

这篇关于格式化dart文件时如何更改vscode中的dart线长度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆