【问题标题】:Is there a way to specify that the Dart formatter does not modify the source code but just format it?有没有办法指定 Dart 格式化程序不修改源代码而只是格式化它?
【发布时间】:2014-03-14 05:45:23
【问题描述】:

对源代码应用格式化操作后,结果源不仅被格式化,而且还被修改(优化?)。

之前:

void main() {
  if(condition1) {
    // if condition 1
  } else if(condition2) {
    // if condition 2
  } else {
    // other case
  }
}

var condition1;
var condition2;

之后:

void main() {
  if (condition1) {
    // if condition 1
  } else {
    if (condition2) {
      // if condition 2
    } else {
      // other case
    }
  }
}

var condition1;
var condition2;

它不适合我。这是我的问题还是可以解决?

【问题讨论】:

    标签: optimization formatting dart dart-editor


    【解决方案1】:

    这是最近才修复的错误。
    - https://code.google.com/p/dart/issues/detail?id=17363(应该修复)
    - https://code.google.com/p/dart/issues/detail?id=16847 (类似的错误 - 打开)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-01-11
      • 2013-03-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-05
      • 1970-01-01
      • 2012-01-17
      相关资源
      最近更新 更多