dart_style icon indicating copy to clipboard operation
dart_style copied to clipboard

allow to pass to dartfmt the body of a function without the declaration of the function

Open sigmundch opened this issue 10 years ago • 0 comments

The original bug #464 had two parts:

  • adding a mechanism to preserve an indentation level (fixed by https://github.com/dart-lang/dart_style/commit/ef9db2d553d03ea6a1e6c3667487400c73fa34b8)
  • adding support for passing a statement directly to dartfmt without having to provide an enclosing function.

This bug is tracking the second piece.

Example usage:

echo "  this.code('is indented with 2 spaces to begin with .........................');"\
    | dartfmt

Should produce:

  this.code(
      'is indented with 2 spaces to begin with .............');

Currently it produces an error:

Could not format because the source could not be parsed:

line 1, column 10 of stdin: A function body must be provided
...

sigmundch avatar Nov 25 '15 01:11 sigmundch