Lazarus IDE Tools/zh CN Table of Contents Lazarus IDE Tools/zh CN.....................................................................................................................1 概述.................................................................................................................................................2 IDE 快捷键列表..............................................................................................................................2 方法跳转 Method Jumping.............................................................................................................2 引入文件 Include Files....................................................................................................................3 代码模板 Code Templates...............................................................................................................3 参数提示 Parameter Hints...............................................................................................................4 渐进式搜索 Incremental Search......................................................................................................4 注意:快速搜索与渐进式搜索的标识符.................................................................................4 同步编辑 Syncro Edit......................................................................................................................5 查找下一个/上一个出现的单词 Find next / previous word occurrence........................................5 代码自动完成 Code Completion....................................................................................................5 类自动完成 Class Completion...................................................................................................5 前向引用自动完成 Forward Procedure Completion.................................................................7 事件赋值自动完成 Event Assignment Completion...................................................................8 变量声明自动完成 Variable Declaration Completion...............................................................9 过程调用自动完成 Procedure Call Completion......................................................................10 反转类自动完成 Reversed Class Completion.........................................................................10 注释和代码自动完成 Comments and Code Completion.........................................................11 方法更新 Method update..........................................................................................................11 重构 Refactoring............................................................................................................................11 互换指派 Invert Assignments...................................................................................................12 封装所选 Enclose Selection.....................................................................................................12 重命名标识符 Rename Identifier.............................................................................................12 查找标识符参考 Find Identifier References............................................................................12 显示抽象方法 Show abstract methods.....................................................................................12 抽取过程 Extract Procedure.....................................................................................................13 查找声明 Find Declaration............................................................................................................13 标识符自动完成 Identifier Completion........................................................................................13 前缀...........................................................................................................................................14 键...............................................................................................................................................14 方法...........................................................................................................................................14 属性...........................................................................................................................................14 引用部分/单元名称..................................................................................................................14 语句...........................................................................................................................................15 关键字自动完成...........................................................................................................................15 Goto Include Directive...................................................................................................................15 发布工程.......................................................................................................................................15 注释提示.......................................................................................................................................15 显示注释提示...........................................................................................................................15 不显示注释信息.......................................................................................................................16 概述 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 方法跳转 Method Jumping 要在过程体(begin..end)与过程定义(procedure 过程名)间跳转,使用 Ctrl + ⇧ Shift + ↑ . 示例: interface procedure DoSomething; // procedure definition implementation procedure DoSomething; // procedure body begin end; 如果光标在过程体,当你按 Ctrl + ⇧ Shift + ↑ 时,会跳转到其定义,再次按 Ctrl + ⇧ Shift + ↑ 会跳转到过程体; 如此循环。 在方法间(类中的过程)也是如此。 注意: 方法跳转,将跳转到具有相同名称和参数列表的地方,如果没有,它将跳到最佳匹配的地方,并将光标定位在第一 个上面。(对于 Delphians:Delphi 不能做到这一点。) 例如,不同参数类型的过程: interface procedure DoSomething(p: char); // procedure definition implementation procedure DoSomething(p: string); // procedure body begin end; 自定义跳转会在'string'处定位光标,这可用于重命名方法或改变参数。 如: 你更名'DoSomething' 为 'MakeIt': interface procedure MakeIt; // procedure definition implementation procedure DoSomething; // procedure body 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. 引入文件 Include Files 引入文件是使用{$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. ;) 代码模板 Code Templates 代码模板将标识符转换为文本或代码片段。 默认快捷键是 Ctrl + J 。输入一个标识符,之后按 Ctrl + J 键将会替换该标识符为选定的内容。代码模板可以在“工具” 菜单->“选项“->“代码工具”里设置。 如,在标识符 classf 后按 Ctrl + J ,classf 将被替换为: T = class(T) private public constructor Create; destructor Destroy; override; end; 并且光标在 T 后面。你可以将光标定位在空白位置(而不是标识符那里),按下 Ctrl + J 键,将显示代码模板列表。选 择一个,将返回选择的代码模板。 输入 b 之后,按 Ctrl + J 键,将显示 begin..end; 块。 参数提示 Parameter Hints 显示参数提示。 例如: Canvas.FillRect(); 将光标置于括号中,按 Ctrl + ⇧ Shift + space 键,将显示 FillRect 的参数提示信息。 Since 0.9.31 there is a button to the right of each declaration to insert the missing parameters.This will copy the parameter names from the chosen declaration to the cursor position. Hint: Use the Variable Declaration Completion to declare the variables. 渐进式搜索 Incremental Search 渐进式搜索,按 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 Edit Syncro Edit(同步编辑)可以让你在同一时间同步编辑所有匹配到的内容。你简单的在一个地方编辑,所有匹配的内容也 会同步更新。 它适用于所有选择区域的文本: 选择文本块。 按 Ctrl + J ,或点击编辑左侧显示的“编辑图标”( 输入新内容。 按 Esc 键完成编辑。 )。按 Tab ⇆ 键,选择要编辑的内容。 这里有动画演示。 Note: Ctrl + J 也是代码模板的快捷键,如果你选择的不是文本块的话。 查找下一个/上一个出现的单词 Find next / previous word occurrence 这两个功能,可以在源代码编辑器的弹出菜单中找到: 源代码编辑器 / 弹出菜单 / 查找 / 查找下一个发现的词 源代码编辑器 / 弹出菜单 / 查找 / 查找前一个发现的词 And you can assign them shortcuts in the editor options.你也可以在查找菜单中,找到相应菜单项,它与其功能相同,当 然也可以使用快捷键。 代码自动完成 Code Completion 代码自动完成,可以在“编辑”菜单->“自动完成代码”,或按 Ctrl + ⇧ Shift + C 键。(新版的 Lazarus,在“Source”菜 单->“自动完成代码”) 对于 Delphians: Delphi 的“代码完成”,按 Ctrl + Space 将显示标识符列表。在 Lazarus 中称为“标识符提示”。 代码自动完成,有多种强大功能: 类完成:自动完成属性,在方法体中增加/更新私有变量或私有方法。 前向引用过程完成: 添加过程体。 事件赋值完成:完成事件赋值,并增加了方法定义和主体。 变量声明完成:增加了局部变量定义。 过程调用完成:添加新过程。 反转过程完成:添加过程/函数体声明。 反转类完成:添加了方法体声明。 这个功能的使用,取决于编辑器中光标的位置,下面进行说明。 类自动完成 Class Completion (翻译不完善不完整,需要修订) “类完成”是代码完成中最强大的,编写一个类,添加方法和属性,代码完成,将添加方法休,属性访问方法和变量。 如,创建一个类(见代码模板,以节省你的工作时间): 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. 属性完成 Complete Properties 添加一个 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. Creating a read only property: property PropName: PropType read; Will be expanded to property PropName: PropType read FPropName; Creating a write only property: property PropName: PropType write; Will be expanded to property PropName: PropType write SetPropName; Creating a read only property with a Read method: property PropName: PropType read GetPropName; Will be kept and a GetPropName function will be added: function GetpropName: PropType; Creating a property with a stored modifier: property PropName: PropType stored; Will be expanded to property PropName: PropType read FPropName write SetPropName stored PropNameIsStored; Because stored is used for streaming read and write modifiers are automatically added as well. Hint: Identifier completion also recognizes incomplete properties and will suggest the default names. For example: property PropName: PropType read |; 将光标置于'read'关键字后面的一个空格中,然后按 Ctrl + Space ,它会给出变量'FPropName'和过程'SetPropName“。 前向引用自动完成 Forward Procedure Completion 前向引用自动完成是代码完成部分,用于添加缺少的过程体。当光标在一个前向定义的过程上时, 例如: 添加一个新过程在接口部分: procedure DoSomething; 将光标放在声明上,按 Ctrl + ⇧ Shift + C ,这将创建实现部分: procedure DoSomething; begin | end; 提示:你可以按 Ctrl + ⇧ Shift + ↑ ,在过程定义与过程体间跳转。 如果已经存在过程,新过程体将添加到类方法中,IDE 试图保持有序,例如: procedure Proc1; procedure Proc2; // new proc procedure Proc3; 如果 Proc1 和 Proc3 已经存在,那么 Proc2 部分会在 Proc1 和 Proc3 间添加。This behaviour can be setup in Environment > Codetools Options -> Code Creation. 多个过程: procedure Proc1_Old; // body exists procedure Proc2_New; // body does not exist procedure Proc3_New; // " procedure Proc4_New; // " procedure Proc5_Old; // body exists 代码完成,将添加 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. 事件赋值自动完成 Event Assignment Completion 事件赋值自动完成,是代码自动完成的一部分,在使用时,将光标放在要赋值事件的后面。 例如,在 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; 变量声明自动完成 Variable Declaration Completion 变量声明自动完成,将未声明的变量对它声明。 如一个局部变量定义: 标识符:=值; 将光标放置在标识符后面。 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; 过程调用自动完成 Procedure Call Completion 代码完成可以通过调用语句本身创建一个新程序。假设你刚编写声明 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; 它不会创建函数或方法。 反转类自动完成 Reversed Class Completion 声明当前私有方法。自 Lazarus 0.9.21 后可用。 如: procedure TForm1.DoSomething(Sender: TObject); begin end; DoSomething 未被声明,按 Ctrl + ⇧ Shift + C ,将添加 TForm1 类的私有方法 procedure DoSomething(Sender: TObject); 对于 Delphians: Lazarus 下完成工作始终是:从类接口来实现向后/反转类声明。Delphi 是两个方向,但它有个缺点:让你不注意的一个错 字会很容易的创建一个方法。 注释和代码自动完成 Comments and Code Completion 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; 方法更新 Method update 通常类完成将添加缺少的方法体,自 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; 重构 Refactoring 互换指派 Invert Assignments "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; 封装所选 Enclose Selection 选择一些内容,按 Ctrl + ⇧ Shift + N ,会弹出一个对话框,你可以选择一项,之后,会将所选择的内容,括住。 如,你选择了 try..finally 项,那么,你选择的内容将会被 try..finally 括住。 你可以在选择内容上右击,源代码->封装所选;或者,Source 菜单->封装所选,都可以实现此功能。 重命名标识符 Rename Identifier 将光标放在标识符上,并调用它(按 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 文件。 查找标识符参考 Find Identifier References 将光标放在标识符上,并调用它(按 Ctrl + ⇧ Shift + I ,或右击查找->查找标识符参考;也可以在查找菜单->查找标 识符参考); 在出现的对话框中设置搜索范围,IDE 将搜索所有出现的,只有那些真正使用这一标识符的,意味着不会显示相同名称的。 显示抽象方法 Show abstract methods 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. 抽取过程 Extract Procedure 查看 抽取过程 查找声明 Find Declaration 将光标定位在要查找声明的标识符上,右击选择查找声明。之后,将搜索并跳转到所选择标识符的定义部分。 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 个额外的按钮来实现前进/后退光标位置 (你可以使用高级鼠标选项来映射) 标识符自动完成 Identifier Completion 按 Ctrl + space 调用标识符自动完成,它将显示范围内的所有标识符提示。如: procedure TForm1.FormCreate(Sender: TObject); begin | end; 在 begin 和 end 间按 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 |; 标识符自动完成,将显示 FMyInt 和 GetMyInt。 property MyInt: integer write |; 标识符自动完成,将显示 FMyInt 和 SetMyInt。 引用部分/单元名称 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 GL_FALSE = 1; = 0;