“完成次数”的顺序如何? [英] In what order does Class Completion put its results?

查看:212
本文介绍了“完成次数”的顺序如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

示例:我创建一个新单元,按照该顺序声明一个类,其中包括构造函数,析构函数,method1,method2,method3等几种方法,然后按Ctrl-Shift-C。
IDE自动创建所有的方法体,但是顺序是混合的,而不是在接口部分中声明。

Example: I create a new unit, declare a class with several methods like constructor, destructor, method1, method2, method3 in that order and then hit Ctrl-Shift-C. The IDE creates all the method bodies automatically, but the order is mixed up and not as it was declared in the interface section.

现在,这不是一个问题,但有一个原因。似乎更难混合起来,而不是按照声明的顺序做到这一点。

Now, this is not a problem, but is there a reason for it. It seems to be more difficult to mix that up than to just do it in the order of the declaration.

或者有一些规则是有道理的,我不能看到?

Or is there some rule to it that makes sense which I cannot see?

推荐答案

这有点复杂,因为它取决于你的方法已经安排了。

This is a bit complicated to answer since it is dependent on how your methods are already arranged.

如果它们已按字母顺序执行,则会尝试并维护。如果IDE不能推断出任何类型的命令,它将在文件末尾放置它们。

If they're already implemented in alphabetical order, it will try and maintain that. If the IDE cannot infer any kind of order, it resorts to dropping them at the end of the file.

根据惯例,还有另一个皱纹,如果您以以下形式包含注释:{< ClassName> }在实现方法的第一个块之前,然后使用该注释来描述所有后续的类实现,它将尝试将方法分组在一起。

There is another wrinkle where, by convention, if you include a comment in the form: { <ClassName> } before the first block of implemented method and then use that comment to delineate all subsequent class implementations, it will attempt to keep the methods grouped together.

字母排序遵循上述相同的规则,但它可能会将新方法注入由指定注释描述的逻辑块。

The alphabetical ordering follows the same rules above, except it may inject the new methods into that logical block delineated by the indicated comment.

如果您使用一个全新的类完成课程,您会发现IDE将自动生成该描述性注释。

If you use class-completion with a brand new class, you'll notice that the IDE will automatically generate that delineating comment.

如果您让类完成自动安排方法,并且仅使用 Ctrl + Shift + UpAr 键在方法的实现和声明之间进行导航,排序应该不那么重要。

If you let class completion auto-arrange the methods and only use the Ctrl+Shift+UpAr key to navigate between a method's implementation and the declaration, the ordering should be less important.

通常,我将使用上述键序列跳转到类decl,然后使用箭头键转到我想要的decl中的方法,然后再次使用该键序列快速找到它。

Typically, I'll jump to the class decl using the above key-sequence, then use the arrow keys to go to the method in the decl I want, and then use that key-sequence again to quickly get to it.

另一个很好的键序列是 Ctrl + Alt + UpAr 或< kbd> Ctrl + Alt + DnAr ,它将快速从方法impl跳转到文件顺序的方法impl。

Another nice key-sequence is the Ctrl+Alt+UpAr or Ctrl+Alt+DnAr which will quickly jump from method impl to method impl in file-order.

这篇关于“完成次数”的顺序如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