Lazarus IDE Tools/zh CN

From Free Pascal wiki
Jump to navigationJump to search

Deutsch (de) English (en) español (es) suomi (fi) français (fr) 日本語 (ja) 한국어 (ko) Nederlands (nl) português (pt) русский (ru) slovenčina (sk) 中文(中国大陆)‎ (zh_CN)

Lazarus IDE 工具

概述

IDE使用了Pascal源码解析和编辑工具库,被称为“codetools(代码工具)”。工具提供的功能像查找声明、代码完成、提取、移动插入和美化Pascal。这些函数可以节省你很多时间,你可以在编辑器选项中对它们进行自定义配置。

因为它们的工作时解析FPC、Delphi和Kylix代码。它们不需要编译单元,也不是一个安装了Borland的编译器。你可以在同一时间编辑Delphi和FPC代码。你可以使用不同版本的Delphi和FPC。这使得移植Delphi代码变得容易很多。

IDE 快捷键列表

查找声明 Ctrl+点击 or Alt+ (跳转到声明的类型或变量)
方法跳转 Ctrl+ Shift+ (在定义部分和实现部分进行切换。看见一个定义,就可以用快键方式,直接找到它的实现部分。)
代码模板 Ctrl+J
Syncro 编辑(同步编辑) Ctrl+J (需要选择文本)
类自动完成 Ctrl+ Shift+C
标识符自动完成 Ctrl+空格
关键字自动完成 Ctrl+W
参数提示 Ctrl+ Shift+空格
渐进式搜索 Ctrl+E

方法跳转

要在过程体(begin..end)与过程定义(procedure 过程名)间跳转,使用 Ctrl+ Shift+.

示例:

interface

procedure DoSomething; // 过程定义
 
implementation
 
procedure DoSomething; // 过程体
begin
end;

如果光标在过程体,当你按Ctrl+ Shift+时,会跳转到其定义,再次按Ctrl+ Shift+会跳转到过程体;如此循环。

在方法间(类中的过程)也是如此。

注意: 方法跳转,将跳转到具有相同名称和参数列表的地方,如果没有,它将跳到最佳匹配的地方,并将光标定位在第一个上面。(对于Delphians:Delphi不能做到这一点。)

例如,不同参数类型的过程:

interface

procedure DoSomething(p: char); // 过程定义

implementation
  
procedure DoSomething(p: string); // 过程主体
begin
end;

自定义跳转会在'string'处定位光标,这可用于重命名方法或改变参数。

如:
你更名'DoSomething' 为 'MakeIt':

interface

procedure MakeIt; // 过程定义

implementation

procedure DoSomething; // 过程主体
begin
end;

Then you jump from MakeIt to the body. The IDE searches for a fitting body, does not find one, and hence searches for a candidate. Since you renamed only one procedure there is exactly one body without definition (DoSomething) and so it will jump to DoSomething and position the cursor right on 'DoSomething'. Then you can simply rename it there too. This works for parameters as well.

引入文件

引入文件是使用{$I 文件名} 或 {$INCLUDE 文件名}编译指令。Lazarus和FPC大量采用它,以减少冗余,为考虑平台兼容性,可以使用{$IFDEF}结构。

Contrary to Delphi, the Lazarus IDE has full support for include files. You can for example jump from the method in the .pas file to the method body in the include file. All codetools like code completion consider include files as special bounds.

For instance: When code completion adds a new method body behind another method body, it keeps them both in the same file. This way you can put whole class implementations in include files, like the LCL does for nearly all controls.

But there is a newbie trap: If you open an include file for the first time and try method jumping or find declaration you will get an error. The IDE does not know to which unit the include file belongs. You must open the unit first.

As soon as the IDE parses the unit, it will parse the include directives there and the IDE will remember this relationship. It saves this information on exit and on project save to ~/.lazarus/includelinks.xml. The next time you open this include file and jump or do a find declaration, the IDE will internally open the unit and the jump will work. You can also hint the IDE by putting

{%mainunit yourunit.pas} 

on the top of yourinclude.inc.

This mechanism has of course limits. Some include files are included twice or more. For example: lcl/include/winapih.inc.

Jumping from the procedure/method definitions in this include file to the bodies depends on your last actions. If you worked on lcl/lclintf.pp the IDE will jump to winapi.inc. If you worked on lcl/interfacebase.pp, then it will jump to lcl/include/interfacebase.inc (or one of the other include files). If you are working on both, then you can get confused. ;)

代码模板

代码模板将标识符转换为文本或代码片段。

