Delphi-IDE:如何改变类完成的工作方式? [英] Delphi-IDE: how to change the way class-completion works?

查看:154
本文介绍了Delphi-IDE:如何改变类完成的工作方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Delphi中的类完成节省了大量时间,但我还没有找到一种方法来定制它。

Class completion in Delphi is a big time-saver, but I haven't found a way to customize it.


  1. 我希望将一个属性的getter和setter组合在一起,而不是被整个单元抛出;接口部分是正确生成的,但是如果将内容留给IDE,实现部分就会变得一团糟。我希望默认情况下按此方式排序方法:

  1. I would like a getter and setter for a property to be grouped together instead of being thrown all over my unit; The interface part is generated properly, but the implementation section becomes a mess if you leave things up to the IDE. I want methods to be ordered like this by default:


function TAaa.getAaa();

function TAaa.getAaa();

程序TAaa.setAaa();

procedure TAaa.setAaa();

程序TAaa.Baa();

procedure TAaa.Baa();

功能TAaa.getCow();

function TAaa.getCow();

程序TAaa.setCow();

procedure TAaa.setCow();

程序TBbb.getAaa()

procedure TBbb.getAaa()


  • 我希望实现部分与接口的顺序相同;

  • I want the implementation section to be in the same order as the interface;

    我希望生成的方法的主体看起来像这样:

    I want the body of a generated method to look something like this:

     procedure TMyClass.MyProc;
     begin
       { TODO -oWouter -cimplement autogenerated stuff : implement Procedure MyProc() }
       raise Exception.create('procedure TMyClass.MyProc() is not yet implemented');
     end;
    

    是否有工具可以执行此操作,或者是否需要深入了解opentools API以获取某些内容这样做了吗?

    Are there tools around to do this, or is it needed to dive into the opentools API to get something like this done?

    相关问题:
    Class Completion以什么顺序显示结果?

    推荐答案


    问题1:我希望将属性的getter和setter组合在一起。

    Question 1: I would like a getter and setter for a property to be grouped together.

    Modelmaker Code Explorer(MMX)有一个排序工具。该工具在接口和实现中对类成员进行排序。我正在使用的4.05版本支持您的排序。但是,Modelmaker网站包含页面,其中显示了最新的排序功能看起来他们使用许多新选项扩展了排序功能。也许您可以使用最新的MMX工具对getter / setter方法进行分组。
    方便功能:

    The Modelmaker Code Explorer (MMX) has a sorting tool. The tool sorts class members in the interface and the implementation. The 4.05 version, I'm using, does not support your kind of sorting. However, the Modelmaker website contains a page that shows the most up to date sorting functionality and it appears they extended the sort functionality with many new options. Maybe you can group your getter/setter methods with their latest MMX tool. Handy functionality:


    • 在MMX类浏览器中拖放排序:将方法拖动到新位置并进行模型制作代码

    • 排序提示:如果方法未根据您的默认排序模板排序,MMX将通知您


    问题2:我希望实现部分与接口的顺序相同。

    Question 2: I want the implementation section to be in the same order as the interface.

    MMX排序功能可以做到这一点。执行排序后,接口和实现将按照相同的顺序。

    The MMX sort functionality will do that. After you execute the sort, the interface and implementation will be in the same order.


    问题3:我想要生成方法的主体看起来像这样...

    Question 3: I want the body of a generated method to look something like this...

    MMX [添加新方法]会自动为方法的正文添加一个可自定义的代码存根。代码存根中支持参数,但我没有看到支持的参数列表。这是一个样本

    The MMX [add new method] will automatically add a customizable code stub to your method's body. Parameters are supported in the code stub, but I have not seen the list of supported parameters. Here is a sample

    程序TForm1.NewMethod;

    procedure TForm1.NewMethod;

    开始

    // TODO TForm1.NewMethod默认正文插入

    // TODO TForm1.NewMethod default body inserted

    结束;

    这篇关于Delphi-IDE:如何改变类完成的工作方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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