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

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

问题描述

我正在使用 VS Code 进行颤振开发,我遇到的一个问题是代码格式化(样式),它不像在 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?

推荐答案

VSCode中改变行长

打开 settings.json 并添加以下行

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

旁注:如果您希望更改 VSCode 中单个项目的 dart 行长度,请创建一个 .vscode/settings.json 文件并添加配置上面写在那个文件里.

SIDE NOTE: if you wish to change the dart line length for a single project that you have in VSCode create a .vscode/settings.json file and add configuration written above in that file.

要在 Android Studio 中更改 dart 行长度,请转到

to change dart line length in Android Studio go to

设置 >编辑器>代码风格 >飞镖和改变行长

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

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