Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"inner" list arguments indented oddly in TagTree expression #394

Closed
skybrian opened this issue Jul 30, 2015 · 1 comment
Closed

"inner" list arguments indented oddly in TagTree expression #394

skybrian opened this issue Jul 30, 2015 · 1 comment

Comments

@skybrian
Copy link

Here's how dartfmt 0.2.0-rc.4 handles formatting a complicated TagTree expression. Not terrible, but perhaps could be better.

For example, the outermost $.Div has only one named argument, which is a long list, so it seems like "inner: [" could be moved to the previous line?

Original file:
https://github.com/google/dart-tagtree/blob/master/example/dart-demos/sunflower/sunflower.dart

Before:

return $.Div(inner: [

    $.Div(id: "container", inner: [
        $.Canvas(width: maxD, height: maxD, clazz: "center", ref: canvas),
        $.Form(clazz: "center", inner: [
            $.Input(type: "range", max: 1000, value: seeds, onChange: onSliderChange)
        ]),
        $.Img(src: "math.png", width: "350px", height: "42px", clazz: "center")
    ]),

    $.Footer(inner: [
        $.P(id: "notes", inner: "${seeds} seeds")
    ]),
]);

After:

return $.Div(
    inner: [
  $.Div(
      id: "container",
      inner: [
    $.Canvas(width: maxD, height: maxD, clazz: "center", ref: canvas),
    $.Form(
        clazz: "center",
        inner: [
      $.Input(
          type: "range", max: 1000, value: seeds, onChange: onSliderChange)
    ]),
    $.Img(src: "math.png", width: "350px", height: "42px", clazz: "center")
  ]),
  $.Footer(inner: [$.P(id: "notes", inner: "${seeds} seeds")]),
]);
@skybrian
Copy link
Author

Also, assuming we're listing both named arguments and elements of an "inner" list vertically, it seems like elements of the list should be indented more than a named argument rather than less?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants