# Lazarus IDE Tools

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)

The Lazarus IDE Tools is a library of Free Pascal source parsing and editing tools, called the "codetools".

These tools provide features like Find Declaration, Code Completion, Extraction, Moving Inserting and Beautifying Pascal sources. These functions can save a lot of time and duplicated work. They are customizable, and every feature is available via shortcuts (see Editor Options).

Because they work solely on Pascal sources and understand FPC, Delphi and Kylix code, they do not require compiled units or an installed Borland/Embarcadero compiler. Delphi and FPC code can be edited at the same time, with several Delphi and FPC versions. This makes porting Delphi code to FPC/Lazarus 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, Ctrl+⇧ Shift+X for creating class fields instead of local variables 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:

interface

procedure DoSomething; // procedure definition

implementation

procedure DoSomething; // procedure body
begin
end;

If the cursor is on the procedure body and Ctrl+ Shift+ is pressed, 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 not do this).

For example a procedure with different parameter types:

interface

procedure DoSomething(p: char); // procedure definition

implementation

procedure DoSomething(p: string); // procedure body
begin
end;

Jumping from the definition to the body will position the cursor at the 'string' keyword. This can be used for renaming methods and/or changing the parameters.

For example:
You renamed 'DoSomething' to '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.

## Publish Project

Creates a copy of the whole project. If you want to send someone just the sources and compiler settings of your code, this function is your friend.

A normal project directory contains a lot of information. Most of it is not needed to be published: the .lpi file can contain session information (like caret position and bookmarks of closed units) and the project directory contains a lot of .ppu, .o files and the executable. To create a lpi file with only the base information and only the sources, along with all sub directories use "Publish Project".

Note: Since version 0.9.13 there is a new Project Option that allows you to store session information in a separate file from the normal .lpi file. This new file ends with the .lps extension and only contains session information, which will leave your .lpi file much cleaner.

In the dialog you can setup a filter to include and exclude certain files; with the command after you can compress the output into one archive.

## Hints from comments

At several places the IDE shows hints for an identifier. For example when moving the mouse over an identifier in the source editor and waiting a few seconds. When the IDE shows a hint for an identifier it searches the declaration and all its ancestors and looks for comments and fpdoc files. There are many coding styles and many commenting styles. In order to support many of the common comment styles the IDE uses the following heuristics:

### Comments shown in the hint

Comments in front of a declaration, without empty line and not starting with the < sign:

var
{Comment}
Identifier: integer;

Comments with the < sign belong to the prior identifier.

Comments behind an identifier on the same line:

var
identifier, // Comment
other,

Comments behind the definition on the same line:

var
identifier:
char; // Comment

An example for < sign:

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

All three comment types are supported:

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

Comments starting with $or % are ignored. For example //% Hiddden, //$ Hidden, (*$Hidden*). Comments in front separated with an empty line are treated as not specific to the following identifier. For example the following class header comment is not shown in the hint: type { TMyClass } TMyClass = class The class header comments are created on class completion. You can turn this off in the Options / Codetools / Class completion / Header comment for class. If you want to show the header comment in the hint, just remove the empty line. The following comment will be shown for GL_TRUE, but not for GL_FALSE:  // Boolean GL_TRUE = 1; GL_FALSE = 0; ## Quick Fixes Quick Fixes are menu items for specific compiler messages. They help you to quickly fix the problem. Select a message in the Messages window and right click, or right click in the source editor on the icon to the left. • Unit not found: remove from uses section • Unit not found: find unit in loaded packages and allow to auto add package dependency • Constructing a class "$1" with abstract method "$2": show dialog to override all abstract methods • Local variable "$1" not used: remove definition
• Circular unit reference between $1 and$2: show Unit Dependencies dialog with full path between the two units
• Identifier not found: search via Code Browser
• Identifier not found: search via Cody Dictionary (needs package Cody)
• Recompiling $1, checksum changed for$2: show a dialog with search paths and other information