默认快捷键是Ctrl+J。输入一个标识符,之后按Ctrl+J键将会替换该标识符为选定的内容。代码模板可以在“工具”菜单->“选项“->“代码工具”里设置。

如,在标识符classf后按Ctrl+Jclassf将被替换为:

T = class(T)
private

public
  constructor Create;
  destructor Destroy; override;
end;

并且光标在T后面。你可以将光标定位在空白位置(而不是标识符那里),按下 Ctrl+J键,将显示代码模板列表。选择一个,将返回选择的代码模板。

输入b之后,按Ctrl+J键,将显示 begin..end; 块。

参数提示

显示参数提示。

例如:

Canvas.FillRect();

将光标置于括号中,按Ctrl+ Shift+space键,将显示FillRect的参数提示信息。

渐进式搜索

渐进式搜索,按Ctrl+E,输入搜索的文本,编辑器会高亮所有搜索到的。

  • 例如,输入e,将搜索并高亮显示所有e的匹配项。
  • 然后,输入t ,将突出显示所有匹配et的文本。
  • 跳转到下一个匹配项,按 F3或(Ctrl+E);跳转到上一匹配项,按 Shift+F3
  • ← Backspace 删除最后一个字符。
  • 停止搜索,可以按 Enter键,或者在代码编辑器中点击鼠标。
  • You can resume the last search by pressing Ctrl+e a second time, immediately after you started incr-search with Ctrl+e. that is while the search term is still empty.
  • Ctrl+V键,粘贴剪贴板中的内容到当前搜索(因为lazarus 0.9.27 r19824)。

注意:快速搜索与渐进式搜索的标识符

  • Place text cursor on identifier (do not select anything) 将光标放在标识符处(不要选择任何内容)。
  • Ctrl+C键,将复制选择的标识符到剪贴板。
  • Ctrl+E键,开始渐进式搜索。
  • Ctrl+V键,搜索标识符(自0.9.27)。
  • F3,向下搜索, Shift+F3向下搜索。
  • 使用任意键(如,光标左、右键)来终止搜索。

Syncro 编辑(同步编辑)

Syncro Edit(同步编辑)可以让你在同一时间同步编辑所有匹配到的内容。你简单的在一个地方编辑,所有匹配的内容也会同步更新。


它适用于所有选择区域的文本:

  • 选择文本块。
  • Ctrl+J或,点击编辑左侧显示的“编辑图标”(SyncroEditIcon.png)。按Tab 键,选择要编辑的内容。
  • 输入新内容。
  • Esc键完成编辑。

这里有动画演示

Light bulb  Note: Ctrl+J也是代码模板的快捷键,如果你选择的不是文本块的话。

查找下一个/上一个出现的单词

这两个功能,可以在源代码编辑器的弹出菜单中找到:

  • 源代码编辑器 / 弹出菜单 / 查找 / 查找下一个发现的词
  • 源代码编辑器 / 弹出菜单 / 查找 / 查找前一个发现的词

And you can assign them shortcuts in the editor options.你也可以在查找菜单中,找到相应菜单项,它与其功能相同,当然也可以使用快捷键。

代码自动完成

代码自动完成,可以在“编辑”菜单->“自动完成代码”,或按Ctrl+ Shift+C键。(新版的Lazarus,在“Source”菜单->“自动完成代码”)

对于Delphians:

Delphi的“代码完成”,按Ctrl+Space将显示标识符列表。在Lazarus中称为“标识符提示”。

代码自动完成,有多种强大功能:

  • 类完成:自动完成属性,在方法体中增加/更新私有变量或私有方法。
  • 前向引用过程完成: 添加过程体。
  • 事件赋值完成:完成事件赋值,并增加了方法定义和主体。
  • 变量声明完成:增加了局部变量定义。
  • 过程调用完成:添加新过程。
  • 反转过程完成:添加过程/函数体声明。
  • 反转类完成:添加了方法体声明。

这个功能的使用,取决于编辑器中光标的位置,下面进行说明。

类自动完成

(翻译不完善不完整,需要修订)

“类完成”是代码完成中最强大的,编写一个类,添加方法和属性,代码完成,将添加方法休,属性访问方法和变量。

如,创建一个类(见代码模板,以节省你的工作时间):

TExample = class(TObject)
public
  constructor Create;
  destructor Destroy; override;
end;

在类中,按Ctrl+ Shift+C键,将会创建缺少的方法,并将光标移到创建的第一个方法体中,所以,你可以开始编写类代码:

