carbidecpp22devenv/configuration/org.eclipse.osgi/bundles/309/1/.cp/concepts/cdt_c_content_assist.htm
author cawthron
Fri, 04 Dec 2009 10:01:33 -0600
changeset 5 684bf18fdedf
permissions -rw-r--r--
add files for RCL_2_2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
     1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
     2
<html lang="en">
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
     3
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
     4
<head>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
     5
	<meta http-equiv="Content-Language" content="en-us">
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
     6
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
     7
	<title>Content Assist</title>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
     8
	<link rel="stylesheet" type="text/css" href="../help.css">
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
     9
</head>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    10
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    11
<body>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    12
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    13
<h1>Content Assist</h1>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    14
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    15
<p>Content Assist is a set of tools built into the CDT that can reduce the number of keystrokes you must
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    16
type to create your code.  The Content Assist plug-in consists of several components that forecast what 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    17
a developer will type, based on the current context, scope, and prefix.</p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    18
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    19
<h2>Code completion</h2>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    20
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    21
<p>Content assist provides code completion anywhere in the document. For the current project a list is 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    22
displayed of the elements that begin with the letter combination you entered, and 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    23
the relevance of each proposal is determined in the following order:</p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    24
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    25
<ul>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    26
  <li>Fields</li>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    27
  <li>Variables</li>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    28
  <li>Methods</li>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    29
  <li>Functions</li>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    30
  <li>Classes</li>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    31
  <li>Structs</li>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    32
  <li>Unions</li>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    33
  <li>Namespaces</li>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    34
  <li>Enumerations</li>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    35
</ul>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    36
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    37
You trigger the Code completion feature when you call Content Assist (such as when you type <tt>Ctrl+Space</tt>), but it is auto-activated when you type 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    38
&quot;<b>.</b>&quot;, &quot;<b>-></b>&quot; or &quot;<b>::</b>&quot;.</p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    39
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    40
<p><img src="../images/contentAssist_example.png"  alt="C++ example showing Code Assist popup"></p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    41
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    42
<p>You can view the signature of each item on the list in a pop-up by pointing to it. You can then select an item in the list to  insert it directly into your code. </p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    43
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    44
<h2>Templates</h2>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    45
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    46
<p>You can create and save templates for frequently used sections of code, which will be inserted according to scope. The Content Assist feature also provides quick access to code 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    47
templates.</p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    48
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    49
<p>When you enter a letter combination in the C/C++ editor, and type <tt>CTRL+SPACE</tt> (or right-click and click <b>Content Assist</b>), a 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    50
list of code elements and templates that start with the letter combination that you typed is displayed.</p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    51
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    52
<p>You can then select a template from the list and it is inserted directly into your code.</p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    53
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    54
<img src="../images/editor_c_codetemplates_use.png"  alt="C++ example showing Code Assist popup"></p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    55
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    56
<p>For example, the template <samp>do while statement</samp> contains the following code:</p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    57
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    58
<p><img src="../images/codetemplates_example.png"  alt="Code Template showing do-while example"></p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    59
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    60
<p> When you select the <samp>do</samp> template from the list, you insert the following code:</p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    61
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    62
<p><pre>do {
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    63
} while (condition);</pre></p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    64
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    65
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    66
<p>If the completion engine finds only one proposal in your templates, that proposal is inserted at the current cursor position.  
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    67
For example if you create a new .cpp file and type <tt>mai+CTRL+SPACE</tt> the following code is inserted at the cursor location:</p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    68
<p><pre>int
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    69
main(int argc, char **argv) {
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    70
	
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    71
}</pre></p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    72
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    73
<h2>No Completions</h2>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    74
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    75
<p>If you invoke Content Assist, but no completions are found a message will be displayed on the status to inform you that the Content Assist parser has timed out.</p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    76
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    77
<p><img src="../images/cdt_ca_no_completions.png"  alt="Content Assist No completions available message"></p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    78
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    79
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    80
<p><img border="0" src="../images/ngconcepts.gif" ALT="Related concepts" width="143" height="21">
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    81
<br>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    82
<a href="cdt_o_code_entry.htm">Code entry</a></p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    83
<p><img border="0" src="../images/ngtasks.gif" ALT="Related tasks" width="143" height="21">
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    84
<br>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    85
<a href="../tasks/cdt_t_contentassist.htm">Using Content Assist</a><br>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    86
<a href="../tasks/cdt_t_add_codetemp.htm">Creating and editing templates</a><br>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    87
<a href="../tasks/cdt_t_imp_code_temp.htm">Importing and exporting templates</a></p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    88
<p><img border="0" src="../images/ngref.gif" ALT="Related reference" width="143" height="21">
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    89
<br>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    90
<a href="../reference/cdt_u_icons.htm">C/C++ perspective icons</a></p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    91
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    92
<p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    93
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    94
<img src="../images/ng00_04a.gif" ALT="IBM Copyright Statement" ></p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    95
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    96
</body>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    97
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    98
</html>