Difference between revisions of "IDE Window: Code Explorer Options"

From Free Pascal wiki
Jump to navigationJump to search
 
(10 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 
{{IDE Window: Code Explorer Options}}
 
{{IDE Window: Code Explorer Options}}
  
 +
[[File:IDE-options-code-explorer.JPG|right|400px|Code Explorer Options]]
 
The dialog is explained here: [[IDE Window: Code Explorer]]
 
The dialog is explained here: [[IDE Window: Code Explorer]]
  
 
== Update ==
 
== Update ==
 +
; Preferred Exhibition Mode
 +
* Category - sort all declarations into categories like constants, variables, types, procedures, ...
 +
* Source - show all declarations as they are in the source
  
=== Preferred Exhibition Mode ===
+
;Refresh automatically
 
+
* Never, only manually - only when pressing the Refresh button
*Category - sort all declarations into categories like constants, variables, types, procedures, ...
+
* When switching file in source editor - when switching to another unit
*Source - show all declarations as they are in the source
+
* On idle - whenever the user does not type or move the mouse
 
 
=== Refresh automatically ===
 
 
 
*Never, only manually - only when pressing the Refresh button
 
*When switching file in source editor - when switching to another unit
 
*On idle - whenever the user does not type or move the mouse
 
  
 
== Categories ==
 
== Categories ==
 
 
Shows the available categories. Check all that you want to see in the code explorer.
 
Shows the available categories. Check all that you want to see in the code explorer.
  
Line 23: Line 20:
  
 
== Code Observer ==
 
== Code Observer ==
 
+
;Complexity
=== Long procedures ===
+
* Long procedures<br />Lists all procedures with more lines of code than in the edit field to the right. Long procedures are hard to read by others. Use the [[IDE Window: Extract Procedure|Extract Procedure]] tool to split it into several procedures.
Lists all procedures with more lines of code than in the edit field to the right. Long procedures are hard to read by others. Use the [[IDE Window: Extract Procedure|Extract Procedure]] tool to split it into several procedures.
+
* Many parameters<br />Lists all procedures with more parameters than in the edit field to the right.
=== Many parameters ===
+
* Many nested procedures<br />Lists all procedures with more nested sub procedures than in the edit field to the right.
Lists all procedures with more parameters than in the edit field to the right.
+
;Empty constructs
=== Many nested procedures ===
+
*Empty procedures<br />Lists all procedures without code. They can contain comments and directives. The code below will be listed under linux.
Lists all procedures with more nested sub procedures than in the edit field to the right.
+
<syntaxhighlight lang=pascal>
=== Empty procedures ===
 
Lists all procedures without code. They can contain comments and directives. For example
 
<Delphi>
 
 
begin
 
begin
 
   {$IFDEF win32}write;{$ENDIF}  
 
   {$IFDEF win32}write;{$ENDIF}  
 
end;
 
end;
</Delphi>
+
</syntaxhighlight>
will be listed under linux.
+
 
=== Empty blocks ===
+
* Empty blocks<br />Lists all empty blocks, like begin..end and repeat..until. Blocks containing comments are not listed. Empty blocks can be endless loops or forgotten to clean up.
Lists all empty blocks, like begin..end and repeat..until. Blocks containing comments are not listed. Empty blocks can be endless loops or forgotten to clean up.
+
* Empty class sections<br />Lists all empty class sections like ''private'', ''public'', ''protected''.
=== Empty class sections ===
+
 
Lists all empty class sections like ''private'', ''public'', ''protected''.
+
;Style
=== Unnamed Constants ===
+
* Unnamed Constants<br />Lists all literal constants in statements, that means constants that have no name. You can define in the text fields below what should not be listed.
Lists all literal constants in statements, that means constants that have no name. You can define in the text fields below what should not be listed.
+
* Unsorted visibility<br />Lists all class sections, that are not sorted. For example if a private section comes behind a public section.
=== Unsorted visibility ===
+
* Unsorted members<br />Lists all class variables, methods and properties that are not sorted alphabetically.
Lists all class sections, that are not sorted. For example if a private section comes behind a public section.
 
=== Unsorted members ===
 
Lists all class variables, methods and properties that are not sorted alphabetically.
 
=== Wrong indentation ===
 
Lists all places with suspicious indentation. For example:
 
  
In the next example the ''then'' statement was accidentally deleted:
+
;Other
<Delphi>
+
* Wrong indentation<br />Lists all places with suspicious indentation. For example: In the next example the ''then'' statement was accidentally deleted:  
 +
<syntaxhighlight lang=pascal>
 
for i:=0 to 10 do
 
for i:=0 to 10 do
 
   if i=0 then
 
   if i=0 then
 
writeln('');
 
writeln('');
</Delphi>
+
</syntaxhighlight>
=== Published properties without default ===
+
* Published properties without default<br />Lists all properties without a default value. For example:
Lists all properties without a default value. For example:
+
<syntaxhighlight lang=pascal>
<Delphi>
 
 
published
 
published
 
   property Flag: booolean read FFlag write SetFlag;
 
   property Flag: booolean read FFlag write SetFlag;
</Delphi>
+
</syntaxhighlight>
 
Since FPC 2.2.4 such properties are treated as if they have the ''nodefault'' specifier. That means they are always saved to the lfm.
 
Since FPC 2.2.4 such properties are treated as if they have the ''nodefault'' specifier. That means they are always saved to the lfm.
=== ToDos ===
+
* ToDos<br />Lists alls ToDos. See the [[IDE Window: ToDo List|ToDo list]].
Lists alls ToDos. See the [[IDE Window: ToDo List|ToDo list]].
 
  
== Ignore next unnamed constants ==
+
;Ignore next unnamed constants
 
These constants will not be listed in the unnamed category. Examples:
 
These constants will not be listed in the unnamed category. Examples:
 
+
<syntaxhighlight lang=pascal>
<Delphi>
 
 
0
 
0
 
1
 
1
Line 77: Line 64:
 
#3
 
#3
 
#$3
 
#$3
</Delphi>
+
</syntaxhighlight>
 +
 
 +
;Ignore constants in next functions
 +
Constants passed as parameters to the following functions will not be listed in the unnamed category. There are two types. For example:
 +
<syntaxhighlight lang=pascal>
 +
Write
 +
.ParamByName
 +
</syntaxhighlight>
 +
 
 +
Note the point in front of ParamByName.
 +
 
 +
Result:
 +
 
 +
<syntaxhighlight lang=pascal>
 +
Write('A'); // 'A' will be ignored
 +
MemStream.Write('A'); // 'A' will be listed
 +
DataModule1.SQLQuery1.Params.ParamByName('ART_ID').AsString; // will be ignored
 +
ParamByName('ART_ID').AsString; // will be listed
 +
</syntaxhighlight>

Latest revision as of 18:20, 13 July 2020

Deutsch (de) English (en)

Code Explorer Options

The dialog is explained here: IDE Window: Code Explorer

Update

Preferred Exhibition Mode
  • Category - sort all declarations into categories like constants, variables, types, procedures, ...
  • Source - show all declarations as they are in the source
Refresh automatically
  • Never, only manually - only when pressing the Refresh button
  • When switching file in source editor - when switching to another unit
  • On idle - whenever the user does not type or move the mouse

Categories

Shows the available categories. Check all that you want to see in the code explorer.

The category Code Observer exists since 0.9.27 and lists uncommon or hard to read code fragments. You can set the details in the next option page.

Code Observer

Complexity
  • Long procedures
    Lists all procedures with more lines of code than in the edit field to the right. Long procedures are hard to read by others. Use the Extract Procedure tool to split it into several procedures.
  • Many parameters
    Lists all procedures with more parameters than in the edit field to the right.
  • Many nested procedures
    Lists all procedures with more nested sub procedures than in the edit field to the right.
Empty constructs
  • Empty procedures
    Lists all procedures without code. They can contain comments and directives. The code below will be listed under linux.
begin
  {$IFDEF win32}write;{$ENDIF} 
end;
  • Empty blocks
    Lists all empty blocks, like begin..end and repeat..until. Blocks containing comments are not listed. Empty blocks can be endless loops or forgotten to clean up.
  • Empty class sections
    Lists all empty class sections like private, public, protected.
Style
  • Unnamed Constants
    Lists all literal constants in statements, that means constants that have no name. You can define in the text fields below what should not be listed.
  • Unsorted visibility
    Lists all class sections, that are not sorted. For example if a private section comes behind a public section.
  • Unsorted members
    Lists all class variables, methods and properties that are not sorted alphabetically.
Other
  • Wrong indentation
    Lists all places with suspicious indentation. For example: In the next example the then statement was accidentally deleted:
for i:=0 to 10 do
  if i=0 then
writeln('');
  • Published properties without default
    Lists all properties without a default value. For example:
published
  property Flag: booolean read FFlag write SetFlag;

Since FPC 2.2.4 such properties are treated as if they have the nodefault specifier. That means they are always saved to the lfm.

Ignore next unnamed constants

These constants will not be listed in the unnamed category. Examples:

0
1
'a'
'abc'
#3
#$3
Ignore constants in next functions

Constants passed as parameters to the following functions will not be listed in the unnamed category. There are two types. For example:

Write
.ParamByName

Note the point in front of ParamByName.

Result:

Write('A'); // 'A' will be ignored
MemStream.Write('A'); // 'A' will be listed
DataModule1.SQLQuery1.Params.ParamByName('ART_ID').AsString; // will be ignored
ParamByName('ART_ID').AsString; // will be listed