carbidecpp22devenv/configuration/org.eclipse.osgi/bundles/309/1/.cp/concepts/cdt_c_content_assist.htm
changeset 5 684bf18fdedf
equal deleted inserted replaced
4:4764c8c88759 5:684bf18fdedf
       
     1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
       
     2 <html lang="en">
       
     3 
       
     4 <head>
       
     5 	<meta http-equiv="Content-Language" content="en-us">
       
     6 	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
       
     7 	<title>Content Assist</title>
       
     8 	<link rel="stylesheet" type="text/css" href="../help.css">
       
     9 </head>
       
    10 
       
    11 <body>
       
    12 
       
    13 <h1>Content Assist</h1>
       
    14 
       
    15 <p>Content Assist is a set of tools built into the CDT that can reduce the number of keystrokes you must
       
    16 type to create your code.  The Content Assist plug-in consists of several components that forecast what 
       
    17 a developer will type, based on the current context, scope, and prefix.</p>
       
    18 
       
    19 <h2>Code completion</h2>
       
    20 
       
    21 <p>Content assist provides code completion anywhere in the document. For the current project a list is 
       
    22 displayed of the elements that begin with the letter combination you entered, and 
       
    23 the relevance of each proposal is determined in the following order:</p>
       
    24 
       
    25 <ul>
       
    26   <li>Fields</li>
       
    27   <li>Variables</li>
       
    28   <li>Methods</li>
       
    29   <li>Functions</li>
       
    30   <li>Classes</li>
       
    31   <li>Structs</li>
       
    32   <li>Unions</li>
       
    33   <li>Namespaces</li>
       
    34   <li>Enumerations</li>
       
    35 </ul>
       
    36 
       
    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 
       
    38 &quot;<b>.</b>&quot;, &quot;<b>-></b>&quot; or &quot;<b>::</b>&quot;.</p>
       
    39 
       
    40 <p><img src="../images/contentAssist_example.png"  alt="C++ example showing Code Assist popup"></p>
       
    41 
       
    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>
       
    43 
       
    44 <h2>Templates</h2>
       
    45 
       
    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 
       
    47 templates.</p>
       
    48 
       
    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 
       
    50 list of code elements and templates that start with the letter combination that you typed is displayed.</p>
       
    51 
       
    52 <p>You can then select a template from the list and it is inserted directly into your code.</p>
       
    53 
       
    54 <img src="../images/editor_c_codetemplates_use.png"  alt="C++ example showing Code Assist popup"></p>
       
    55 
       
    56 <p>For example, the template <samp>do while statement</samp> contains the following code:</p>
       
    57 
       
    58 <p><img src="../images/codetemplates_example.png"  alt="Code Template showing do-while example"></p>
       
    59 
       
    60 <p> When you select the <samp>do</samp> template from the list, you insert the following code:</p>
       
    61 
       
    62 <p><pre>do {
       
    63 } while (condition);</pre></p>
       
    64 
       
    65 
       
    66 <p>If the completion engine finds only one proposal in your templates, that proposal is inserted at the current cursor position.  
       
    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>
       
    68 <p><pre>int
       
    69 main(int argc, char **argv) {
       
    70 	
       
    71 }</pre></p>
       
    72 
       
    73 <h2>No Completions</h2>
       
    74 
       
    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>
       
    76 
       
    77 <p><img src="../images/cdt_ca_no_completions.png"  alt="Content Assist No completions available message"></p>
       
    78 
       
    79 
       
    80 <p><img border="0" src="../images/ngconcepts.gif" ALT="Related concepts" width="143" height="21">
       
    81 <br>
       
    82 <a href="cdt_o_code_entry.htm">Code entry</a></p>
       
    83 <p><img border="0" src="../images/ngtasks.gif" ALT="Related tasks" width="143" height="21">
       
    84 <br>
       
    85 <a href="../tasks/cdt_t_contentassist.htm">Using Content Assist</a><br>
       
    86 <a href="../tasks/cdt_t_add_codetemp.htm">Creating and editing templates</a><br>
       
    87 <a href="../tasks/cdt_t_imp_code_temp.htm">Importing and exporting templates</a></p>
       
    88 <p><img border="0" src="../images/ngref.gif" ALT="Related reference" width="143" height="21">
       
    89 <br>
       
    90 <a href="../reference/cdt_u_icons.htm">C/C++ perspective icons</a></p>
       
    91 
       
    92 <p>
       
    93 
       
    94 <img src="../images/ng00_04a.gif" ALT="IBM Copyright Statement" ></p>
       
    95 
       
    96 </body>
       
    97 
       
    98 </html>