Upload
hasbullah-amin
View
241
Download
0
Embed Size (px)
Citation preview
8/2/2019 Lazarus IDE Tools
1/19
Lazarus IDE Tools
From Lazarus wiki
Deutsch (de)English (en)Espaol (es)Suomi (fi)Franais (fr)Japanese (ja) (ko)Nederlands (nl)Portugus (pt) (ru)
lovensky (sk) (zh_CN)
Contents
1 Overview2 Summary Table of IDE shortcuts3 Method Jumping4 Include Files5 Code Templates6 Parameter Hints7 Incremental Search
7.1 Hint: Quick searching an identifier with incremental search8 Syncro Edit9 Find next / previous word occurrence10 Code Completion
10.1 Class Completion10.2 Forward Procedure Completion10.3 Event Assignment Completion10.4 Variable Declaration Completion10.5 Procedure Call Completion10.6 Reversed Class Completion10.7 Comments and Code Completion10.8 Method update
11 Refactoring11.1 Invert Assignments11.2 Enclose Selection11.3 Rename Identifier11.4 Find Identifier References11.5 Show abstract methods11.6 Extract Procedure
12 Find Declaration13 Identifier Completion
13.1 Prefix13.2 Keys13.3 Methods13.4 Properties13.5 Comments not shown in the hint
Overview
The IDE uses a library of pascal source parsing and editing tools, called the "codetools". These tools provide feature
ike find declaration, code completion, extraction, moving inserting and beautifying pascal sources. These functions
8/2/2019 Lazarus IDE Tools
2/19
aves you a lot of time and double work. They are customizable and every feature is available via short cuts (see Ed
Options).
Because they work solely on sources and understand fpc, delphi and kylix code, they don't require compiled units no
n installed Borland compiler. You can edit Delphi and FPC code at the same time. You can even work with several
Delphi and FPC versions at the same time. This makes porting Delphi code much easier.
Summary Table of IDE shortcuts
Declaration Jumping Ctrl +Click or Alt + (jump to declaration of type or variable)
Method Jumping Ctrl + Shift + (toggle between definition and body)
Code Templates Ctrl + J
Syncro Edit Ctrl + J (while text is selected)
Code Completion (Class Completion) Ctrl + Shift + C
Identifier Completion Ctrl + space
Word Completion Ctrl + W
Parameter Hints Ctrl + Shift + space
Incremental Search Ctrl + E
Rename Identifier Ctrl + Shift + E
Method Jumping
To jump between a procedure body (begin..end) and the procedure definition (procedure Name;) use
Ctrl + Shift + .
For example:
nterface
procedure DoSomething;// procedure definition
mplementation
procedure DoSomething;// procedure body
begin
nd;
f the cursor is on the procedure body and you press Ctrl + Shift + , the cursor will jump to the definition.
Pressing Ctrl + Shift + again will jump to the body, after 'begin'.
This works between methods (procedures in classes) as well.
Hints: 'Method Jumping' jumps to the same procedure with the same name and parameter list. If there is no exact
procedure, it jumps to the best candidate and positions the cursor on the first difference. (For Delphians: Delphi can
do this).
For example a procedure with different parameter types:
nterface
procedure DoSomething(p:char);// procedure definition
mplementation
8/2/2019 Lazarus IDE Tools
3/19
procedure DoSomething(p:string);// procedure body
begin
nd;
umping from the definition to the body will position the cursor at the 'string' keyword. This can be used for renamin
methods and/or changing the parameters.
For example:
You renamed 'DoSomething' to 'MakeIt':
nterface
procedure MakeIt;// procedure definition
mplementation
procedure DoSomething;// procedure body
begin
nd;
Then you jump from MakeIt to the body. The IDE searches for a fitting body, does not find one, and hence searches
candidate. Since you renamed only one procedure there is exactly one body without definition (DoSomething) andt 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
nclude files are files inserted into sources with the {$I filename} or {$INCLUDE filename} compiler directive.
Lazarus and FPC often uses include files to reduce redundancy and avoid unreadable {$IFDEF} constructs needed t
upport different platforms.
Contrary to Delphi, the Lazarus IDE has full support for include files. You can for example jump from the method in
he .pas file to the method body in the include file. All codetools like code completion consider include files as speci
bounds.
For instance: When code completion adds a new method body behind another method body, it keeps them both in th
ame file. This way you can put whole class implementations in include files, as the LCL does for nearly all controls
But there is a trap for newbies: If you open an include file for the first time and try method jumping or find declarati
you will get an error. The IDE does not yet 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 relations
t saves this information on exit and on project save to ~/.lazarus/includelinks.xml. The next time you open this inclu
ile and jump or do a find declaration, the IDE will internally open the unit and the jump will work. You can also hin
he IDE by putting
%mainunit yourunit.pas}
t the top of yourinclude.inc.
Of course this mechanism has limits. Some include files are included twice or more. For example: lcl/include
winapih.inc.
How you will jump from the procedure/method definitions in this include file to their bodies will depend on your last
8/2/2019 Lazarus IDE Tools
4/19
ction. If you worked on lcl/lclintf.pp the IDE will jump to winapi.inc. If you worked on lcl/interfacebase.pp, then it
ump to lcl/include/interfacebase.inc (or one of the other include files). If you are working on both, then you can get
onfused. ;)
Code Templates
Code Templates converts an identifier into a text or code fragment.
Code Templates default short cut is Ctrl + J . You can type an identifier, press Ctrl + J and the identifier is replac
by the text defined for the identifier. Code Templates can be defined in Environment -> Editor Options -> CodeTool
Example: Write the identifier 'classf', leave the cursor right behind the 'f' and press Ctrl + J . The 'classf' will be
eplaced by
=class(T)
private
public
constructor Create;
destructor Destroy;override;
nd;
nd the cursor is behind the 'T'. You can get the list of templates by positioning the cursor on space (not on an identi
nd pressing Ctrl + J . The list of code templates will pop up. Use the cursor keys or type some chars to choose one
Return creates the selected template and Escape closes the pop up.
The biggest time savers are templates 'b'+ Ctrl + J for begin..end.
Parameter Hints
Parameter Hints shows a hint box with the parameter declarations for the current parameter list.
For example
Canvas.FillRect(|);
Place the cursor in the brackets and press Ctrl + Shift + space . A hint box will show up showing the parameters
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.
8/2/2019 Lazarus IDE Tools
5/19
Note: The short cut's name is "Show code context".
Incremental Search
ncremental Search changes the statusbar of the source editor. Type some characters and the editor will search and
highlight immediately all occurrences in the text. Shortcut is Ctrl + e .
For example pressing e will search and highlight all occurrences of 'e'.
Then pressingt
will search and highlight all occurrences of 'et' and so forth.You can jump to the next with F3 (or Ctrl + e while in search) and the previous with Shift + F3 .Backspace deletes the last characterreturn stops the search without adding a new line in the editor.You can resume the last search by pressing Ctrl + e a second time, immediately after you started incr-searchwith Ctrl + e . that is while the search term is still empty.Paste Ctrl + V will append the text from the clipboard to the current search text (since lazarus 0.9.27 r19824
Hint: Quick searching an identifier with incremental search
Place text cursor on identifier (do not select anything)
Press Ctrl + C . The source editor will select the identifier and copy it to the clipboardPress Ctrl + E to start incremental searchPress Ctrl + V to search for the identifier (since 0.9.27)Use F3 and Shift + F3 to quickly jump to next/previous.Use any key (for example cursor left or right) to end the search
Syncro Edit
Syncro Edit allows you to edit all occurrences of a word at the same time (synchronized). You simple edit the word i
one place, and as you type, all other occurrences of the word are updated too.
Syncro Edit works on all words in a selected area:
Select a block of textpress Ctrl + J or click the icon in the gutter. (This only works, if there are any words that occur more than onin the selection.use the Tab key to select the word you want to edit (if several different words occurred more than once)Edit the wordPress Esc to finish
See an animated example here
Note: Ctrl + J is also used for template edit. It switches it's meaning if you select some text.
Find next / previous word occurrence
The two functions can be found in the popup menu of the source editor
Source editor / popup menu / Find / Find next word occurrenceSource editor / popup menu / Find / Find previous word occurrence
And you can assign them shortcuts in the editor options.
8/2/2019 Lazarus IDE Tools
6/19
Code Completion
Code Completion can be found in the IDE menu Edit -> Complete Code and has as standard short cut
Ctrl + Shift + C .
For Delphians: Delphi calls "code completion" the function showing the list of identifiers at the current source positi
Ctrl + Space ). Under Lazarus this is called "Identifier completion".
Code Completion combines several powerful functions. Examples:
Class Completion: completes properties, adds/updates method bodies, add private variables and private accessmethodsForward Procedure Completion: adds procedure bodiesEvent Assignment Completion: completes event assignments and adds method definition and bodyVariable Declaration Completion: adds local variable definitionsProcedure Call Completion: adds a new procedureReversed procedure completion: adds procedure declarations for procedure/function bodiesReversed Class Completion: adds method declarations for method bodies
Which function is used, depends on the cursor position in the editor and will be explained below.
Code Completion can be found in the IDE menu Edit -> Complete Code and has as standard short cut
Ctrl + Shift + C .
Class Completion
The most powerful code completion feature is "Class Completion". You write a class, add the methods and propertie
nd Code Completion will add the method bodies, the property access methods/variables and the private variables.
For example: Create a class (see Code Templates to save you some type work):
Example =class(TObject)
public
constructor Create;
destructor Destroy;override;
nd;
Position the cursor somewhere in the class and press Ctrl + Shift + C . This will create the method missing bodie
nd move the cursor to the first created method body, so you can just start writing the class code:
TExample }
constructor TExample.Create;begin
|
nd;
destructor TExample.Destroy;
begin
inherited Destroy;
nd;
Note: The '|' is the cursor and is not added.
Hint: You can jump between a method and its body with Ctrl + Shift + .
8/2/2019 Lazarus IDE Tools
7/19
You can see, that the IDE added the 'inherited Destroy' call too. This is done, if there is an 'override' keyword in the
lass definition.
Now add a method DoSomething:
Example =class(TObject)
public
constructor Create;
procedure DoSomething(i:integer);
destructor Destroy;override;
nd;
Then press Ctrl + Shift + C and the IDE will add
procedure TExample.DoSomething(i:integer);
begin
|
nd;
You can see, that the new method body is inserted between Create and Destroy, exactly as in the class definition. Th
way the bodies keep the same logical ordering as you define. You can define the insertion policy in Environment >
Codetools Options -> Code Creation.
Complete PropertiesAdd a property AnInteger:
Example =class(TObject)
public
constructor Create;
procedure DoSomething(i:integer);
destructor Destroy;override;
property AnInteger:Integer;
nd;
Press Ctrl+Shift+C and you will get:
procedure TExample.SetAnInteger(const AValue:integer);
begin
|if FAnInteger=AValue thenexit;
FAnInteger:=AValue;
nd;
The code completion has added a Write access modifier and added some common code. Jump to the class with
Ctrl + Shift + to see the new class:
Example =class(TObject)
private
FAnInteger:integer;
procedure SetAnInteger(const AValue:integer);
public
constructor Create;
procedure DoSomething(i:integer);
destructor Destroy;override;
property AnInteger:integerread FAnInteger write SetAnInteger;
nd;
The property was extended by a Read and Write access modifier. The class got the new section 'private' with a Varia
8/2/2019 Lazarus IDE Tools
8/19
FAnInteger' and the method 'SetAnInteger'. It is a common Delphi style rule to prepend private variables with an 'F'
he write method with a 'Set'. If you don't like that, you can change this in Environment > Codetools Options -> Cod
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 |;
Place the cursor one space behind the 'read' keyword and press Ctrl+Space for the identifier completion. It will prese
you the variable 'FPropName' and the procedure 'SetPropName'.
Forward Procedure Completion
8/2/2019 Lazarus IDE Tools
9/19
Forward Procedure Completion" is part of the Code Completion and adds missing procedure bodies. It is invoked,
when the cursor is on a forward defined procedure.
For example: Add a new procedure to the interface section:
procedure DoSomething;
Place the cursor on it and press Ctrl + Shift + C for code completion. It will create in the implementation sectio
procedure DoSomething;
begin
|
nd;
Hint: You can jump between a procedure definition and its body with Ctrl + Shift + .
The new procedure body will be added in front of the class methods. If there are already some procedures in the
nterface the IDE tries to keep the ordering. For example:
procedure Proc1;procedure Proc2;// new proc
procedure Proc3;
f the bodies of Proc1 and Proc3 already exists, then the Proc2 body will be inserted between the bodies of Proc1 an
Proc3. This behaviour can be setup in Environment > Codetools Options -> Code Creation.
Multiple procedures:
procedure Proc1_Old;// body exists
procedure Proc2_New;// body does not exists
procedure Proc3_New;// "
procedure Proc4_New;// "
procedure Proc5_Old;// body exists
Code Completion will add all 3 procedure bodies (Proc2_New, Proc3_New, Proc4_New).
Why calling it "Forward Procedure Completion"?
Because it does not only work for procedures defined in the interface, but for procedures with the "forward" modifie
s well. And because the codetools treats procedures in the interface as having an implicit 'forward' modifier.
Event Assignment Completion
Event Assignment Completion" is part of the Code Completion and completes a single Event:=| statement. It is
nvoked, when the cursor is behind an assignment to an event.
For example: In a method, say the FormCreate event, add a line 'OnPaint:=':
procedure TForm1.Form1Create(Sender:TObject);
begin
OnPaint:=|
nd;
8/2/2019 Lazarus IDE Tools
10/19
The '|' is the cursor and should not be typed. Then press Ctrl+Shift+C for code completion. The statement will be
ompleted to
nPaint:=@Form1Paint;
A new method Form1Paint will be added to the TForm1 class. Then class completion is started and you get:
procedure TForm1.Form1Paint(Sender:TObject);
begin|
nd;
This works just like adding methods in the object inspector.
Note:
You must place the cursor behind the ':=' assignment operator. If you place the cursor on the identifier (e.g. OnPaint)
ode completion will invoke "Local Variable Completion", which fails, because OnPaint is already defined.
Hint:
You can define the new method name by yourself. For example:
OnPaint:=@ThePaintMethod;
Since 0.9.31 Lazarus completes procedure parameters. For example
procedure TForm1.FormCreate(Sender:TObject);
var
List: TList;
begin
List:=TList.Create;
List.Sort(@MySortFunction|);
nd;
Place the cursor on 'MySortFunction' and press Ctrl + Shift + C for code completion. You get a new procedure:
function MySortFunction(Item1, Item2:Pointer):Integer;
begin
|
nd;
procedure TForm1.FormCreate(Sender:TObject);
var
List: TList;begin
List:=TList.Create;
List.Sort(@MySortFunction);
nd;
Variable Declaration Completion
Variable Declaration Completion" is part of the Code Completion and adds a local variable definition for a
dentifier:=Term; statement. It is invoked, when the cursor is on the identifier of an assignment or a parameter.
For example:
8/2/2019 Lazarus IDE Tools
11/19
procedure TForm1.Form1Create(Sender:TObject);
begin
i:=3;
nd;
Place the cursor on the 'i' or just behind it. Then press Ctrl + Shift + C for code completion and you will get:
procedure TForm1.Form1Create(Sender:TObject);
var
i:Integer;begin
i:=3;
nd;
The codetools first checks, if the identifier 'i' is already defined and if not it will add the declaration 'var i: integer;'. T
ype of the identifier is guessed from the term right to the assignment ':=' operator. Numbers like the 3 defaults to
nteger.
Another example:
ype
TWhere =(Behind, Middle, InFront);
procedure TForm1.Form1Create(Sender:TObject);
var
a:array[TWhere]ofchar;
begin
for Where:=Low(a)toHigh(a)dowriteln(a[Where]);
end;
Place the cursor on 'Where' and press Ctrl + Shift + C for code completion. You get:
procedure TForm1.Form1Create(Sender:TObject);
vara:array[TWhere]ofchar;
Where: TWhere;
begin
for Where:=Low(a)toHigh(a)dowriteln(a[Where]);
end;
Since 0.9.11 Lazarus also completes parameters. For example
procedure TForm1.FormPaint(Sender:TObject);
begin
with Canvas dobegin
Line(x1,y1,x2,y2);
end;
end;
Place the cursor on 'x1' and press Ctrl + Shift + C for code completion. You get:
8/2/2019 Lazarus IDE Tools
12/19
procedure TForm1.FormPaint(Sender:TObject);
var
x1:integer;
begin
with Canvas dobegin
Line(x1,y1,x2,y2);
end;
end;
Since 0.9.31 Lazarus completes pointer parameters. For example
procedure TForm1.FormCreate(Sender:TObject);
begin
CreateIconIndirect(@IconInfo);
end;
Place the cursor on 'IconInfo' and press Ctrl + Shift + C for code completion. You get:
procedure TForm1.FormCreate(Sender:TObject);
var
IconInfo: TIconInfo;
begin
CreateIconIndirect(@IconInfo);end;
Procedure Call Completion
Code completion can create a new procedure from a call statement itself.
Assume you just wrote the statement "DoSomething(Width);"
procedure SomeProcedure;
var
Width:integer;
begin
Width:=3;
DoSomething(Width);
nd;
Position the cursor over the identifier "DoSomething" and press Ctrl + Shift + C to get:
procedure DoSomething(aWidth:LongInt);
begin
nd;
procedure SomeProcedure;
var
Width:integer;
begin
Width:=3;
DoSomething(Width);
nd;
t does not yet create functions nor methods.
Reversed Class Completion
8/2/2019 Lazarus IDE Tools
13/19
Reversed Class Completion" is part of the Code Completion and adds a private method declaration for the currentmethod body. It is invoked, when the cursor is in a method body, not yet defined in the class. This feature is availabl
ince Lazarus 0.9.21.
For example:
procedure TForm1.DoSomething(Sender:TObject);
begin
end;
The method DoSomething is not yet declared in TForm1. Press Ctrl + Shift + C and the IDE will add "procedur
DoSomething(Sender: TObject);" to the private methods of TForm1.
For Delphians: Class completion works under Lazarus always in one way: From class interface to implementation or
backwards/reversed from class implementation to interface. Delphi always invokes both directions. The Delphi way
he disadvantage, that if a typo will easily create a new method stub without noticing.
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;
f 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
Normally class completion will add all missing method bodies. (Since 0.9.27) But if exactly one method differ betwe
lass and bodies then the method body is updated. For example: You have a methodDoSomething.
public
procedure DoSomething;
end;
procedure TForm.DoSomething;
begin
nd;
8/2/2019 Lazarus IDE Tools
14/19
Now add a parameter:
public
procedure DoSomething(i:integer);
end;
nd invoke Code Completion ( Ctrl + Shift + C ). The method body will be updated and the new parameter will b
opied:
procedure TForm.DoSomething(i:integer);
begin
nd;
Refactoring
nvert Assignments
Abstract: "Invert Assignments" takes some selected pascal statements and inverts all assignments from this code. Thistool is usefull for transforming a "save" code to a "load" one and inverse operation.
Example:
procedure DoSomething;
begin
AValueStudio:= BValueStudio;
AValueAppartment :=BValueAppartment;
AValueHouse:=BValueHouse;
nd;
Select the lines with assignments (between begin and end) and do Invert Assignments. All assignments will be invertnd identation will be add automatically. For example:
Result:
procedure DoSomething;
begin
BValueStudio := AValueStudio;
BValueAppartment := AValueAppartment;
BValueHouse := AValueHouse;
nd;
Enclose Selection
Select some text and invoke it. A dialog will popup where you can select if the selection should be enclosed into
ry..finally or many other common blocks.
Rename Identifier
Place the cursor on an identifier and invoke it. A dialog will appear, where you can setup the search scope and the n
name.
It will rename all occurences and only those that actually use this declaration. That means it does not rename
8/2/2019 Lazarus IDE Tools
15/19
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.
Find Identifier References
Place the cursor on an identifier and invoke it. A dialog will appear, where you can setup the search scope. The IDE
will then search for all occurences and only those that actually use this declaration. That means it does not show oth
declarations with the same name.
Show abstract methods
This feature lists and auto completes virtual, abstracts methods that need to be implemented. Place the cursor on a cl
declaration and invoke it. If there are missing abstract methods a dialog will appear listing them. Select the methods
mplement and the IDE creates the method stubs.
Extract Procedure
See Extract Procedure
Find Declaration
Position the cursor on an identifier and do 'Find Declaration'. Then it will search the declaration of this identifier, op
he file and jump to it. If the cursor is already at a declaration it will jump to the previous declaration with the same
name. This allows to find redefinitions and overrides.
Every find declaration sets a Jump Point. That means you jump with find declaration to the declaration and easily ju
back with Search -> Jump back.
There are some differences to Delphi: The codetools work on sources following the normal pascal rules, instead of u
he compiler output. The compiler returns the final type. The codetools see the sources and all steps in between. For
xample:
The Visible property is first defined in TControl (controls.pp), then redefined in TCustomForm and finally redefined
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.
Same is true for types like TColor. For the compiler it is simply a 'longint'. But in the sources it is defined as
GraphicsColor =-$7FFFFFFF-1..$7FFFFFFF;
Color = TGraphicsColor;
And the same for forward defined classes: For instance in TControl, there is a private variable
HostDockSite: TWinControl;
Find declaration on TWinControl jumps to the forward definition
WinControl =class;
8/2/2019 Lazarus IDE Tools
16/19
And invoking it again jumps to the real implementation
WinControl =class(TControl)
This way you can track down every identifier and find every overload.
Hints:
You can jump back with Ctrl + H .You can view/navigate all visited locations via Menu: View -> "jump history"With a 5 button Mouse you can use the 2 extra buttons to go forward/backward between the visited points
(you can remap the buttons using advanced mouse options)
Identifier Completion
Identifier Completion" is invoked by Ctrl + space . It shows all identifiers in scope. For example:
procedure TForm1.FormCreate(Sender:TObject);
begin
|
nd;
Place the cursor between begin and endand press Ctrl + space . The IDE/CodeTools will now parse all reachable co
nd present you a list of all found identifiers. The CodeTools cache the results, so invoking it a second time will be
much faster.
Note for Delphians: Delphi calls it Code completion.
Some identifiers like 'Write', 'ReadLn', 'Low', 'SetLength', 'Self', 'Result', 'Copy' are built into the compiler and are no
defined anywhere in source. The identifier completion has a lot of these things built in as well. If you find one missinust create a feature request in the bug tracker.
dentif ier completion does not complete all keywords. So you can not use it to complete 'repe' to 'repeat'. For thesehings use Ctrl + W Word Completion or Ctrl + J Code Templates. Since 0.9.27 identifier completion completes
ome keywords.
dentifier completion shows even those identifiers, that are not compatible.
Prefix
You can start identifier completion in a word. Then the letters to the left will be taken as prefix. For example:
procedure TForm1.FormCreate(Sender:TObject);
begin
Ca|ption
nd;
The box will show you only the identifiers beginning with 'Ca'.
Keys
8/2/2019 Lazarus IDE Tools
17/19
Letter or number: add the character to the source editor and the current prefix. This will update the list.Backspace: remove the last character from source editor and prefix. Updates the list.Return: replace the whole word at cursor with the selected identifier and close the popup window.Shift+Return: asReturn, but replaces only the prefix (left part) of the word at the cursor.Up/Down: move selectionEscape: close popup without changeTab: completes the prefix to next choice. For example: The current prefix is 'But' and the identifier completiononly shows 'Button1' and 'Button1Click'. Then pressing Tab will complete the prefix to 'Button1'.Else: asReturn and add the character to the source editor
Methods
When cursor is in a class definition and you identifier complete a method defined in an ancestor class the parameter
nd the override keyword will be added automatically. For example:
MainForm =class(TForm)
protected
mous|
nd;
Completing MouseDown gives:
MainForm =class(TForm)
protected
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X,
Y:Integer);override;
nd;
Properties
property MyInt:integerread |;
dentifier completion will show '''FMyInt'''and'''GetMyInt'''.
syntaxhighlight>property MyInt:integerwrite |;
dentifier completion will show '''FMyInt'''and'''SetMyInt'''.
==Uses section /Unit names===
nuses sections the identifier completion will show the filenames of all units in the search path.These will
==Statements===
DELPHI>procedure TMainForm.Button1Click(Sender:TObject);
begin
ModalRe|;nd;
ecomes:
DELPHI>procedure TMainForm.Button1Click(Sender:TObject);
begin
ModalResult:=|;
nd;
=Word Completion==
Word Completion" is invoked by {{keypress|Ctrl|W}}.It shows all words of all currently open editors and can t
therwise it works the same as identifier completion.
=GotoInclude Directive==
GotoInclude Directive" in the search menu of the IDE jumps to{$I filename} statement where the current inclu
8/2/2019 Lazarus IDE Tools
18/19
=Publish Project==
reates a copyof the whole project.If you want to send someone just the sources and compiler settings of your
A normal project directory contains a lot of information.Mostof it isnot needed to be published:
he .lpifilecontains session information (like caret position and bookmarks of closed units)and the project
To create a lpi filewith only the base information and only the sources, along with all sub directories use "P
''Note''': Since version 0.9.13 there is a new''Project Option'' that allows you to store session information
n the dialog you can setup the excludeandinclude filter,andwith the command after you can compress the out
=Hints from comments==
At several places the IDE shows hints for an identifier.For example when moving the mouse over an identifier i
When the IDE shows a hints for an identifier it searches the declaration and all its ancestors and looks for co
==Comments shown in the hint===
omments in front of a declaration, without empty line andnot starting with the '''
8/2/2019 Lazarus IDE Tools
19/19
ype
{ TMyClass }
TMyClass =class
The class header comments are created on class completion. You can turn this off in the Options / Codetools / Class
ompletion / Header comment for class. If you want to show the header comment in the hint, just remove the empty
ine.
The following comment will be shown for GL_TRUE, but not for GL_FALSE:
// Boolean
GL_TRUE =1;
GL_FALSE =0;
Retrieved from "http://wiki.lazarus.freepascal.org/index.php?title=Lazarus_IDE_Tools&oldid=56926"
Category: Lazarus
This page was last modified on 24 March 2012, at 22:50.
Content is available under .