Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
597 views
in Technique[技术] by (71.8m points)

flutter - how to change dart line length in vscode when formatting dart files?

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>;

obviously this is what i want :

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

how can i solve this problem?

question from:https://stackoverflow.com/questions/59456452/how-to-change-dart-line-length-in-vscode-when-formatting-dart-files

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You need to change 2 settings in settings.json:

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...