Code Editor

Abstract: Code Editor Features in RAD Studio

    Code Navigation

Software development projects get complicated very quickly, with code and code files expanding to an unweildy state.  Being able to navigate around a code project is key to developer productivity.  RAD Studio makes efficiently navigating code easy and painless.

    Code Browsing (Ctrl-Click/Go To Declaration navigation)

Code Browsing allows developers quickly to navigate to the declaration of a given identifier.  Developers can place the cursor on any variable or type name, click on it while pressing the CTRL key, and then be taken immediately to the declaration of the identifier.

    Line Numbering

The Code Editor provides line numbering, allowing the developer to quickly navigate to a specific line of code or to identify easily a given line of code. Line numbers can be display for every line or for every ten lines.  Either way, the current line number is easily identified.

Hide image

    Current Line Highlighting

The Code Editor can identify the current line by highlighting it with a user defined color.

The image below shows the current line highlighted with a light yellow tint:

Hide image
Click to see full-sized image

    Declaration<->Implementation switching

By using the key combination of  CTRL+SHIFT and the up or down arrow keys, developers can jump between the interface declaration of a class member and the implementation of that member. 

    Bookmarks

Bookmarks provide a convenient way to navigate long files. You can mark a location in your code with a bookmark and jump to that location from anywhere in the file. You can use up to ten bookmarks, numbered 0 through 9, within a file. When you set a bookmark, a book icon  is displayed in the left gutter of the Code Editor.

Hide image

    Search - Find Text

Developers can quickly search for text within the file currently open in the Code Editor.

Hide image

Developers can choose from a number of different search options, including the direction of the search, the scope of the search, or whether the search is case sensitive.  Developers can even use regular expressions to find specific text in the file based upon a regular expression pattern definition.

    Search - Find in Files

Developers can search for specified text across multiple files.

Hide image

Searches can be made across a specific project, a specific project group, or within a specific directory and set of sub-directories. 

    Search - Incremental Search

The Code Editor provides the ability to do incremental search.  Incremental search is invoked with the CTRL+E keystroke combination.  Once invoked, the developer can type the search criteria, and as the new criteria is entered, the Code Editor will find the next matching item in the code.

    Coding Efficiency

Developers need to be efficient, and the RAD Studio IDE provides numerous features to help developers write good code faster.

    Code Completion

Completion Completion provides a drop-down list of alternatives to complete the statement being typing.

Hide image
Click to see full-sized image

Code Completion will automatically appear when a '.' is typed at the end of a valid identifier.  It can also be manually invoked at any time using the CRTL+Space keystroke.

    Parameter Insight

Parameter Insight assists the developer by displaying, in a small hint box, the parameters for a function or procedure as the developer types.  If the routine in question is overloaded, the hint will display for all overloaded parameter lists.  (See figure below).

Hide image

To invoke Parameter Insight, simply type the procedure name, then an opening parenthesis '(' and the hint will appear (if the developer has it turned on automatically).  Parameter Insight can be manually invoked with the CTRL+SHIFT+Space keystroke.

    Block Completion

Block Completion ensures that code blocks are properly closed. It will automatically close a block (usually with an 'end;') when hitting return after opening a code block.

    Help Insight

Help Insight provides popup windows that provide further documentation on the identifier over which the mouse is hovering. 

Hide image

Developers can add their own comments to their code using the /// comment technique that will then be automatically converted into Help Insight comments.  Developers can also style the popup window using the C:\Program Files\CodeGear\RAD Studio\5.0\ObjRepos\HelpInsight.css file.

    Live Templates

Live Templates speed-up typing by providing template- based code insertion.  Live Templates are simple XML files, so developers can write their own code templates depending on their specific needs. In addition, Live Templates are completely scriptable using Delphi code, so developers can write their own scripting engines for use in the IDE.

The image below shows a live template executing in the Code Editor:

Hide image

    Refactoring

Refactoring is the process of changing code to improve readability or structure without changing functionality. The RAD Studio IDE provides an automated refactoring engine, providing the following refactorings:

Introduce Variable

Introduce Field

Inline Variable

Safe Delete

Push Members Up / Down

Pull Members Up

Extract Superclass

Extract Interface

Move Members

Declare variable

Declare field

Extract method

Find unit/import namespace

Extract to resource string

Refactor driven “Find in Files”

    SyncEdit

The Sync Edit feature lets developers simultaneously edit identical identifiers in code. As the first occurrence of the identifier is changed, the same change is performed automatically to all other occurrences of that identifiers. SyncEdit also provide jump points to all for navigation between groups of identical identifiers. 

In the picture below, SyncEdit has been invoked, and the groups of semantically similar text have been noted.  Currently the "TempPointName" identifier is highlighted, and all other instances of "TempPointName" are boxed.  If changes are made to the highlighted instance, the exact changes will be made to all instances in the selected area.

Hide image
Click to see full-sized image

    Error Insight

Error Insight constantly scans code as it is typed, dynamically marking with the familiar "red squiggly" line any syntax errors in the code.  In addition, the structure pain provides a description of the error.

In the diagram below, the variable 'TextToStraighten" is not properly declared, and therefore is highlighted by Error Insight.

Hide image
Click to see full-sized image

    Class Completion

Class Completion is a code productivity feature that creates the proper method and variable declarations

    Code Readability

Gone are the days that code is simply pure text in an editor.  RAD Studio provides numerous features that present text in a readable, easily analyzable way.

    Line Change Indicator

The Gutter shows information about the status of the lines in the editor.  Lines changed since the last save are marked with a yellow bar. Lines changed since the file was first opened and before the last save are marked with green.

Hide image

    Syntax Highlighting

Syntax Highlighting displays code in different colors depending on the purpose and function of the various identifiers.  It enables developer to read better their code by providing visual color cues as to the structure and purpose of code. 

The colors used by the Syntax Highlighter are completely configurable by the developer. 

Hide image

    Parentheses Matching

The code editor will place boxes around matching parentheses in code expressions, making it easy to spot where parentheses line up..

The following image show Parentheses Matching indicating two parentheses matching on different lines of code in a complicated Boolean expression:

    Code Folding

The editor can "fold" individual sections of code so that the folded code is hidden from view.  By default, functions and procedures are folded.  Users can define their own sections of code to be folded using the {$REGION} pragma.

Hide image

 
Copyright© 1994 - 2013 Embarcadero Technologies, Inc. All rights reserved. Contact Us   Site Map   Legal Notices   Privacy Policy   Report Software Piracy