Difference between revisions of "IDE Window: Codetools Options"

From Free Pascal wiki
Jump to navigationJump to search
m (Fixed syntax highlighting)
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
{{IDE Window: Codetools Options}}
 
{{IDE Window: Codetools Options}}
 +
 +
[[File:IDE-options-codetools.JPG|thumb|400px|Codetool options]]
  
 
== General ==
 
== General ==
Line 16: Line 18:
  
 
* '''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.
 
* '''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 ===
 
=== Indentation ===
Line 37: Line 41:
  
 
Defines where to insert new variables and method to the class declaration:
 
Defines where to insert new variables and method to the class declaration:
 
 
* Alphabetically
 
* Alphabetically
 
* Last
 
* Last
Line 43: Line 46:
 
=== Insert methods ===
 
=== Insert methods ===
  
Where to insert new method bodies:
+
Where to insert new method bodies. Methods of the same class are always grouped together.
 
 
 
* Alphabetically
 
* Alphabetically
 
* Last
 
* Last
 
* Class order: Use the same order as in the class declaration
 
* 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 ===
 
=== Flags ===
Line 69: Line 79:
  
 
* Complete properties: Enable to complete incomplete property declarations.
 
* Complete properties: Enable to complete incomplete property declarations.
* Read Prefix
+
* Read Prefix - the 'Get' in 'function GetColor: TColor'
* Write Prefix
+
* Write Prefix - the 'Set' in 'procedure SetColor(aValue: TColor)'
* Stored Prefix
+
* Stored Prefix - the 'IsStored' in 'function IsStoredColor';
* Variable Prefix
+
* Variable Prefix - The new private variable name is this prefix plus property name, e.g. the 'F' in 'FColor'.
* Set property Variable
+
* 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 ==
 
== Code Creation ==
Line 112: Line 124:
  
 
Allow to add missing semicolon. For example:
 
Allow to add missing semicolon. For example:
<syntaxhighlight>
+
<syntaxhighlight lang=pascal>
 
  s:=Caption|  //  
 
  s:=Caption|  //  
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 118: Line 130:
 
will add a semicolon. It does not add a semicolon if the identifier is a L-Value like in the following example:
 
will add a semicolon. It does not add a semicolon if the identifier is a L-Value like in the following example:
  
<syntaxhighlight>
+
<syntaxhighlight lang=pascal>
 
   Button1|
 
   Button1|
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 126: Line 138:
 
This will add a ''':=''' if the identifier is a L-Value with no sub identifiers. For example:
 
This will add a ''':=''' if the identifier is a L-Value with no sub identifiers. For example:
  
<syntaxhighlight>
+
<syntaxhighlight lang=pascal>
 
   Caption|  // Caption is a string, so Caption:=
 
   Caption|  // Caption is a string, so Caption:=
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 134: Line 146:
 
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:
 
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:
  
<syntaxhighlight>
+
<syntaxhighlight lang=pascal>
 
   Button1.|  // typing the point and wait will show the completion box
 
   Button1.|  // typing the point and wait will show the completion box
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 144: Line 156:
 
*Enable: replace the whole identifier at cursor
 
*Enable: replace the whole identifier at cursor
 
*Disable: replace only the identifier in front of the cursor
 
*Disable: replace only the identifier in front of the cursor
 
[[Category:IDE Window]]
 

Latest revision as of 09:32, 17 February 2020

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