IDE Window: Codetools Options

From Lazarus wiki
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Deutsch (de) English (en) français (fr)

Codetool options

General

Additional Source search path for all projects/packages

If you are too lazy to setup packages and you do not want to share your projects/packages, then you can set here a global search path. Please note: "global" refers to codetools, and does not include the settings for the compiler. You have to add the path to the fpc.cfg as well.

Jumping (e.g. Method Jumping)

  • Adjust top line due to comment in front: When jumping from method declaration to method body, the IDE tries to position the source editor, so that the top line shown in the editor is the first line of the procedure. Normally a comment in front belongs to the procedure as well. Enable this option to scroll so that the comment is shown too.
  • Center cursor line: If jumping from the method body to the declaration in the class (or interface) the IDE can center line vertically in the editor.
  • Cursor beyond EOL: When the IDE jumps to a new position it is allowed to jump to a nice position, even if this is beyond the end of the line. This must be enabled for the source editor too.
  • Skip forward declarations: When doing a find declaration the codetools searches upwards and stops on the first fit. This might be a forward declaration, e.g. TControl = class;. If this option is enabled the codetools will jump to the real class declaration instead.
  • Jump directly to method body: When Find declaration jumps to a method/procedure declaration it takes an extra jump to the implementation.

Indentation

Since 0.9.29 the source editor has a smarter auto indenter for pascal. It imitates your indentation. For example when you press return after a try the indenter will search for other try..finally blocks and indents accordingly. When pasting code from the clipboard the indenter will indent it too.

  • On break line: Indent when pressing return and breaking the line. If disabled the default indenter of synedit is used, which indents as the line above.
  • On paste form clipboard: Indent when copying text from the clipboard. At the moment it only indents when inserting at column 1.
  • Context sensitive: The indenter searches in the surrounding code for similar code and copies the indentation. This means it searches first the code in front, then the code below. If it is a project unit, all project units are searched. If it is a package unit all package units are searched. Finally the example file is searched. If this option is disabled only the example file is searched.
  • Example file: This file contains beautiful code examples. You can edit the default file or select another. It can be a unit or program source.

For a detailed explanation see Fully automatic indentation.

Class Completion

Insert class part

Defines where to insert new variables and method to the class declaration:

  • Alphabetically
  • Last

Insert methods

Where to insert new method bodies. Methods of the same class are always grouped together.

  • Alphabetically
  • Last
  • Class order: Use the same order as in the class declaration

Method default section

What class visibility should be used for new methods by default (since 1.8).

  • Private
  • Protected
  • Public
  • Published

Flags

  • Mix methods and properties: When adding a new method allow to insert between properties.
  • Update all method signatures:
    • Enabled: Class completion updates all method signature (i.e. case, modifiers) from declaration to implementation.
    • Disabled: Class completion updates only the method signature under the cursor.
  • Header comment for class: Add a { TYourClass } comment in front of type.
  • Implementation comment for class: Add a { TYourClass } comment in front of the first method body.

Header comment for class

Add a header comment in front of the class declaration. For example { TForm }

Implementation comment for class

Add a comment in front of the first method body. For example { TForm }

Property completion

  • Complete properties: Enable to complete incomplete property declarations.
  • Read Prefix - the 'Get' in 'function GetColor: TColor'
  • Write Prefix - the 'Set' in 'procedure SetColor(aValue: TColor)'
  • Stored Prefix - the 'IsStored' in 'function IsStoredColor';
  • Variable Prefix - The new private variable name is this prefix plus property name, e.g. the 'F' in 'FColor'.
  • Set property Variable - the parameter name for the setter, e.g. the 'aValue' in 'procedure SetColor(aValue: TColor)'.
    • is prefix - enable to use aValueColor instead of aValue as parameter name. e.g. 'procedure SetColor(aValueColor: TColor)'.
    • use const - enable to use the 'const' accessor for the parameter. e.g. 'procedure SetColor(const aValue: TColor)'.

Code Creation

In this section you can define, where (and in which order) new procedures and units will be inserted.

Procedure insert policy

Where to insert new procedure bodies

  • Last (at end of source)
  • in front of methods
  • behind methods

Keep order of procedures

When inserting new procedure bodies, keep order of the interface.

Words

Keyword policy

How to write new keywords.

Identifier policy

How to write new identifiers.

Line Splitting

Space

Identifier completion

See the tutorial Identifier completion.

Add semicolon

Allow to add missing semicolon. For example:

 s:=Caption|  //

will add a semicolon. It does not add a semicolon if the identifier is a L-Value like in the following example:

  Button1|

Add assignment operator

This will add a := if the identifier is a L-Value with no sub identifiers. For example:

  Caption|  // Caption is a string, so Caption:=

Automatically invoke after point

If enabled the identifier completion is automatically shown, when user pressed a point . and waited for the time shown in Editor / Automatic Features / Tooltip expression evaluation. For example:

  Button1.|  // typing the point and wait will show the completion box

Add parameter brackets

Replace whole identifier

  • Enable: replace the whole identifier at cursor
  • Disable: replace only the identifier in front of the cursor