{ TExample }

constructor TExample.Create;
begin
  |
end;

destructor TExample.Destroy;
begin
  inherited Destroy;
end;

留意: '|'是光标位置。

提示:你可以按按Ctrl+ Shift+键,在方法与方法体间跳转。

你可以看到,在IDE中加入了继承销毁,因为,在类中定义了override关键字。

现在,添加一个DoSomething方法:

TExample = class(TObject)
public
  constructor Create;
  procedure DoSomething(i: integer);
  destructor Destroy; override;
end;

Ctrl+ Shift+C,将添加:

procedure TExample.DoSomething(i: integer);
begin
  |
end;

你可以看到新的方法体中插入了创建和销毁,因为在类中已经定义。You can define the insertion policy in Environment > Codetools Options -> Code Creation.

完成属性 添加一个AnInteger属性:

TExample = class(TObject)
public
  constructor Create;
  procedure DoSomething(i: integer);
  destructor Destroy; override;
  property AnInteger: Integer;
end;

Ctrl+ Shift+C将得到:

procedure TExample.SetAnInteger(const AValue: integer);
begin
  |if FAnInteger=AValue then exit;
  FAnInteger:=AValue;
end;

代码完成增加了一个写访问修饰符,并增加了一些常代码,跳转到类,按Ctrl+ Shift+

TExample = class(TObject)
private
  FAnInteger: integer;
  procedure SetAnInteger(const AValue: integer);
public
  constructor Create;
  procedure DoSomething(i: integer);
  destructor Destroy; override;
  property AnInteger: integer read FAnInteger write SetAnInteger;
end;

该属性继承了一个读取和写入访问修饰符,这个类得到了一个新的private(私有)变量FAnInteger和SetAnInteger方法。

It is a common Delphi style rule to prepend private variables with an 'F' and the write method with a 'Set'. If you don't like that, you can change this in Environment > Codetools Options -> Code Creation.

创建一个只读属性:

property PropName: PropType read;

将它继承:

property PropName: PropType read FPropName;

创建一个只写属性:

 property PropName: PropType write;

将它继承:

property PropName: PropType write SetPropName;

创建一个只读属性与读取方法:

property PropName: PropType read GetPropName;

保持和GetPropName功能:

function GetpropName: PropType;

创建一个属性与存储的修饰符:

property PropName: PropType stored;

将它继承:

property PropName: PropType read FPropName write SetPropName stored PropNameIsStored;

Because stored is used for streaming read and write modifiers are automatically added as well.

提示: 标识符完成允许不完整的属性,并且会提示的默认名称。例如:

property PropName: PropType read |;

将光标置于一个空格的'读'的关键字,然后按Ctrl+Space,它会给出变量'FPropName'和过程'SetPropName“。

前向引用自动完成

前向引用自动完成是代码完成部分,用于添加缺少的过程体。当光标在一个前向定义的过程上时,

例如: 添加一个新过程在接口部分:

procedure DoSomething;

将光标放在声明上,按Ctrl+ Shift+C,这将创建实现部分:

procedure DoSomething;
begin
  |
end;

提示:你可以按Ctrl+ Shift+,在过程定义与过程体间跳转。

如果已经存在过程,新过程体将添加到类方法中,IDE试图保持有序,例如:

 procedure Proc1;
 procedure Proc2; // 新过程
 procedure Proc3;

如果Proc1和Proc3已经存在,那么Proc2部分会在Proc1和Proc3间添加。This behaviour can be setup in Environment > Codetools Options -> Code Creation.

多个过程:

procedure Proc1_Old; // 过程体存在
procedure Proc2_New; // 过程体不存在
procedure Proc3_New; //  "
procedure Proc4_New; //  "
procedure Proc5_Old; // 过程体存在

代码完成,将添加3个过程体:(Proc2_New, Proc3_New, Proc4_New)。

为什么称它是“前向引用自动完成”?

先了解下,前向引用

Because it does not only work for procedures defined in the interface, but for procedures with the "forward" modifier as well. And because the codetools treats procedures in the interface as having an implicit 'forward' modifier.

事件赋值自动完成

事件赋值自动完成,是代码自动完成的一部分,在使用时,将光标放在要赋值事件的后面。

例如,在FormCreate中添加一行:

OnPaint:=
procedure TForm1.Form1Create(Sender: TObject);
begin
  OnPaint:=|
end;

注意:|是光标所在位置。

Ctrl+ Shift+C后,代码将会:

OnPaint:=@Form1Paint;

