Skip to content

Multiple passes needed to get final formatting  #1625

Open
@goderbauer

Description

@goderbauer

Running dart format on the following code...

import 'dart:io';

bool foo() {
  if (
  // Explicitly stated to not be a bot.
  Platform.environment['BOT'] == 'false'
  ) {
    return false;
  }
  return true;
}

... produces this output:

import 'dart:io';

bool foo() {
  if (// Explicitly stated to not be a bot.
  Platform.environment['BOT'] == 'false') {
    return false;
  }
  return true;
}

Running dort format over that output again reformats it to the following (notice the added space before the //):

import 'dart:io';

bool foo() {
  if ( // Explicitly stated to not be a bot.
  Platform.environment['BOT'] == 'false') {
    return false;
  }
  return true;
}

Expectation: dart format produces the final output after one run. Subsequent runs do not change the output further.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions