Code Editor Context Menu

From RAD Studio
Jump to: navigation, search

Go Up to Code Editor


Right-click the Code Editor window to display and select from the following context menu of commands:

Item Description Language

Find Declaration

Navigates to the location where a type or variable is defined.

Delphi

Go to Related

Shows a popup menu with a variety of different navigation options depending on the selected item, type, method, or variable. See Go to Related.

C++

Open Source/Header File

Does either of the following:

  • If the implementation file (.cpp) is displayed in the Code Editor, opens the header file (.h).
  • If the header file (.h) is displayed in the Code Editor, opens the implementation file (.cpp).

C++

Open File at Cursor

Searches for and attempts to open a source file whose name matches the text currently under the cursor. Then either:

  • Opens the source file by that name (if one exists).
  • Displays the Open dialog (if a file by that name does not exist in the search path), so that you can browse to the location of a file you want to open.

The file is opened in a new Code Editor page.

Unit scope names are now used to help locate the correct file. Every project has a set of default unit scopes that the IDE can use to search for units if the unqualified unit name is not found. For example, if you point to FMX.Controls.pas and select Open File at Cursor, the IDE searches for the unit-scoped name first (FMX.Controls.pas) and then looks for the unscoped unit name (Controls.pas). Then the IDE takes all the unit scopes defined for the project and prepends each unit scope to the unit name, until either the file is found or there are no more unit scopes: for example, Rtl.Controls.pas, Fmx.Controls.pas, and so on.

Both

Topic Search

Invokes the help system and requests the help topic that matches the currently selected item in the Code Editor.

Both

Complete Class at Cursor

Generates skeleton code for the class members that you declare. See Code Editor for details.

Both

Add To-Do Item...

Opens the Add To-Do Item dialog box so that you can create a To-Do item and add it to the To-Do list.

Both

Cut

Removes the current selection and stores it to the clipboard. Cut works with text when using the Code Editor and with components when using the Form Designer.

Both

Copy

Copies the current selection to the clipboard. Copy works with text when using the Code Editor and with components when using the Form Designer.

Both

Paste

Inserts the contents of the clipboard (previously captured using the Cut or Copy command). Paste works with text when using the Code Editor and with components when using the Form Designer.

Both

Toggle Bookmarks

Sets a new bookmark or removes an existing one (using the bookmark number you select from the submenu). See Using Bookmarks.

Both

Goto Bookmarks

Moves the Code Editor focus to the line marked with the bookmark whose number you select from the submenu. See Using Bookmarks.

Both

Clear Bookmarks

Clears all bookmarks currently set. Only enabled when at least one bookmark is set.

Both

Debug

Toggle Breakpoint

Alternately sets or clears a breakpoint on the current line. See Setting and Modifying Breakpoints.

Evaluate/Modify...

Opens the Evaluate/Modify dialog box:

  • If you right-clicked an editor token, the selected token is evaluated in the Evaluate/Modify dialog box.
  • If you right-clicked whitespace, the Evaluate/Modify dialog box is empty.

Add Watch at Cursor

Set Next Statement

Changes the location of the instruction pointer (that is, the value of EIP register, indicated by CPUStackArrow.png in the left gutter) to the current line in the Code Editor. Use this command when you want to skip certain source statements. When you resume program execution, execution starts at this statement. Set Next Statement is not the same as stepping through instructions; the debugger does not execute any instructions that you might skip.

Enabled only when the current source line has generated machine code (as indicated by a blue dot BlueDot.png in the left-hand gutter of the Code Editor).

Caution: Use this command with extreme care; it is easy to place your system in an unstable state when you skip over program instructions.

Goto Address...

Opens the Enter Address to Position to dialog box, which allows you to enter or select a symbol, and then opens the Disassembly Pane to the associated location.

View CPU

Opens the CPU Windows.

  • If you right-clicked a source line that generated code (a line with a blue dot BlueDot.png), then the selected address in the CPU stack view will be the address that corresponds to that source line.
  • If you right-clicked a line without a blue dot, then the selected address will be EIP (the location of the instruction pointer, indicated by CPUStackArrow.png).

Inspect...

  • If you right-clicked an editor token, the Debug Inspector opens and focuses on the selected token.
  • If you right-clicked whitespace, the Inspect dialog opens, allowing you to type the expression that you want to inspect in the Debug Inspector.

Run to Cursor

Executes the current active program to the line containing the cursor.

Both

Toggle Comment

Toggles comment characters (//) at the beginning of the current line of code. This is an easy way to comment-out selected lines of code.

Both

Fold

Collapses one or more blocks of code (functions, type declarations, preprocessor region directives, XML Doc comments, and so on). Use Ctrl+Shift+K+O to disable (and enable) the Fold command. You can choose the following types of code blocks to fold:

Nearest

Collapses the nearest block to the location of the cursor.

Namespace

Collapses all C++ namespaces or Delphi units in the current source file.

Types

Collapses all type declarations.

Methods

Collapses all method definitions.

Regions

Collapses all preprocessor regions. For Delphi, see Regions; for C++, see #pragma region and #pragma end_region.

Nested Methods

Collapses all nested methods.

Doc Comments

Collapses all XML Documentation comments (triple-slash comments) in Delphi source code. For more information about XML Doc comments, see XML Documentation Comments.

For more information about code folding, see Using Code Folding.

Both

Unfold

Expands one or more collapsed blocks of code (functions, type declarations, preprocessor region directives, XML DOC comments, and so forth).

Nearest

Expands the nearest collapsed block to the location of the cursor.

All

Expands all the collapsed blocks of code in the current source file.

See Using Code Folding.

Both

Refactor
Rename... Opens either the Rename <symbol name> (Delphi) or the Rename Symbol (C++) dialog box. In C++, rename refactoring works only with the Clang-based compilers.
Both

Declare Variable...

Opens the Declare Variable dialog box.

Declare Field...

Opens the Declare Field dialog box.

Extract Method...

Opens the Extract Method dialog box.

Extract Resource String...

Opens the Extract Resource String dialog box.

Find Unit...

Opens the Find Unit dialog box.

Change Params...

Opens the Change Parameters dialog box.

Move...

Opens the Move dialog box.

Extract Interface...

Opens the Extract Interface or Superclass dialog box. You must select one or more classes or class members.

Extract Superclass...

Opens the Extract Interface or Superclass dialog box. You must select one or more classes with a common ancestor, or one or more class members.

Pull Members Up...

Opens the Pull Members Up dialog box. You must select several class members.

Push Members Down...

Opens the Push Members Down dialog box. You must select several class members.

Safe Delete...

Opens the Safe Delete dialog box. You must select one or more classes or class members.

Inline Variable...

Opens the Inline Variable dialog box. You must select a variable.

Introduce Field...

Opens the Introduce Field dialog box. You must select a single complete expression.

Introduce Variable...

Opens the Introduce Variable dialog box. You must select a single complete expression.

Delphi

Add Include

Inspects if the header for the symbol you invoke it for is included. In case it is not, this feature adds it to the includes at the top of the file. (C++)

Create Declaration

Creates a missing method declaration. (C++)

Create Implementation

Creates a missing method implementation. (C++)

Create From Usage

Create classes or introduce enums, variables, and functions/methods at local, class, or global scope.

C++
Find

Find references

Opens the Find References pane.

Find local references

Opens the Find References pane. See Find Local References.

Find declaration symbol

Highlights the declaration of the current method or type in the Code Editor.

Delphi
Find References Opens a dockable window allowing you to search for the symbol under the cursor in the entire project and project group or just the current unit.
Find References in Unit Opens a dockable window allowing you to search for the symbol under the cursor in the current unit.
Find Symbol Finds the definitions of every symbol in your project group or anywhere that Visual Assist can search. You can search across the libraries your application uses, such as the VCL.
C++
Search for Usages... Opens the Search for Usages dialog box to find usages of classes, methods, variables, and overriding methods, derived classes and implemented interfaces in Delphi source code projects. Delphi
Surround Surrounds the highlighted element with the selected code template (logical code symbols or statements). Many of the elements in the Surround list are also code templates, listed in the Templates Window.

In the following descriptions, the ellipsis (...) represents the elements currently selected in the Code Editor for Delphi:

begin Indents the selection and adds begin ... end; statements.
(* Converts the selection into a comment surrounded by (* ... *).
{ Converts the selection into a comment surrounded by { ... }.
else Adds else / begin ... end statements.
forb<code> Adds for I := 0 to List.Count -1 do / begin ... end;.
forin Adds for MyElem in MyList do begin ... end;.
forr Adds for I := List.Count - 1 downto 0 do / begin ... end; statements.
function Adds function MyFunction() : Integer; begin ... end; statements.
ifb Adds if True then begin ... end; statements.
ifeb Adds if True then begin ... end / else / begin ... end; statements.
procedure

Adds procedure MyProcedure(); begin ... end; statements.

region Adds {$REGION} 'MyRegion' ...{$ENDREGION}.
repeat Adds repeat ... until (True);.
Surround Windows Adds {$IFDEF MSWINDOWS} ... {$ENDIF}. See Conditional compilation (Delphi) and IFDEF directive (Delphi).
try Adds MyClass := TComponent.Create(Self); try ... finally MyClass.Free end;.
trye Adds try ... except on E: Exception do / end;.
tryf Adds try ... finally / end;
whileb Adds while True do / begin ... end;
Delphi

In the following descriptions, the ellipsis (...) represents the elements currently selected in the Code Editor for C++:

/* Indents the selection and surrounds it with /* ... */ comment characters.
for Adds for (i = 0; i < 10; i++) { ... }.
if Adds if (true) { ... }.
ifeb Adds if (true) { ... } else { }.
Surround Windows Adds if defined(_WIN32_) ... #endif
throw Replaces selection with throw ExceptionType;.
try Adds try { ... } catch (...) { }.
tryf Adds try { ... } _finally { ... }
whileb Adds while (1) { ... }.
C++
Sync Prototypes Synchronizes the interface and implementation copies of your procedure and function prototypes. See Synchronizing Prototypes for further details. Both
Format Source Formats the Delphi or C/C++ source file being edited. To set formatting options, use the Formatter Options page of the Options dialog box (Tools > Options). The formatting options define indentation, spaces, line breaks, capitalization, and align parameters to be used for the code formatting. See Formatting Source Code. Both
Add to Repository Opens the Add to Repository dialog box, which enables you to add forms and templates to the New Items dialog box in the IDE. Both
View Messages Toggles the display of the Messages View. Both
Read Only Toggles the Code Editor's read-only mode. When this option is enabled, keyboard input is ignored. Both
Editor Options Opens the Editor Options window. Both

Topics

See Also