Wrong indent while formatting nested children in an array
See original GitHub issueWhile using a Ctrl+Shift+I
formatter tool I always got great results until I stumbled onto this odd indent behavior:
Notice how indent of Column
widget fields is off by 2 indent levels.
What I believe it should look like (manually formatted):
If I remove Expanded
widget which wraps the Column
widget, indent starts to behave normally.
Version info:
VS Code
Version: 1.30.0
Commit: c6e592b2b5770e40a98cb9c2715a8ef89aec3d74
Date: 2018-12-11T22:21:33.585Z
Electron: 2.0.12
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
OS: Linux x64 4.19.8-arch1-1-ARCH
Dart Code
Name: Dart
Id: dart-code.dart-code
Description: Dart language support and debugger for Visual Studio Code.
Version: 2.21.1
Publisher: Dart Code
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=dart-code.dart-code
P.S. I might have given a too generic name to this issue, maybe it should be renamed after you understand the issue.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
clang-format weird indentation of array of structs in C++
At first you need to add an ContinuationIndentWidth: 2 option to your format file. Then add a comma after the last item in...
Read more >Markdown: nested ordered lists are formatted incorrectly ...
Markdown: nested ordered lists are formatted incorrectly when not using default indentation · 1. Change tab size and indent to 2 spaces. ·...
Read more >indent - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >CoffeeScript
Destructuring assignment can be used with any depth of array and object nesting, to help pull out deeply nested properties.
Read more >Shell Style Guide - Google
Formatting, Indentation - Line Length and Long Strings - Pipelines - Loops - Case ... Expansion of Filenames - Eval - Arrays -...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the report. I think this is actually expected - I can repro with this code:
The issue is the two closing parens at the end
))
. There’s no trailing comma between them, which meansExpanded
is not being formatted “the flutter way”. If you insert it it ends up formatted like this:Similarly, if you insert a
,
between the last two parens in your method, it gets reformatted like this:Hope this helps!
Oh, I didn’t know this comma-related convention exists for Flutter formatting. Thanks!