Form1Paint方法,将被添加到TForm1类中,

procedure TForm1.Form1Paint(Sender: TObject);
begin
  |
end;

这就像在对象观察器中添加方法。

注意:
你必须把光标放在:=后,但如果你将光标放在标识符后,那么将调用代码自动完成。

提示:
你可以自定义方法名,如:

 OnPaint:=@ThePaintMethod;

变量声明自动完成

变量声明自动完成,将未声明的变量对它声明。

如一个局部变量定义:

标识符:=值;

将光标放置在标识符后面。

procedure TForm1.Form1Create(Sender: TObject);
begin
  i:=3;
end;

将光标位在i后,按Ctrl+ Shift+C将得到:

procedure TForm1.Form1Create(Sender: TObject);
var
  i: Integer;
begin
  i:=3;
end;

如果标识符i已经被定义,并且没有添加声明

var i: integer;

标识符的类型,通过赋值运算来得到类型。像数字3默认为整型。

另一个例子:

type
  TWhere = (Behind, Middle, InFront);
 
  procedure TForm1.Form1Create(Sender: TObject);
  var
    a: array[TWhere] of char;
  begin
    for Where:=Low(a) to High(a) do writeln(a[Where]);
  end;

将光标放置在where后,按Ctrl+ Shift+C将得到:

  procedure TForm1.Form1Create(Sender: TObject);
  var
    a: array[TWhere] of char;
    Where: TWhere;
  begin
    for Where:=Low(a) to High(a) do writeln(a[Where]);
  end;

lazarus 0.9.11后将会完成参数:

  procedure TForm1.FormPaint(Sender: TObject);
  begin
    with Canvas do begin
      Line(x1,y1,x2,y2);
    end;
  end;

将光标放置在x1后,按Ctrl+ Shift+C将得到:

  procedure TForm1.FormPaint(Sender: TObject);
  var
    x1: integer;
  begin
    with Canvas do begin
      Line(x1,y1,x2,y2);
    end;
  end;

过程调用自动完成

代码完成可以通过调用语句本身创建一个新程序。假设你刚编写声明

DoSomething(Width);
procedure SomeProcedure;
var
  Width: integer;
begin
  Width:=3;
  DoSomething(Width);
end;

将光标放在标识符DoSomething上,按Ctrl+ Shift+C,将得到:

procedure DoSomething(aWidth: LongInt);
begin

end;

procedure SomeProcedure;
var
  Width: integer;
begin
  Width:=3;
  DoSomething(Width);
end;

它不会创建函数或方法。

反转类自动完成

声明当前私有方法。自Lazarus 0.9.21后可用。

如:

 procedure TForm1.DoSomething(Sender: TObject);
 begin
 end;

DoSomething未被声明,按Ctrl+ Shift+C,将添加TForm1类的私有方法

procedure DoSomething(Sender: TObject);

对于 Delphians:

Lazarus下完成工作始终是:从类接口来实现向后/反转类声明。Delphi是两个方向,但它有个缺点:让你不注意的一个错字会很容易的创建一个方法。

注释和代码自动完成

Code completion tries to keep comments where they belong. For example:

 FList: TList; // list of TComponent
 FInt: integer;

When inserting a new variable between FList and FInt, the comment is kept in the FList line. Same is true for

 FList: TList; { list of TComponent
   This is a comment over several lines, starting
   in the FList line, so codetools assumes it belongs 
   to the FLIst line and will not break this 
   relationship. Code is inserted behind the comment. }
 FInt: integer;

If the comment starts in the next line, then it will be treated as if it belongs to the code below. For example:

 FList: TList; // list of TComponent
   { This comment belongs to the statement below. 
     New code is inserted above this comment and 
     behind the comment of the FList line. }
 FInt: integer;

方法更新

通常类完成将添加缺少的方法体,自0.9.27,如果类中的方法不同,那么方法体将被更新,如你有一个DoSomething方法:

public
    procedure DoSomething;
end;

procedure TForm.DoSomething;
begin
end;

添加一个参数:

  public
    procedure DoSomething(i: integer);
  end;

Ctrl+ Shift+C,该方法声明将被更新,新的参数将被更新:

procedure TForm.DoSomething(i: integer);
begin
end;

重构

互换指派

"Invert Assignments" takes some selected pascal statements and inverts all assignments from this code. This tool is usefull for transforming a "save" code to a "load" one and inverse operation. 摘要:互换指派,将某些选定的Pascal语句互换。

如:

