<分区>
CleanCode 一书建议按调用顺序对函数进行排序:
If one function calls another, they should be vertically close, and the caller should be above the callee, if at all possible. This gives the program a natural flow.
我想将该顺序包含在我的清理程序中。下面的例子
public void content(){
primary();
secondary();
}
private void secondary(){
}
private void primary(){
};
应该自动重新排序为
public void content(){
primary();
secondary();
}
private void primary(){
};
private void secondary(){
}
(这不是字母顺序,primary() 和 secondary() 具有相同的修饰符。)
但是,我找不到这样做的 Eclipse 功能。 Eclipse 似乎只能按成员的类型而不是按用途对成员进行排序。
是否有我错过的默认功能或我可以安装的额外 Eclipse 插件?
(我不是在寻找或提供该顺序的大纲 View 。我想更改代码中的实际顺序。这个问题不是关于以这种方式更改代码的利弊。)
相关文章:
How to specify the order of class members when formatting in Eclipse