gmlewis / flutter-stylizer

Flutter Stylizer is a VSCode extension that organizes your Flutter classes and mixins in an opinionated and consistent manner.
https://marketplace.visualstudio.com/items?itemName=gmlewis-vscode.flutter-stylizer
Apache License 2.0
23 stars 3 forks source link

Spurious lines after running stylizer #20

Closed timsneath closed 3 years ago

timsneath commented 3 years ago

Describe the bug After running stylizer on a Dart file, there are two lines that are left behind in the wrong place, leaving a syntax error.

To Reproduce See before.dart and after.dart in the following Gist (lines 81-83 highlight the errored lines): https://gist.github.com/timsneath/fe1c2b778be7a2329ca3bb7a4bb2465e#file-after-dart-L81-L83

Expected behavior Code moves without changing function or causing syntax errors :)

Additional context Running 0.0.20 on Windows.

Stylizer settings:

    "flutterStylizer": {
        "groupAndSortGetterMethods": false,
        "memberOrdering": [
            "public-static-variables",
            "public-instance-variables",
            "public-override-variables",
            "private-static-variables",
            "private-instance-variables",
            "public-constructor",
            "named-constructors",
            "public-override-methods",
            "public-other-methods",
            "build-method",
        ],
        "sortOtherMethods": false,
    }
gmlewis commented 3 years ago

Excellent bug report, @timsneath ! It's almost as if you've done this sort of thing before. :joy: Thank you!!! I'll work on it and hopefully fix it by tonight (I have to step out for a few hours, but will get back to it ASAP).

timsneath commented 3 years ago

Oh, no hurry. I was able to work around it and just checked in my code reordered using your tool! https://github.com/timsneath/winmd/commit/b7aa6c173c6ccbb147c037c2a197b2517c95ccfd

gmlewis commented 3 years ago

This is fixed in release: https://github.com/gmlewis/flutter-stylizer/releases/tag/v0.0.21

gmlewis commented 3 years ago

Hi @timsneath - sorry for the spam, but I thought you might be interested in the stand-alone version of this program that I just released for Linux, Windows, and Mac. It processed the full Flutter source code distribution (7772 *.dart files) in about 11 seconds (on Linux, and about 30 seconds on Windows running in VirtualBox).

You can check it out here: https://github.com/gmlewis/go-flutter-stylizer

If you find it helpful or have any problems with it, please let me know what you think.

timsneath commented 3 years ago

That's really exciting! I'll give it a go. Thanks for contributing to the Flutter community in this way...