procedure DoSomething;
begin
  AValueStudio:= BValueStudio;
  AValueAppartment :=BValueAppartment;
  AValueHouse:=BValueHouse;
end;

选择要反转的代码,右击选择重构->互换指派”。(或者,Source菜单->重构->互换指派)。

结果:

procedure DoSomething;
begin
  BValueStudio     := AValueStudio;
  BValueAppartment := AValueAppartment;
  BValueHouse      := AValueHouse;
end;

封装所选

选择一些内容,按Ctrl+ Shift+N,会弹出一个对话框,你可以选择一项,之后,会将所选择的内容,括住。

如,你选择了try..finally项,那么,你选择的内容将会被try..finally括住。

你可以在选择内容上右击,源代码->封装所选;或者,Source菜单->封装所选,都可以实现此功能。

重命名标识符

将光标放在标识符上,并调用它(按F2,或右击重构->重命名标识符;也可以在Source菜单->重构->重命名标识符)。

将弹出对话框,输入新的标识符名称,设置搜索范围。

  • It will rename all occurences and only those that actually use this declaration. That means it does not rename declarations with the same name.
  • 它将重命名所有出现,只有那些真正使用这个声明。这意味着它不重命名声明名称相同的。
  • And it will first check for name conflicts.
  • 它将首先检查名称冲突。
  • Limits: It only works on pascal sources, does not yet rename files nor adapt lfm/lrs files nor lazdoc files.
  • 限制:它仅适用于Pascal源文件,还没有重命名的文件,不适用LFM/LRS文件,也不适用,lazdoc文件。

查找标识符参考

将光标放在标识符上,并调用它(按Ctrl+ Shift+I,或右击查找->查找标识符参考;也可以在查找菜单->查找标识符参考);

在出现的对话框中设置搜索范围,IDE将搜索所有出现的,只有那些真正使用这一标识符的,意味着不会显示相同名称的。

显示抽象方法

This feature lists and auto completes virtual, abstracts methods that need to be implemented. Place the cursor on a class declaration and invoke it. If there are missing abstract methods a dialog will appear listing them. Select the methods to implement and the IDE creates the method stubs.

抽取过程

查看 抽取过程

查找声明

将光标定位在要查找声明的标识符上,右击选择查找声明。之后,将搜索并跳转到所选择标识符的定义部分。

Every find declaration sets a Jump Point. That means you jump with find declaration to the declaration and easily jump back with Search -> Jump back.


在Delphi上有些不同:

The codetools work on sources following the normal pascal rules, instead of using the compiler output. The compiler returns the final type. The codetools see the sources and all steps in between. For example:

The Visible property is first defined in TControl (controls.pp), then redefined in TCustomForm and finally redefined in TForm. Invoking find declaration on Visible will you first bring to Visible in TForm. Then you can invoke Find Declaration again to jump to Visible in TCustomForm and again to jump to Visible in TControl.

可见属性是在TControl (controls.pp)中定义的,然后重新定义TCustomForm在TForm。查找声明时,首先找到TForm,之后再查找时会跳转找到TControl。

像TColor类型,对于编译器它是一个简单的'longint'类型,但在源中其定义是:

TGraphicsColor = -$7FFFFFFF-1..$7FFFFFFF;
TColor = TGraphicsColor;

前向定义类类似,如TControl中,有一个私有变量

FHostDockSite: TWinControl;

查找声明TWinControl,将跳到前向定义。

TWinControl = class;

之后再跳转到真正实现部分

TWinControl = class(TControl)

这样你就可以跟踪每个标识符或查找负载。

提示:

  • Ctrl+H 跳回来
  • 查看所有跳转历史:查看菜单->查看跳转历史
  • With a 5 button Mouse you can use the 2 extra buttons to go forward/backward between the visited points
  • 用5键鼠标,可以使用2个额外的按钮来实现前进/后退光标位置
(你可以使用高级鼠标选项来映射)

标识符自动完成

Ctrl+space调用标识符自动完成,它将显示范围内的所有标识符提示。如:

 procedure TForm1.FormCreate(Sender: TObject);
 begin
   |
 end;

beginend间按Ctrl+space,IDE将分析你的代码,显示所有标识符列表。结果会被缓存,第二次调用时会很快。

Delphians注意::Delphi称为代码完成。

像这些标识符'Write', 'ReadLn', 'Low', 'SetLength', 'Self', 'Result', 'Copy'等被内置到编译器里。 The identifier completion has a lot of these things built in as well. If you find one missing, just create a feature request in the bug tracker.

标识符自动完成,并没有完成所有关键字。所以,人不能用它来完成repe到repeat。对于这些你可以按Ctrl+W关键字自动完成Ctrl+J 代码模板

自0.9.27后,标识符自动完成了,完成了些关键字。

Identifier completion shows even those identifiers, that are not compatible.

前缀

你可以使用一个单词或字母做为前缀,比如说:

 procedure TForm1.FormCreate(Sender: TObject);
 begin
   Ca|ption
 end;

Ca后使用标识符自动完成,将显示所有ca开头的标识符列表。

  • 字母或数字:字符添加到源代码编辑器作为前缀,这将更新列表。
  • 退格键:从前缀中删除一个字符,这将更新列表。
  • Return: replace the whole word at cursor with the selected identifier and close the popup window.
  • Shift+Return: as Return, but replaces only the prefix (left part) of the word at the cursor.
  • 上/下键: 移动选择。
  • ESC键: 不保存信息,关闭弹出对话框。
  • Tab: completes the prefix to next choice. For example: The current prefix is 'But' and the identifier completion only shows 'Button1' and 'Button1Click'. Then pressing Tab will complete the prefix to 'Button1'.
  • Else: as Return and add the character to the source editor

方法

当光标在类中定义方法时,使用标识符自动完成会添加相应参数并添加override关键字。例如:

TMainForm = class(TForm)
protected
  mous|
end;

完成的MouseDown

TMainForm = class(TForm)
protected
  procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X,
         Y: Integer); override;
end;

属性

property MyInt: integer read |;

标识符自动完成,将显示FMyIntGetMyInt

property MyInt: integer write |;

标识符自动完成,将显示FMyIntSetMyInt

引用部分/单元名称

In uses sections the identifier completion will show the filenames of all units in the search path. These will show all lowercase (e.g. avl_tree), because most units have lowercase filenames. On completion it will insert the nice case of the unit (e.g. AVL_Tree).

引用某些单元文件时,使用标识符自动完成,将显示它们的文件路径,文件名通常是小写的(像avl_tree),完成后,会插入像AVL_Tree一样的名称。

语句

procedure TMainForm.Button1Click(Sender: TObject);
begin
  ModalRe|;
end;

变为:

procedure TMainForm.Button1Click(Sender: TObject);
begin
  ModalResult:=|;
end;

关键字自动完成

Ctrl+W键调用关键词自动完成。它显示了当前打开文件中的匹配到的关键词,你也可以在非Pascal源文件中使用,在注释中也可以使用。

否则,它的工作方式等同于标识符自动完成。

Goto Include Directive

"Goto Include Directive" in the search menu of the IDE jumps to {$I filename} statement where the current include file is used.

发布工程

创建项目副本。If you want to send someone just the sources and compiler settings of your code, this function is your friend.

一个项目目录包含了大量信息,很多是不需要再作公布:lpi文件包含了会话信息(像光标位置 、单元书签),项目目录包含了ppu、o及可执行文件。

要发布工程,在工程菜单下使用发布工程。

:0.9.13版本后,有了新的解决方法,它将会话信息存储在了以lps为扩展名的文件里,这样,当你发布时,lpi文件会清爽很多。

在对话框中你可以设置排除列表和过滤器,也可以完成后使用命令压缩成一个档案。

注释提示

在某些地方IDE将显示帮助提示。如,将鼠标移动在一个标识符上等待几秒钟,将显示与此标识符相关的提示信息。

IDE为了支持常见的注释、编程风格,通常会给予试探:

显示注释提示

注释声明中以<开头(没有空行),将作为其上的提示:

var
  {Comment}
  Identifier: integer;

注释在<之后。

与标识符同行的注释:

var 
  identifier, // Comment
  other,

注释和定义在同一行:

var
  identifier: 
    char; // Comment

<示例:

const
  a = 1;
  //< comment for a
  b = 2;
  // comment for c
  c = 3;

支持三种注释方式

  {Comment}(*Comment*)//Comment
  c = 1;

注释中$%将被忽略。

不显示注释信息

用空行分隔的注释,将不会用于提示显示。像下面的类头部注释将不会被显示:

type
  { TMyClass }
  
  TMyClass = class

类头部注释创建于类完成时。你可以关闭这个功能:在工具菜单->选项中,代码工具->Class completion->类的头注释。 如果你想显示这些提示,删除空行即可。

下面的注释,GL_TRUE将会显示提示,GL_FALSE不会:

  // Boolean
  GL_TRUE                           = 1;
  GL_FALSE                          = 0;